Commit 7ddaad7e authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: change parameter in driver variable lookup

The functions getvar() and getintvar() had to pass the buffer
containing the driver variables. Now they pass the structure
containing this buffer hiding what type of buffer/container
is used for storing the driver variables.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarAlwin Beukers <alwin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f4e5c544
...@@ -1012,7 +1012,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx) ...@@ -1012,7 +1012,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)
/* /*
* get boardtype and boardrev * get boardtype and boardrev
*/ */
static __used void ai_nvram_process(struct si_info *sii, char *pvars) static __used void ai_nvram_process(struct si_info *sii)
{ {
uint w = 0; uint w = 0;
...@@ -1021,7 +1021,7 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars) ...@@ -1021,7 +1021,7 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars)
sii->pub.boardvendor = w & 0xffff; sii->pub.boardvendor = w & 0xffff;
sii->pub.boardtype = (w >> 16) & 0xffff; sii->pub.boardtype = (w >> 16) & 0xffff;
sii->pub.boardflags = getintvar(pvars, "boardflags"); sii->pub.boardflags = getintvar(&sii->pub, "boardflags");
} }
static struct si_info *ai_doattach(struct si_info *sii, static struct si_info *ai_doattach(struct si_info *sii,
...@@ -1031,7 +1031,6 @@ static struct si_info *ai_doattach(struct si_info *sii, ...@@ -1031,7 +1031,6 @@ static struct si_info *ai_doattach(struct si_info *sii,
struct si_pub *sih = &sii->pub; struct si_pub *sih = &sii->pub;
u32 w, savewin; u32 w, savewin;
struct chipcregs __iomem *cc; struct chipcregs __iomem *cc;
char *pvars = NULL;
uint socitype; uint socitype;
uint origidx; uint origidx;
...@@ -1095,8 +1094,9 @@ static struct si_info *ai_doattach(struct si_info *sii, ...@@ -1095,8 +1094,9 @@ static struct si_info *ai_doattach(struct si_info *sii,
if (srom_var_init(&sii->pub, cc, vars, varsz)) if (srom_var_init(&sii->pub, cc, vars, varsz))
goto exit; goto exit;
pvars = vars ? *vars : NULL; sii->vars = vars ? *vars : NULL;
ai_nvram_process(sii, pvars); sii->varsz = varsz ? *varsz : 0;
ai_nvram_process(sii);
/* === NVRAM, clock is ready === */ /* === NVRAM, clock is ready === */
cc = (struct chipcregs __iomem *) ai_setcore(sih, CC_CORE_ID, 0); cc = (struct chipcregs __iomem *) ai_setcore(sih, CC_CORE_ID, 0);
...@@ -1109,7 +1109,7 @@ static struct si_info *ai_doattach(struct si_info *sii, ...@@ -1109,7 +1109,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
u32 xtalfreq; u32 xtalfreq;
si_pmu_init(sih); si_pmu_init(sih);
si_pmu_chip_init(sih); si_pmu_chip_init(sih);
xtalfreq = getintvar(pvars, "xtalfreq"); xtalfreq = getintvar(sih, "xtalfreq");
/* If xtalfreq var not available, try to measure it */ /* If xtalfreq var not available, try to measure it */
if (xtalfreq == 0) if (xtalfreq == 0)
xtalfreq = si_pmu_measure_alpclk(sih); xtalfreq = si_pmu_measure_alpclk(sih);
...@@ -1119,14 +1119,14 @@ static struct si_info *ai_doattach(struct si_info *sii, ...@@ -1119,14 +1119,14 @@ static struct si_info *ai_doattach(struct si_info *sii,
} }
/* setup the GPIO based LED powersave register */ /* setup the GPIO based LED powersave register */
w = getintvar(pvars, "leddc"); w = getintvar(sih, "leddc");
if (w == 0) if (w == 0)
w = DEFAULT_GPIOTIMERVAL; w = DEFAULT_GPIOTIMERVAL;
ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval), ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval),
~0, w); ~0, w);
if (PCIE(sii)) if (PCIE(sii))
pcicore_attach(sii->pch, pvars, SI_DOATTACH); pcicore_attach(sii->pch, SI_DOATTACH);
if (sih->chip == BCM43224_CHIP_ID) { if (sih->chip == BCM43224_CHIP_ID) {
/* /*
...@@ -1191,8 +1191,6 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz) ...@@ -1191,8 +1191,6 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz)
kfree(sii); kfree(sii);
return NULL; return NULL;
} }
sii->vars = vars ? *vars : NULL;
sii->varsz = varsz ? *varsz : 0;
return (struct si_pub *) sii; return (struct si_pub *) sii;
} }
......
...@@ -108,6 +108,7 @@ brcms_c_antsel_init_cfg(struct antsel_info *asi, struct brcms_antselcfg *antsel, ...@@ -108,6 +108,7 @@ brcms_c_antsel_init_cfg(struct antsel_info *asi, struct brcms_antselcfg *antsel,
struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
{ {
struct antsel_info *asi; struct antsel_info *asi;
struct si_pub *sih = wlc->hw->sih;
asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC); asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC);
if (!asi) if (!asi)
...@@ -117,7 +118,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) ...@@ -117,7 +118,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
asi->pub = wlc->pub; asi->pub = wlc->pub;
asi->antsel_type = ANTSEL_NA; asi->antsel_type = ANTSEL_NA;
asi->antsel_avail = false; asi->antsel_avail = false;
asi->antsel_antswitch = (u8) getintvar(asi->pub->vars, "antswitch"); asi->antsel_antswitch = (u8) getintvar(sih, "antswitch");
if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) { if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) {
switch (asi->antsel_antswitch) { switch (asi->antsel_antswitch) {
...@@ -127,12 +128,12 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) ...@@ -127,12 +128,12 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
/* 4321/2 board with 2x3 switch logic */ /* 4321/2 board with 2x3 switch logic */
asi->antsel_type = ANTSEL_2x3; asi->antsel_type = ANTSEL_2x3;
/* Antenna selection availability */ /* Antenna selection availability */
if (((u16) getintvar(asi->pub->vars, "aa2g") == 7) || if (((u16) getintvar(sih, "aa2g") == 7) ||
((u16) getintvar(asi->pub->vars, "aa5g") == 7)) { ((u16) getintvar(sih, "aa5g") == 7)) {
asi->antsel_avail = true; asi->antsel_avail = true;
} else if ( } else if (
(u16) getintvar(asi->pub->vars, "aa2g") == 3 || (u16) getintvar(sih, "aa2g") == 3 ||
(u16) getintvar(asi->pub->vars, "aa5g") == 3) { (u16) getintvar(sih, "aa5g") == 3) {
asi->antsel_avail = false; asi->antsel_avail = false;
} else { } else {
asi->antsel_avail = false; asi->antsel_avail = false;
...@@ -145,8 +146,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) ...@@ -145,8 +146,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
break; break;
} }
} else if ((asi->pub->sromrev == 4) && } else if ((asi->pub->sromrev == 4) &&
((u16) getintvar(asi->pub->vars, "aa2g") == 7) && ((u16) getintvar(sih, "aa2g") == 7) &&
((u16) getintvar(asi->pub->vars, "aa5g") == 0)) { ((u16) getintvar(sih, "aa5g") == 0)) {
/* hack to match old 4321CB2 cards with 2of3 antenna switch */ /* hack to match old 4321CB2 cards with 2of3 antenna switch */
asi->antsel_type = ANTSEL_2x3; asi->antsel_type = ANTSEL_2x3;
asi->antsel_avail = true; asi->antsel_avail = true;
......
...@@ -1088,7 +1088,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) ...@@ -1088,7 +1088,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
wlc->cmi = wlc_cm; wlc->cmi = wlc_cm;
/* store the country code for passing up as a regulatory hint */ /* store the country code for passing up as a regulatory hint */
ccode = getvar(wlc->pub->vars, "ccode"); ccode = getvar(wlc->hw->sih, "ccode");
if (ccode) if (ccode)
strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1); strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
......
...@@ -1990,7 +1990,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw) ...@@ -1990,7 +1990,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw)
char *macaddr; char *macaddr;
/* If macaddr exists, use it (Sromrev4, CIS, ...). */ /* If macaddr exists, use it (Sromrev4, CIS, ...). */
macaddr = getvar(wlc_hw->vars, varname); macaddr = getvar(wlc_hw->sih, varname);
if (macaddr != NULL) if (macaddr != NULL)
return macaddr; return macaddr;
...@@ -1999,7 +1999,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw) ...@@ -1999,7 +1999,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw)
else else
varname = "il0macaddr"; varname = "il0macaddr";
macaddr = getvar(wlc_hw->vars, varname); macaddr = getvar(wlc_hw->sih, varname);
if (macaddr == NULL) if (macaddr == NULL)
wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr " wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr "
"getvar(%s) not found\n", wlc_hw->unit, varname); "getvar(%s) not found\n", wlc_hw->unit, varname);
...@@ -4593,13 +4593,13 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, ...@@ -4593,13 +4593,13 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
* than those the BIOS recognizes for devices on PCMCIA_BUS, * than those the BIOS recognizes for devices on PCMCIA_BUS,
* SDIO_BUS, and SROMless devices on PCI_BUS. * SDIO_BUS, and SROMless devices on PCI_BUS.
*/ */
var = getvar(vars, "vendid"); var = getvar(wlc_hw->sih, "vendid");
if (var && !kstrtoul(var, 0, &res)) { if (var && !kstrtoul(var, 0, &res)) {
vendor = (u16)res; vendor = (u16)res;
wiphy_err(wiphy, "Overriding vendor id = 0x%x\n", wiphy_err(wiphy, "Overriding vendor id = 0x%x\n",
vendor); vendor);
} }
var = getvar(vars, "devid"); var = getvar(wlc_hw->sih, "devid");
if (var && !kstrtoul(var, 0, &res)) { if (var && !kstrtoul(var, 0, &res)) {
u16 devid = (u16)res; u16 devid = (u16)res;
if (devid != 0xffff) { if (devid != 0xffff) {
...@@ -4656,7 +4656,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, ...@@ -4656,7 +4656,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
} }
/* get the board rev, used just below */ /* get the board rev, used just below */
j = getintvar(vars, "boardrev"); j = getintvar(wlc_hw->sih, "boardrev");
/* promote srom boardrev of 0xFF to 1 */ /* promote srom boardrev of 0xFF to 1 */
if (j == BOARDREV_PROMOTABLE) if (j == BOARDREV_PROMOTABLE)
j = BOARDREV_PROMOTED; j = BOARDREV_PROMOTED;
...@@ -4668,9 +4668,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, ...@@ -4668,9 +4668,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
err = 15; err = 15;
goto fail; goto fail;
} }
wlc_hw->sromrev = (u8) getintvar(vars, "sromrev"); wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, "sromrev");
wlc_hw->boardflags = (u32) getintvar(vars, "boardflags"); wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih, "boardflags");
wlc_hw->boardflags2 = (u32) getintvar(vars, "boardflags2"); wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih, "boardflags2");
if (wlc_hw->boardflags & BFL_NOPLLDOWN) if (wlc_hw->boardflags & BFL_NOPLLDOWN)
brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED);
...@@ -4920,15 +4920,16 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) ...@@ -4920,15 +4920,16 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
uint unit; uint unit;
char *vars; char *vars;
int bandtype; int bandtype;
struct si_pub *sih = wlc->hw->sih;
unit = wlc->pub->unit; unit = wlc->pub->unit;
vars = wlc->pub->vars; vars = wlc->pub->vars;
bandtype = wlc->band->bandtype; bandtype = wlc->band->bandtype;
/* get antennas available */ /* get antennas available */
aa = (s8) getintvar(vars, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g"); aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g");
if (aa == 0) if (aa == 0)
aa = (s8) getintvar(vars, aa = (s8) getintvar(sih,
bandtype == BRCM_BAND_5G ? "aa1" : "aa0"); bandtype == BRCM_BAND_5G ? "aa1" : "aa0");
if ((aa < 1) || (aa > 15)) { if ((aa < 1) || (aa > 15)) {
wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in" wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in"
...@@ -4947,8 +4948,8 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) ...@@ -4947,8 +4948,8 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
} }
/* Compute Antenna Gain */ /* Compute Antenna Gain */
wlc->band->antgain = wlc->band->antgain = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ?
(s8) getintvar(vars, bandtype == BRCM_BAND_5G ? "ag1" : "ag0"); "ag1" : "ag0");
brcms_c_attach_antgain_init(wlc); brcms_c_attach_antgain_init(wlc);
return true; return true;
...@@ -5114,9 +5115,9 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, ...@@ -5114,9 +5115,9 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
/* set maximum allowed duty cycle */ /* set maximum allowed duty cycle */
wlc->tx_duty_cycle_ofdm = wlc->tx_duty_cycle_ofdm =
(u16) getintvar(pub->vars, "tx_duty_cycle_ofdm"); (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_ofdm");
wlc->tx_duty_cycle_cck = wlc->tx_duty_cycle_cck =
(u16) getintvar(pub->vars, "tx_duty_cycle_cck"); (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_cck");
brcms_c_stf_phy_chain_calc(wlc); brcms_c_stf_phy_chain_calc(wlc);
......
...@@ -719,13 +719,13 @@ static void pcie_war_pci_setup(struct pcicore_info *pi) ...@@ -719,13 +719,13 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)
} }
/* ***** Functions called during driver state changes ***** */ /* ***** Functions called during driver state changes ***** */
void pcicore_attach(struct pcicore_info *pi, char *pvars, int state) void pcicore_attach(struct pcicore_info *pi, int state)
{ {
struct si_pub *sih = pi->sih; struct si_pub *sih = pi->sih;
/* Determine if this board needs override */ /* Determine if this board needs override */
if (PCIE_ASPM(sih)) { if (PCIE_ASPM(sih)) {
if ((u32)getintvar(pvars, "boardflags2") & BFL2_PCIEWAR_OVR) if ((u32)getintvar(sih, "boardflags2") & BFL2_PCIEWAR_OVR)
pi->pcie_war_aspm_ovr = PCIE_ASPM_DISAB; pi->pcie_war_aspm_ovr = PCIE_ASPM_DISAB;
else else
pi->pcie_war_aspm_ovr = PCIE_ASPM_ENAB; pi->pcie_war_aspm_ovr = PCIE_ASPM_ENAB;
......
...@@ -65,7 +65,7 @@ extern struct pcicore_info *pcicore_init(struct si_pub *sih, ...@@ -65,7 +65,7 @@ extern struct pcicore_info *pcicore_init(struct si_pub *sih,
struct pci_dev *pdev, struct pci_dev *pdev,
void __iomem *regs); void __iomem *regs);
extern void pcicore_deinit(struct pcicore_info *pch); extern void pcicore_deinit(struct pcicore_info *pch);
extern void pcicore_attach(struct pcicore_info *pch, char *pvars, int state); extern void pcicore_attach(struct pcicore_info *pch, int state);
extern void pcicore_hwup(struct pcicore_info *pch); extern void pcicore_hwup(struct pcicore_info *pch);
extern void pcicore_up(struct pcicore_info *pch, int state); extern void pcicore_up(struct pcicore_info *pch, int state);
extern void pcicore_sleep(struct pcicore_info *pch); extern void pcicore_sleep(struct pcicore_info *pch);
......
...@@ -4817,27 +4817,25 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4817,27 +4817,25 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
s8 txpwr = 0; s8 txpwr = 0;
int i; int i;
struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;
struct phy_shim_info *shim = pi->sh->physhim;
if (CHSPEC_IS2G(pi->radio_chanspec)) { if (CHSPEC_IS2G(pi->radio_chanspec)) {
u16 cckpo = 0; u16 cckpo = 0;
u32 offset_ofdm, offset_mcs; u32 offset_ofdm, offset_mcs;
pi_lcn->lcnphy_tr_isolation_mid = pi_lcn->lcnphy_tr_isolation_mid =
(u8) wlapi_getintvar(pi->vars, "triso2g"); (u8)wlapi_getintvar(shim, "triso2g");
pi_lcn->lcnphy_rx_power_offset = pi_lcn->lcnphy_rx_power_offset =
(u8) wlapi_getintvar(pi->vars, "rxpo2g"); (u8)wlapi_getintvar(shim, "rxpo2g");
pi->txpa_2g[0] = (s16) wlapi_getintvar(pi->vars, "pa0b0"); pi->txpa_2g[0] = (s16)wlapi_getintvar(shim, "pa0b0");
pi->txpa_2g[1] = (s16) wlapi_getintvar(pi->vars, "pa0b1"); pi->txpa_2g[1] = (s16)wlapi_getintvar(shim, "pa0b1");
pi->txpa_2g[2] = (s16) wlapi_getintvar(pi->vars, "pa0b2"); pi->txpa_2g[2] = (s16)wlapi_getintvar(shim, "pa0b2");
pi_lcn->lcnphy_rssi_vf = pi_lcn->lcnphy_rssi_vf = (u8)wlapi_getintvar(shim, "rssismf2g");
(u8) wlapi_getintvar(pi->vars, "rssismf2g"); pi_lcn->lcnphy_rssi_vc = (u8)wlapi_getintvar(shim, "rssismc2g");
pi_lcn->lcnphy_rssi_vc = pi_lcn->lcnphy_rssi_gs = (u8)wlapi_getintvar(shim, "rssisav2g");
(u8) wlapi_getintvar(pi->vars, "rssismc2g");
pi_lcn->lcnphy_rssi_gs =
(u8) wlapi_getintvar(pi->vars, "rssisav2g");
pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf; pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf;
pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc; pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc;
...@@ -4847,7 +4845,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4847,7 +4845,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc; pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc;
pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs; pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs;
txpwr = (s8) wlapi_getintvar(pi->vars, "maxp2ga0"); txpwr = (s8)wlapi_getintvar(shim, "maxp2ga0");
pi->tx_srom_max_2g = txpwr; pi->tx_srom_max_2g = txpwr;
for (i = 0; i < PWRTBL_NUM_COEFF; i++) { for (i = 0; i < PWRTBL_NUM_COEFF; i++) {
...@@ -4855,7 +4853,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4855,7 +4853,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
pi->txpa_2g_high_temp[i] = pi->txpa_2g[i]; pi->txpa_2g_high_temp[i] = pi->txpa_2g[i];
} }
cckpo = (u16) wlapi_getintvar(pi->vars, "cck2gpo"); cckpo = (u16)wlapi_getintvar(shim, "cck2gpo");
if (cckpo) { if (cckpo) {
uint max_pwr_chan = txpwr; uint max_pwr_chan = txpwr;
...@@ -4865,8 +4863,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4865,8 +4863,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
cckpo >>= 4; cckpo >>= 4;
} }
offset_ofdm = offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo");
(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) {
pi->tx_srom_max_rate_2g[i] = pi->tx_srom_max_rate_2g[i] =
max_pwr_chan - max_pwr_chan -
...@@ -4876,13 +4873,12 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4876,13 +4873,12 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
} else { } else {
u8 opo = 0; u8 opo = 0;
opo = (u8) wlapi_getintvar(pi->vars, "opo"); opo = (u8)wlapi_getintvar(shim, "opo");
for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++)
pi->tx_srom_max_rate_2g[i] = txpwr; pi->tx_srom_max_rate_2g[i] = txpwr;
offset_ofdm = offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo");
(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) {
pi->tx_srom_max_rate_2g[i] = txpwr - pi->tx_srom_max_rate_2g[i] = txpwr -
...@@ -4890,9 +4886,9 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4890,9 +4886,9 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
offset_ofdm >>= 4; offset_ofdm >>= 4;
} }
offset_mcs = offset_mcs =
wlapi_getintvar(pi->vars, "mcs2gpo1") << 16; wlapi_getintvar(shim, "mcs2gpo1") << 16;
offset_mcs |= offset_mcs |=
(u16) wlapi_getintvar(pi->vars, "mcs2gpo0"); (u16) wlapi_getintvar(shim, "mcs2gpo0");
pi_lcn->lcnphy_mcs20_po = offset_mcs; pi_lcn->lcnphy_mcs20_po = offset_mcs;
for (i = TXP_FIRST_SISO_MCS_20; for (i = TXP_FIRST_SISO_MCS_20;
i <= TXP_LAST_SISO_MCS_20; i++) { i <= TXP_LAST_SISO_MCS_20; i++) {
...@@ -4903,30 +4899,30 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) ...@@ -4903,30 +4899,30 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
} }
pi_lcn->lcnphy_rawtempsense = pi_lcn->lcnphy_rawtempsense =
(u16) wlapi_getintvar(pi->vars, "rawtempsense"); (u16)wlapi_getintvar(shim, "rawtempsense");
pi_lcn->lcnphy_measPower = pi_lcn->lcnphy_measPower =
(u8) wlapi_getintvar(pi->vars, "measpower"); (u8)wlapi_getintvar(shim, "measpower");
pi_lcn->lcnphy_tempsense_slope = pi_lcn->lcnphy_tempsense_slope =
(u8) wlapi_getintvar(pi->vars, "tempsense_slope"); (u8)wlapi_getintvar(shim, "tempsense_slope");
pi_lcn->lcnphy_hw_iqcal_en = pi_lcn->lcnphy_hw_iqcal_en =
(bool) wlapi_getintvar(pi->vars, "hw_iqcal_en"); (bool)wlapi_getintvar(shim, "hw_iqcal_en");
pi_lcn->lcnphy_iqcal_swp_dis = pi_lcn->lcnphy_iqcal_swp_dis =
(bool) wlapi_getintvar(pi->vars, "iqcal_swp_dis"); (bool)wlapi_getintvar(shim, "iqcal_swp_dis");
pi_lcn->lcnphy_tempcorrx = pi_lcn->lcnphy_tempcorrx =
(u8) wlapi_getintvar(pi->vars, "tempcorrx"); (u8)wlapi_getintvar(shim, "tempcorrx");
pi_lcn->lcnphy_tempsense_option = pi_lcn->lcnphy_tempsense_option =
(u8) wlapi_getintvar(pi->vars, "tempsense_option"); (u8)wlapi_getintvar(shim, "tempsense_option");
pi_lcn->lcnphy_freqoffset_corr = pi_lcn->lcnphy_freqoffset_corr =
(u8) wlapi_getintvar(pi->vars, "freqoffset_corr"); (u8)wlapi_getintvar(shim, "freqoffset_corr");
if ((u8) getintvar(pi->vars, "aa2g") > 1) if ((u8)wlapi_getintvar(shim, "aa2g") > 1)
wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi, wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi,
(u8) getintvar(pi->vars, (u8) wlapi_getintvar(shim,
"aa2g")); "aa2g"));
} }
pi_lcn->lcnphy_cck_dig_filt_type = -1; pi_lcn->lcnphy_cck_dig_filt_type = -1;
if (wlapi_getvar(pi->vars, "cckdigfilttype")) { if (wlapi_getvar(shim, "cckdigfilttype")) {
s16 temp; s16 temp;
temp = (s16) wlapi_getintvar(pi->vars, "cckdigfilttype"); temp = (s16)wlapi_getintvar(shim, "cckdigfilttype");
if (temp >= 0) if (temp >= 0)
pi_lcn->lcnphy_cck_dig_filt_type = temp; pi_lcn->lcnphy_cck_dig_filt_type = temp;
} }
......
...@@ -216,11 +216,11 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf, ...@@ -216,11 +216,11 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf,
brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel); brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel);
} }
char *wlapi_getvar(char *vars, const char *name) char *wlapi_getvar(struct phy_shim_info *physhim, const char *name)
{ {
return getvar(vars, name); return getvar(physhim->wlc_hw->sih, name);
} }
int wlapi_getintvar(char *vars, const char *name) int wlapi_getintvar(struct phy_shim_info *physhim, const char *name)
{ {
return getintvar(vars, name); return getintvar(physhim->wlc_hw->sih, name);
} }
...@@ -178,7 +178,7 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, ...@@ -178,7 +178,7 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint,
extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim,
u32 phy_mode); u32 phy_mode);
extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim);
extern char *wlapi_getvar(char *vars, const char *name); extern char *wlapi_getvar(struct phy_shim_info *physhim, const char *name);
extern int wlapi_getintvar(char *vars, const char *name); extern int wlapi_getintvar(struct phy_shim_info *physhim, const char *name);
#endif /* _BRCM_PHY_SHIM_H_ */ #endif /* _BRCM_PHY_SHIM_H_ */
...@@ -356,8 +356,8 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, ...@@ -356,8 +356,8 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
struct ieee80211_sta *sta, u16 tid); struct ieee80211_sta *sta, u16 tid);
extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
u8 ba_wsize, uint max_rx_ampdu_bytes); u8 ba_wsize, uint max_rx_ampdu_bytes);
extern char *getvar(char *vars, const char *name); extern char *getvar(struct si_pub *sih, const char *name);
extern int getintvar(char *vars, const char *name); extern int getintvar(struct si_pub *sih, const char *name);
/* wlc_phy.c helper functions */ /* wlc_phy.c helper functions */
extern void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc); extern void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc);
......
...@@ -1247,10 +1247,13 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, ...@@ -1247,10 +1247,13 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
* Search the name=value vars for a specific one and return its value. * Search the name=value vars for a specific one and return its value.
* Returns NULL if not found. * Returns NULL if not found.
*/ */
char *getvar(char *vars, const char *name) char *getvar(struct si_pub *sih, const char *name)
{ {
char *s; char *s;
int len; int len;
struct si_info *sii;
sii = (struct si_info *)sih;
if (!name) if (!name)
return NULL; return NULL;
...@@ -1260,7 +1263,7 @@ char *getvar(char *vars, const char *name) ...@@ -1260,7 +1263,7 @@ char *getvar(char *vars, const char *name)
return NULL; return NULL;
/* first look in vars[] */ /* first look in vars[] */
for (s = vars; s && *s;) { for (s = sii->vars; s && *s;) {
if ((memcmp(s, name, len) == 0) && (s[len] == '=')) if ((memcmp(s, name, len) == 0) && (s[len] == '='))
return &s[len + 1]; return &s[len + 1];
...@@ -1275,12 +1278,12 @@ char *getvar(char *vars, const char *name) ...@@ -1275,12 +1278,12 @@ char *getvar(char *vars, const char *name)
* Search the vars for a specific one and return its value as * Search the vars for a specific one and return its value as
* an integer. Returns 0 if not found. * an integer. Returns 0 if not found.
*/ */
int getintvar(char *vars, const char *name) int getintvar(struct si_pub *sih, const char *name)
{ {
char *val; char *val;
unsigned long res; unsigned long res;
val = getvar(vars, name); val = getvar(sih, name);
if (val && !kstrtoul(val, 0, &res)) if (val && !kstrtoul(val, 0, &res))
return res; return res;
......
...@@ -373,8 +373,8 @@ void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) ...@@ -373,8 +373,8 @@ void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc)
void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc) void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
{ {
/* get available rx/tx chains */ /* get available rx/tx chains */
wlc->stf->hw_txchain = (u8) getintvar(wlc->pub->vars, "txchain"); wlc->stf->hw_txchain = (u8) getintvar(wlc->hw->sih, "txchain");
wlc->stf->hw_rxchain = (u8) getintvar(wlc->pub->vars, "rxchain"); wlc->stf->hw_rxchain = (u8) getintvar(wlc->hw->sih, "rxchain");
/* these parameter are intended to be used for all PHY types */ /* these parameter are intended to be used for all PHY types */
if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment