Commit fe19e50e authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman
Browse files

staging: brcm80211: use identifiers instead of string for srom lookup



The driver variables from srom are stored in memory with string
identifiers and the caller needed to use this string identifier
to retrieve a driver variable. The commit changes the calling
code replacing strings with enumerated identifiers.

Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
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 83773bce
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1021,7 +1021,7 @@ static __used void ai_nvram_process(struct si_info *sii)

	sii->pub.boardvendor = w & 0xffff;
	sii->pub.boardtype = (w >> 16) & 0xffff;
	sii->pub.boardflags = getintvar(&sii->pub, "boardflags");
	sii->pub.boardflags = getintvar(&sii->pub, BRCMS_SROM_BOARDFLAGS);
}

static struct si_info *ai_doattach(struct si_info *sii,
@@ -1117,7 +1117,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
	}

	/* setup the GPIO based LED powersave register */
	w = getintvar(sih, "leddc");
	w = getintvar(sih, BRCMS_SROM_LEDDC);
	if (w == 0)
		w = DEFAULT_GPIOTIMERVAL;
	ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval),
+7 −7
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
	asi->pub = wlc->pub;
	asi->antsel_type = ANTSEL_NA;
	asi->antsel_avail = false;
	asi->antsel_antswitch = (u8) getintvar(sih, "antswitch");
	asi->antsel_antswitch = (u8) getintvar(sih, BRCMS_SROM_ANTSWITCH);

	if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) {
		switch (asi->antsel_antswitch) {
@@ -128,12 +128,12 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
			/* 4321/2 board with 2x3 switch logic */
			asi->antsel_type = ANTSEL_2x3;
			/* Antenna selection availability */
			if (((u16) getintvar(sih, "aa2g") == 7) ||
			    ((u16) getintvar(sih, "aa5g") == 7)) {
			if (((u16) getintvar(sih, BRCMS_SROM_AA2G) == 7) ||
			    ((u16) getintvar(sih, BRCMS_SROM_AA5G) == 7)) {
				asi->antsel_avail = true;
			} else if (
				(u16) getintvar(sih, "aa2g") == 3 ||
				(u16) getintvar(sih, "aa5g") == 3) {
				(u16) getintvar(sih, BRCMS_SROM_AA2G) == 3 ||
				(u16) getintvar(sih, BRCMS_SROM_AA5G) == 3) {
				asi->antsel_avail = false;
			} else {
				asi->antsel_avail = false;
@@ -146,8 +146,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
			break;
		}
	} else if ((asi->pub->sromrev == 4) &&
		   ((u16) getintvar(sih, "aa2g") == 7) &&
		   ((u16) getintvar(sih, "aa5g") == 0)) {
		   ((u16) getintvar(sih, BRCMS_SROM_AA2G) == 7) &&
		   ((u16) getintvar(sih, BRCMS_SROM_AA5G) == 0)) {
		/* hack to match old 4321CB2 cards with 2of3 antenna switch */
		asi->antsel_type = ANTSEL_2x3;
		asi->antsel_avail = true;
+1 −1
Original line number Diff line number Diff line
@@ -1088,7 +1088,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
	wlc->cmi = wlc_cm;

	/* store the country code for passing up as a regulatory hint */
	ccode = getvar(wlc->hw->sih, "ccode");
	ccode = getvar(wlc->hw->sih, BRCMS_SROM_CCODE);
	if (ccode)
		strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);

+22 −13
Original line number Diff line number Diff line
@@ -1986,23 +1986,23 @@ static bool brcms_c_validboardtype(struct brcms_hardware *wlc_hw)

static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw)
{
	const char *varname = "macaddr";
	enum brcms_srom_id var_id = BRCMS_SROM_MACADDR;
	char *macaddr;

	/* If macaddr exists, use it (Sromrev4, CIS, ...). */
	macaddr = getvar(wlc_hw->sih, varname);
	macaddr = getvar(wlc_hw->sih, var_id);
	if (macaddr != NULL)
		return macaddr;

	if (wlc_hw->_nbands > 1)
		varname = "et1macaddr";
		var_id = BRCMS_SROM_ET1MACADDR;
	else
		varname = "il0macaddr";
		var_id = BRCMS_SROM_IL0MACADDR;

	macaddr = getvar(wlc_hw->sih, varname);
	macaddr = getvar(wlc_hw->sih, var_id);
	if (macaddr == NULL)
		wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr "
			  "getvar(%s) not found\n", wlc_hw->unit, varname);
			  "getvar(%d) not found\n", wlc_hw->unit, var_id);

	return macaddr;
}
@@ -4633,7 +4633,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
	}

	/* get the board rev, used just below */
	j = getintvar(wlc_hw->sih, "boardrev");
	j = getintvar(wlc_hw->sih, BRCMS_SROM_BOARDREV);
	/* promote srom boardrev of 0xFF to 1 */
	if (j == BOARDREV_PROMOTABLE)
		j = BOARDREV_PROMOTED;
@@ -4645,9 +4645,11 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
		err = 15;
		goto fail;
	}
	wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, "sromrev");
	wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih, "boardflags");
	wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih, "boardflags2");
	wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, BRCMS_SROM_REV);
	wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih,
					     BRCMS_SROM_BOARDFLAGS);
	wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih,
					      BRCMS_SROM_BOARDFLAGS2);

	if (wlc_hw->boardflags & BFL_NOPLLDOWN)
		brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED);
@@ -4904,7 +4906,11 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
	bandtype = wlc->band->bandtype;

	/* get antennas available */
	aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g");
	if (bandtype == BRCM_BAND_5G)
		aa = (s8) getintvar(sih, BRCMS_SROM_AA5G);
	else
		aa = (s8) getintvar(sih, BRCMS_SROM_AA2G);

	if ((aa < 1) || (aa > 15)) {
		wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in"
			  " srom (0x%x), using 3\n", unit, __func__, aa);
@@ -4922,8 +4928,11 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
	}

	/* Compute Antenna Gain */
	wlc->band->antgain = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ?
					    "ag1" : "ag0");
	if (bandtype == BRCM_BAND_5G)
		wlc->band->antgain = (s8) getintvar(sih, BRCMS_SROM_AG1);
	else
		wlc->band->antgain = (s8) getintvar(sih, BRCMS_SROM_AG0);

	brcms_c_attach_antgain_init(wlc);

	return true;
+2 −1
Original line number Diff line number Diff line
@@ -722,10 +722,11 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)
void pcicore_attach(struct pcicore_info *pi, int state)
{
	struct si_pub *sih = pi->sih;
	u32 bfl2 = (u32)getintvar(sih, BRCMS_SROM_BOARDFLAGS2);

	/* Determine if this board needs override */
	if (PCIE_ASPM(sih)) {
		if ((u32)getintvar(sih, "boardflags2") & BFL2_PCIEWAR_OVR)
		if (bfl2 & BFL2_PCIEWAR_OVR)
			pi->pcie_war_aspm_ovr = PCIE_ASPM_DISAB;
		else
			pi->pcie_war_aspm_ovr = PCIE_ASPM_ENAB;
Loading