[siba] add more MCS tx power offset decoding.

This is required by the bwn(4) N-PHY support.

Obtained from:	Linux ssb (definitions)
This commit is contained in:
Adrian Chadd 2016-05-12 16:14:16 +00:00
parent 2ddb11afb2
commit 7deb99d785
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299541
3 changed files with 69 additions and 0 deletions

View File

@ -1834,6 +1834,9 @@ siba_sprom_r8(struct siba_sprom *out, const uint16_t *in)
SIBA_SHIFTOUT(core_pwr_info[i].pa_5gh[2], o + SIBA_SROM8_5GH_PA_2, ~0);
}
SIBA_SHIFTOUT(cddpo, SIBA_SPROM8_CDDPO, ~0);
SIBA_SHIFTOUT(stbcpo, SIBA_SPROM8_STBCPO, ~0);
siba_sprom_r458(out, in);
}
@ -2562,6 +2565,12 @@ siba_read_sprom(device_t dev, device_t child, int which, uintptr_t *result)
case SIBA_SPROMVAR_TXPID_5GH_3:
*result = siba->siba_sprom.txpid5gh[3];
break;
case SIBA_SPROMVAR_STBCPO:
*result = siba->siba_sprom.stbcpo;
break;
case SIBA_SPROMVAR_CDDPO:
*result = siba->siba_sprom.cddpo;
break;
default:
return (ENOENT);
}
@ -2814,6 +2823,46 @@ siba_sprom_get_core_power_info(device_t dev, int core,
return (0);
}
int
siba_sprom_get_mcs2gpo(device_t dev, uint16_t *c)
{
struct siba_dev_softc *sd = device_get_ivars(dev);
struct siba_softc *siba = sd->sd_bus;
memcpy(c, &siba->siba_sprom.mcs2gpo, sizeof(uint16_t) * 8);
return (0);
}
int
siba_sprom_get_mcs5glpo(device_t dev, uint16_t *c)
{
struct siba_dev_softc *sd = device_get_ivars(dev);
struct siba_softc *siba = sd->sd_bus;
memcpy(c, &siba->siba_sprom.mcs5glpo, sizeof(uint16_t) * 8);
return (0);
}
int
siba_sprom_get_mcs5gpo(device_t dev, uint16_t *c)
{
struct siba_dev_softc *sd = device_get_ivars(dev);
struct siba_softc *siba = sd->sd_bus;
memcpy(c, &siba->siba_sprom.mcs5gpo, sizeof(uint16_t) * 8);
return (0);
}
int
siba_sprom_get_mcs5ghpo(device_t dev, uint16_t *c)
{
struct siba_dev_softc *sd = device_get_ivars(dev);
struct siba_softc *siba = sd->sd_bus;
memcpy(c, &siba->siba_sprom.mcs5ghpo, sizeof(uint16_t) * 8);
return (0);
}
void
siba_pmu_spuravoid_pllupdate(device_t dev, int spur_avoid)
{

View File

@ -520,6 +520,10 @@
#define SIBA_SPROM8_OFDM5GPO 0x1146
#define SIBA_SPROM8_OFDM5GLPO 0x114a
#define SIBA_SPROM8_OFDM5GHPO 0x114e
#define SIBA_SPROM8_CDDPO 0x0192
#define SIBA_SPROM8_STBCPO 0x0194
#define SIBA_SPROM8_BW40PO 0x0196
#define SIBA_SPROM8_BWDUPPO 0x0198
/* There are 4 blocks with power info sharing the same layout */
#define SIBA_SROM8_PWR_INFO_CORE0 0x00C0

View File

@ -305,6 +305,8 @@ enum siba_sprom_vars {
SIBA_SPROMVAR_TXPID_5GH_1,
SIBA_SPROMVAR_TXPID_5GH_2,
SIBA_SPROMVAR_TXPID_5GH_3,
SIBA_SPROMVAR_STBCPO,
SIBA_SPROMVAR_CDDPO,
};
int siba_read_sprom(device_t, device_t, int, uintptr_t *);
@ -419,6 +421,8 @@ SIBA_SPROM_ACCESSOR(txpid_5gh_0, TXPID_5GH_0, uint8_t);
SIBA_SPROM_ACCESSOR(txpid_5gh_1, TXPID_5GH_1, uint8_t);
SIBA_SPROM_ACCESSOR(txpid_5gh_2, TXPID_5GH_2, uint8_t);
SIBA_SPROM_ACCESSOR(txpid_5gh_3, TXPID_5GH_3, uint8_t);
SIBA_SPROM_ACCESSOR(stbcpo, STBCPO, uint16_t);
SIBA_SPROM_ACCESSOR(cddpo, CDDPO, uint16_t);
#undef SIBA_SPROM_ACCESSOR
@ -512,6 +516,14 @@ struct siba_sprom {
uint8_t antswlut;
} ghz5;
} fem;
uint16_t mcs2gpo[8];
uint16_t mcs5gpo[8];
uint16_t mcs5glpo[8];
uint16_t mcs5ghpo[8];
uint16_t cddpo;
uint16_t stbcpo;
};
#define SIBA_LDO_PAREF 0
@ -648,6 +660,10 @@ uint32_t siba_gpio_get(device_t);
void siba_fix_imcfglobug(device_t);
int siba_sprom_get_core_power_info(device_t, int,
struct siba_sprom_core_pwr_info *);
int siba_sprom_get_mcs2gpo(device_t, uint16_t *);
int siba_sprom_get_mcs5glpo(device_t, uint16_t *);
int siba_sprom_get_mcs5gpo(device_t, uint16_t *);
int siba_sprom_get_mcs5ghpo(device_t, uint16_t *);
void siba_pmu_spuravoid_pllupdate(device_t, int);
void siba_cc_set32(device_t dev, uint32_t, uint32_t);
void siba_cc_mask32(device_t dev, uint32_t, uint32_t);