From 9342f107a9655adf067ac603e4ba4161e4e85cab Mon Sep 17 00:00:00 2001 From: Cheong2K Date: Fri, 26 Feb 2016 18:20:10 +0800 Subject: [PATCH 093/806] brcm: adds support for BCM43341 wifi brcmfmac: Disable power management Disable wireless power saving in the brcmfmac WLAN driver. This is a temporary measure until the connectivity loss resulting from power saving is resolved. Signed-off-by: Phil Elwell brcmfmac: Use original country code as a fallback Commit 73345fd212980d2e28a5c6d83801c903bd773680: brcmfmac: Configure country code using device specific settings prevents region codes from working on devices that lack a region code translation table. In the event of an absent table, preserve the old behaviour of using the provided code as-is. Signed-off-by: Phil Elwell brcmfmac: Plug memory leak in brcmf_fill_bss_param See: https://github.com/raspberrypi/linux/issues/1471 Signed-off-by: Phil Elwell brcmfmac: do not use internal roaming engine by default Some evidence of curing disconnects with this disabled, so make it a default. Can be overridden with module parameter roamoff=0 See: http://projectable.me/optimize-my-pi-wi-fi/ brcmfmac: Change stop_ap sequence Patch from Broadcom/Cypress to resolve a customer error Signed-off-by: Phil Elwell --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 22 ++++++++++++++----- .../broadcom/brcm80211/brcmfmac/common.c | 2 +- .../broadcom/brcm80211/brcmfmac/sdio.c | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2697,6 +2697,8 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ + pr_info("power management disabled\n"); + enabled = false; cfg->pwr_save = enabled; if (!check_vif_up(ifp->vif)) { @@ -6786,12 +6788,18 @@ static s32 brcmf_translate_country_code( struct brcmfmac_pd_cc *country_codes; struct brcmfmac_pd_cc_entry *cc; s32 found_index; + char ccode[BRCMF_COUNTRY_BUF_SZ]; + int rev; int i; + memcpy(ccode, alpha2, sizeof(ccode)); + rev = -1; + country_codes = drvr->settings->country_codes; if (!country_codes) { - brcmf_dbg(TRACE, "No country codes configured for device\n"); - return -EINVAL; + brcmf_dbg(TRACE, "No country codes configured for device" + " - use requested value\n"); + goto use_input_value; } if ((alpha2[0] == ccreq->country_abbrev[0]) && @@ -6815,10 +6823,14 @@ static s32 brcmf_translate_country_code( brcmf_dbg(TRACE, "No country code match found\n"); return -EINVAL; } - memset(ccreq, 0, sizeof(*ccreq)); - ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); - memcpy(ccreq->ccode, country_codes->table[found_index].cc, + rev = country_codes->table[found_index].rev; + memcpy(ccode, country_codes->table[found_index].cc, BRCMF_COUNTRY_BUF_SZ); + +use_input_value: + memset(ccreq, 0, sizeof(*ccreq)); + ccreq->rev = cpu_to_le32(rev); + memcpy(ccreq->ccode, ccode, sizeof(ccode)); ccreq->country_abbrev[0] = alpha2[0]; ccreq->country_abbrev[1] = alpha2[1]; ccreq->country_abbrev[2] = 0; --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -70,7 +70,7 @@ static int brcmf_fcmode; module_param_named(fcmode, brcmf_fcmode, int, 0); MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control"); -static int brcmf_roamoff; +static int brcmf_roamoff = 1; module_param_named(roamoff, brcmf_roamoff, int, 0400); MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -614,6 +614,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio"); BRCMF_FW_DEF(4330, "brcmfmac4330-sdio"); BRCMF_FW_DEF(4334, "brcmfmac4334-sdio"); BRCMF_FW_DEF(43340, "brcmfmac43340-sdio"); +BRCMF_FW_DEF(43341, "brcmfmac43341-sdio"); BRCMF_FW_DEF(4335, "brcmfmac4335-sdio"); BRCMF_FW_DEF(43362, "brcmfmac43362-sdio"); BRCMF_FW_DEF(4339, "brcmfmac4339-sdio"); @@ -634,7 +635,7 @@ static const struct brcmf_firmware_mappi BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), - BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), + BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),