From 50498fcd76b20add8f641f15bbcfc6ef0934d096 Mon Sep 17 00:00:00 2001 From: hauke Date: Fri, 1 Jun 2012 21:17:04 +0000 Subject: mac80211: brcmsmac: add some patches starting to add support for some more chips git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32020 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...d-device-found-on-some-SoCs-like-the-bcm4.patch | 39 ---- .../patches/840-brcmsmac-remove-PCIE.patch | 31 ++++ .../841-brcmsmac-add-support-for-BCM43224.patch | 29 --- .../patches/841-brcmsmac-remove-PCI_FORCEHT.patch | 54 ++++++ ...add-some-conditions-for-the-bcm4716-again.patch | 202 --------------------- ...move-ai_get_buscoretype-and-ai_get_buscor.patch | 48 +++++ ...brcmsmac-use-container_of-instead-of-cast.patch | 74 ++++++++ .../patches/844-brcmsmac-remove-ai_findcore.patch | 145 +++++++++++++++ ...-brcmsmac-use-core-id-constants-from-bcma.patch | 86 +++++++++ ...move-some-unnessessacry-casts-and-void-po.patch | 36 ++++ ...dd-suome-conditions-for-the-bcm4716-again.patch | 202 +++++++++++++++++++++ ...c-some-more-fixes-for-different-core-revs.patch | 73 ++++++++ ...d-device-found-on-some-SoCs-like-the-bcm4.patch | 39 ++++ .../850-brcmsmac-add-support-for-BCM43224.patch | 29 +++ ...smac-start-adding-support-for-core-rev-28.patch | 66 +++++++ 15 files changed, 883 insertions(+), 270 deletions(-) delete mode 100644 package/mac80211/patches/840-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch create mode 100644 package/mac80211/patches/840-brcmsmac-remove-PCIE.patch delete mode 100644 package/mac80211/patches/841-brcmsmac-add-support-for-BCM43224.patch create mode 100644 package/mac80211/patches/841-brcmsmac-remove-PCI_FORCEHT.patch delete mode 100644 package/mac80211/patches/842-brcmsmac-add-some-conditions-for-the-bcm4716-again.patch create mode 100644 package/mac80211/patches/842-brcmsmac-remove-ai_get_buscoretype-and-ai_get_buscor.patch create mode 100644 package/mac80211/patches/843-brcmsmac-use-container_of-instead-of-cast.patch create mode 100644 package/mac80211/patches/844-brcmsmac-remove-ai_findcore.patch create mode 100644 package/mac80211/patches/845-brcmsmac-use-core-id-constants-from-bcma.patch create mode 100644 package/mac80211/patches/846-brcmsmac-remove-some-unnessessacry-casts-and-void-po.patch create mode 100644 package/mac80211/patches/847-brcmsmac-add-suome-conditions-for-the-bcm4716-again.patch create mode 100644 package/mac80211/patches/848-brcmsmac-some-more-fixes-for-different-core-revs.patch create mode 100644 package/mac80211/patches/849-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch create mode 100644 package/mac80211/patches/850-brcmsmac-add-support-for-BCM43224.patch create mode 100644 package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch diff --git a/package/mac80211/patches/840-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch b/package/mac80211/patches/840-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch deleted file mode 100644 index df48e1e79..000000000 --- a/package/mac80211/patches/840-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c -@@ -94,6 +94,7 @@ MODULE_LICENSE("Dual BSD/GPL"); - static struct bcma_device_id brcms_coreid_table[] = { - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS), - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS), -+// BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS), - BCMA_CORETABLE_END - }; - MODULE_DEVICE_TABLE(bcma, brcms_coreid_table); ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c -@@ -719,7 +719,7 @@ static void brcms_c_ucode_bsinit(struct - brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); - - /* do band-specific ucode IHR, SHM, and SCR inits */ -- if (D11REV_IS(wlc_hw->corerev, 23)) { -+ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { - if (BRCMS_ISNPHY(wlc_hw->band)) - brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); - else -@@ -2242,7 +2242,7 @@ static void brcms_ucode_download(struct - if (wlc_hw->ucode_loaded) - return; - -- if (D11REV_IS(wlc_hw->corerev, 23)) { -+ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { - if (BRCMS_ISNPHY(wlc_hw->band)) { - brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, - ucode->bcm43xx_16_mimosz); -@@ -3218,7 +3218,7 @@ static void brcms_b_coreinit(struct brcm - - sflags = bcma_aread32(core, BCMA_IOST); - -- if (D11REV_IS(wlc_hw->corerev, 23)) { -+ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { - if (BRCMS_ISNPHY(wlc_hw->band)) - brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); - else diff --git a/package/mac80211/patches/840-brcmsmac-remove-PCIE.patch b/package/mac80211/patches/840-brcmsmac-remove-PCIE.patch new file mode 100644 index 000000000..de8b46c94 --- /dev/null +++ b/package/mac80211/patches/840-brcmsmac-remove-PCIE.patch @@ -0,0 +1,31 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +@@ -320,9 +320,7 @@ + #define IS_SIM(chippkg) \ + ((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID)) + +-#define PCIE(sih) (ai_get_buscoretype(sih) == PCIE_CORE_ID) +- +-#define PCI_FORCEHT(sih) (PCIE(sih) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) ++#define PCI_FORCEHT(sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) + + #ifdef DEBUG + #define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) +@@ -777,7 +775,7 @@ void ai_pci_up(struct si_pub *sih) + bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST); + } + +- if (PCIE(sih)) ++ if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); + } + +@@ -795,7 +793,7 @@ void ai_pci_down(struct si_pub *sih) + bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC); + } + +- if (PCIE(sih)) ++ if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); + } + diff --git a/package/mac80211/patches/841-brcmsmac-add-support-for-BCM43224.patch b/package/mac80211/patches/841-brcmsmac-add-support-for-BCM43224.patch deleted file mode 100644 index 56fd1ebf9..000000000 --- a/package/mac80211/patches/841-brcmsmac-add-support-for-BCM43224.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c -@@ -4132,6 +4132,7 @@ void brcms_c_wme_setparams(struct brcms_ - M_EDCF_QINFO + - wme_ac2fifo[aci] * M_EDCF_QLEN + i, - *shm_entry++); -+ printk("dummy\n"); - } - - if (suspend) { -@@ -4537,7 +4538,8 @@ static int brcms_b_attach(struct brcms_c - - /* check device id(srom, nvram etc.) to set bands */ - if (wlc_hw->deviceid == BCM43224_D11N_ID || -- wlc_hw->deviceid == BCM43224_D11N_ID_VEN1) -+ wlc_hw->deviceid == BCM43224_D11N_ID_VEN1|| -+ wlc_hw->deviceid == BCM43224_CHIP_ID) - /* Dualband boards */ - wlc_hw->_nbands = 2; - else -@@ -5791,7 +5793,7 @@ bool brcms_c_chipmatch(u16 vendor, u16 d - return false; - } - -- if (device == BCM43224_D11N_ID_VEN1) -+ if (device == BCM43224_D11N_ID_VEN1 || device == BCM43224_CHIP_ID) - return true; - if ((device == BCM43224_D11N_ID) || (device == BCM43225_D11N2G_ID)) - return true; diff --git a/package/mac80211/patches/841-brcmsmac-remove-PCI_FORCEHT.patch b/package/mac80211/patches/841-brcmsmac-remove-PCI_FORCEHT.patch new file mode 100644 index 000000000..04d74d73f --- /dev/null +++ b/package/mac80211/patches/841-brcmsmac-remove-PCI_FORCEHT.patch @@ -0,0 +1,54 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +@@ -320,8 +320,6 @@ + #define IS_SIM(chippkg) \ + ((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID)) + +-#define PCI_FORCEHT(sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) +- + #ifdef DEBUG + #define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) + #else +@@ -755,9 +753,6 @@ bool ai_clkctl_cc(struct si_pub *sih, en + + sii = (struct si_info *)sih; + +- if (PCI_FORCEHT(sih)) +- return mode == BCMA_CLKMODE_FAST; +- + cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); + bcma_core_set_clockmode(cc, mode); + return mode == BCMA_CLKMODE_FAST; +@@ -766,15 +761,9 @@ bool ai_clkctl_cc(struct si_pub *sih, en + void ai_pci_up(struct si_pub *sih) + { + struct si_info *sii; +- struct bcma_device *cc; + + sii = (struct si_info *)sih; + +- if (PCI_FORCEHT(sih)) { +- cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); +- bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST); +- } +- + if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); + } +@@ -783,16 +772,9 @@ void ai_pci_up(struct si_pub *sih) + void ai_pci_down(struct si_pub *sih) + { + struct si_info *sii; +- struct bcma_device *cc; + + sii = (struct si_info *)sih; + +- /* release FORCEHT since chip is going to "down" state */ +- if (PCI_FORCEHT(sih)) { +- cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); +- bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC); +- } +- + if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); + } diff --git a/package/mac80211/patches/842-brcmsmac-add-some-conditions-for-the-bcm4716-again.patch b/package/mac80211/patches/842-brcmsmac-add-some-conditions-for-the-bcm4716-again.patch deleted file mode 100644 index 40ccde90b..000000000 --- a/package/mac80211/patches/842-brcmsmac-add-some-conditions-for-the-bcm4716-again.patch +++ /dev/null @@ -1,202 +0,0 @@ ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c -@@ -1943,7 +1943,8 @@ static bool brcms_b_radio_read_hwdisable - * accesses phyreg throughput mac. This can be skipped since - * only mac reg is accessed below - */ -- flags |= SICF_PCLKE; -+ if (D11REV_GE(wlc_hw->corerev, 18)) -+ flags |= SICF_PCLKE; - - /* - * TODO: test suspend/resume -@@ -2024,7 +2025,8 @@ void brcms_b_corereset(struct brcms_hard - * phyreg throughput mac, AND phy_reset is skipped at early stage when - * band->pi is invalid. need to enable PHY CLK - */ -- flags |= SICF_PCLKE; -+ if (D11REV_GE(wlc_hw->corerev, 18)) -+ flags |= SICF_PCLKE; - - /* - * reset the core ---- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c -@@ -17895,6 +17895,9 @@ static u32 *wlc_phy_get_ipa_gaintbl_nphy - nphy_tpc_txgain_ipa_2g_2057rev7; - } else if (NREV_IS(pi->pubpi.phy_rev, 6)) { - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev6; -+ if (pi->sh->chip == BCM47162_CHIP_ID) { -+ tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5; -+ } - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5; - } else { -@@ -19256,8 +19259,14 @@ static void wlc_phy_spurwar_nphy(struct - case 38: - case 102: - case 118: -- nphy_adj_tone_id_buf[0] = 0; -- nphy_adj_noise_var_buf[0] = 0x0; -+ if ((pi->sh->chip == BCM4716_CHIP_ID) && -+ (pi->sh->chippkg == BCM4717_PKG_ID)) { -+ nphy_adj_tone_id_buf[0] = 32; -+ nphy_adj_noise_var_buf[0] = 0x21f; -+ } else { -+ nphy_adj_tone_id_buf[0] = 0; -+ nphy_adj_noise_var_buf[0] = 0x0; -+ } - break; - case 134: - nphy_adj_tone_id_buf[0] = 32; -@@ -20697,12 +20706,22 @@ wlc_phy_chanspec_radio2056_setup(struct - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | - RADIO_2056_SYN, 0x1f); - -- write_radio_reg(pi, -- RADIO_2056_SYN_PLL_LOOPFILTER4 | -- RADIO_2056_SYN, 0xb); -- write_radio_reg(pi, -- RADIO_2056_SYN_PLL_CP2 | -- RADIO_2056_SYN, 0x14); -+ if ((pi->sh->chip == BCM4716_CHIP_ID) || -+ (pi->sh->chip == BCM47162_CHIP_ID)) { -+ write_radio_reg(pi, -+ RADIO_2056_SYN_PLL_LOOPFILTER4 | -+ RADIO_2056_SYN, 0x14); -+ write_radio_reg(pi, -+ RADIO_2056_SYN_PLL_CP2 | -+ RADIO_2056_SYN, 0x00); -+ } else { -+ write_radio_reg(pi, -+ RADIO_2056_SYN_PLL_LOOPFILTER4 | -+ RADIO_2056_SYN, 0xb); -+ write_radio_reg(pi, -+ RADIO_2056_SYN_PLL_CP2 | -+ RADIO_2056_SYN, 0x14); -+ } - } - } - -@@ -20749,24 +20768,33 @@ wlc_phy_chanspec_radio2056_setup(struct - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PADG_IDAC, 0xcc); - -- bias = 0x25; -- cascbias = 0x20; -+ if ((pi->sh->chip == BCM4716_CHIP_ID) || -+ (pi->sh->chip == -+ BCM47162_CHIP_ID)) { -+ bias = 0x40; -+ cascbias = 0x45; -+ pag_boost_tune = 0x5; -+ pgag_boost_tune = 0x33; -+ padg_boost_tune = 0x77; -+ mixg_boost_tune = 0x55; -+ } else { -+ bias = 0x25; -+ cascbias = 0x20; - -- if ((pi->sh->chip == -- BCM43224_CHIP_ID) -- || (pi->sh->chip == -- BCM43225_CHIP_ID)) { -- if (pi->sh->chippkg == -- BCM43224_FAB_SMIC) { -- bias = 0x2a; -- cascbias = 0x38; -+ if ((pi->sh->chip == BCM43224_CHIP_ID) -+ || (pi->sh->chip == BCM43225_CHIP_ID)) { -+ if (pi->sh->chippkg == -+ BCM43224_FAB_SMIC) { -+ bias = 0x2a; -+ cascbias = 0x38; -+ } - } -- } - -- pag_boost_tune = 0x4; -- pgag_boost_tune = 0x03; -- padg_boost_tune = 0x77; -- mixg_boost_tune = 0x65; -+ pag_boost_tune = 0x4; -+ pgag_boost_tune = 0x03; -+ padg_boost_tune = 0x77; -+ mixg_boost_tune = 0x65; -+ } - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_IMAIN_STAT, bias); -@@ -21180,19 +21208,27 @@ wlc_phy_chanspec_nphy_setup(struct brcms - } else if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (val == 54) - spuravoid = 1; -- } else { -- if (pi->nphy_aband_spurwar_en && -- ((val == 38) || (val == 102) -- || (val == 118))) -+ } else if (pi->nphy_aband_spurwar_en && -+ ((val == 38) || (val == 102) || (val == 118))) { -+ if ((pi->sh->chip == BCM4716_CHIP_ID) -+ && (pi->sh->chippkg == BCM4717_PKG_ID)) { -+ spuravoid = 0; -+ } else { - spuravoid = 1; -+ } - } - - if (pi->phy_spuravoid == SPURAVOID_FORCEON) - spuravoid = 1; - -- wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); -- si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid); -- wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); -+ if ((pi->sh->chip == BCM4716_CHIP_ID) || -+ (pi->sh->chip == BCM47162_CHIP_ID)) { -+ si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid); -+ } else { -+ wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); -+ si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid); -+ wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); -+ } - - if ((pi->sh->chip == BCM43224_CHIP_ID) || - (pi->sh->chip == BCM43225_CHIP_ID)) { -@@ -21211,7 +21247,10 @@ wlc_phy_chanspec_nphy_setup(struct brcms - } - } - -- wlapi_bmac_core_phypll_reset(pi->sh->physhim); -+ if (!((pi->sh->chip == BCM4716_CHIP_ID) || -+ (pi->sh->chip == BCM47162_CHIP_ID))) { -+ wlapi_bmac_core_phypll_reset(pi->sh->physhim); -+ } - - mod_phy_reg(pi, 0x01, (0x1 << 15), - ((spuravoid > 0) ? (0x1 << 15) : 0)); -@@ -24925,14 +24964,20 @@ wlc_phy_a2_nphy(struct brcms_phy *pi, st - if (txgains->useindex) { - phy_a4 = 15 - ((txgains->index) >> 3); - if (CHSPEC_IS2G(pi->radio_chanspec)) { -- if (NREV_GE(pi->pubpi.phy_rev, 6)) -+ if (NREV_GE(pi->pubpi.phy_rev, 6)) { - phy_a5 = 0x00f7 | (phy_a4 << 8); -- -- else -- if (NREV_IS(pi->pubpi.phy_rev, 5)) -+ if (pi->sh->chip == -+ BCM47162_CHIP_ID) { -+ phy_a5 = -+ 0x10f7 | (phy_a4 << -+ 8); -+ } -+ } else -+ if (NREV_IS(pi->pubpi.phy_rev, 5)) { - phy_a5 = 0x10f7 | (phy_a4 << 8); -- else -+ } else { - phy_a5 = 0x50f7 | (phy_a4 << 8); -+ } - } else { - phy_a5 = 0x70f7 | (phy_a4 << 8); - } diff --git a/package/mac80211/patches/842-brcmsmac-remove-ai_get_buscoretype-and-ai_get_buscor.patch b/package/mac80211/patches/842-brcmsmac-remove-ai_get_buscoretype-and-ai_get_buscor.patch new file mode 100644 index 000000000..80c6fc966 --- /dev/null +++ b/package/mac80211/patches/842-brcmsmac-remove-ai_get_buscoretype-and-ai_get_buscor.patch @@ -0,0 +1,48 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +@@ -471,9 +471,6 @@ ai_buscore_setup(struct si_info *sii, st + sii->pub.pmurev = sii->pub.pmucaps & PCAP_REV_MASK; + } + +- /* figure out buscore */ +- sii->buscore = ai_findcore(&sii->pub, PCIE_CORE_ID, 0); +- + return true; + } + +@@ -807,15 +804,3 @@ bool ai_deviceremoved(struct si_pub *sih + + return false; + } +- +-uint ai_get_buscoretype(struct si_pub *sih) +-{ +- struct si_info *sii = (struct si_info *)sih; +- return sii->buscore->id.id; +-} +- +-uint ai_get_buscorerev(struct si_pub *sih) +-{ +- struct si_info *sii = (struct si_info *)sih; +- return sii->buscore->id.rev; +-} +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +@@ -168,7 +168,6 @@ struct si_info { + struct si_pub pub; /* back plane public state (must be first) */ + struct bcma_bus *icbus; /* handle to soc interconnect bus */ + struct pci_dev *pcibus; /* handle to pci bus */ +- struct bcma_device *buscore; + + u32 chipst; /* chip status */ + }; +@@ -202,9 +201,6 @@ extern void ai_pci_up(struct si_pub *sih + /* Enable Ex-PA for 4313 */ + extern void ai_epa_4313war(struct si_pub *sih); + +-extern uint ai_get_buscoretype(struct si_pub *sih); +-extern uint ai_get_buscorerev(struct si_pub *sih); +- + static inline u32 ai_get_cccaps(struct si_pub *sih) + { + return sih->cccaps; diff --git a/package/mac80211/patches/843-brcmsmac-use-container_of-instead-of-cast.patch b/package/mac80211/patches/843-brcmsmac-use-container_of-instead-of-cast.patch new file mode 100644 index 000000000..ba12eda12 --- /dev/null +++ b/package/mac80211/patches/843-brcmsmac-use-container_of-instead-of-cast.patch @@ -0,0 +1,74 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +@@ -584,7 +584,7 @@ void ai_detach(struct si_pub *sih) + struct si_pub *si_local = NULL; + memcpy(&si_local, &sih, sizeof(struct si_pub **)); + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + + if (sii == NULL) + return; +@@ -599,7 +599,7 @@ struct bcma_device *ai_findcore(struct s + struct si_info *sii; + uint found; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + + found = 0; + +@@ -622,7 +622,7 @@ uint ai_cc_reg(struct si_pub *sih, uint + u32 w; + struct si_info *sii; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + cc = sii->icbus->drv_cc.core; + + /* mask and set */ +@@ -716,7 +716,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si + uint slowminfreq; + u16 fpdelay; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + if (ai_get_cccaps(sih) & CC_CAP_PMU) { + fpdelay = si_pmu_fast_pwrup_delay(sih); + return fpdelay; +@@ -748,7 +748,7 @@ bool ai_clkctl_cc(struct si_pub *sih, en + struct si_info *sii; + struct bcma_device *cc; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + + cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); + bcma_core_set_clockmode(cc, mode); +@@ -759,7 +759,7 @@ void ai_pci_up(struct si_pub *sih) + { + struct si_info *sii; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + + if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); +@@ -770,7 +770,7 @@ void ai_pci_down(struct si_pub *sih) + { + struct si_info *sii; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + + if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); +@@ -793,7 +793,7 @@ bool ai_deviceremoved(struct si_pub *sih + u32 w; + struct si_info *sii; + +- sii = (struct si_info *)sih; ++ sii = container_of(sih, struct si_info, pub); + + if (sii->icbus->hosttype != BCMA_HOSTTYPE_PCI) + return false; diff --git a/package/mac80211/patches/844-brcmsmac-remove-ai_findcore.patch b/package/mac80211/patches/844-brcmsmac-remove-ai_findcore.patch new file mode 100644 index 000000000..3fc914f90 --- /dev/null +++ b/package/mac80211/patches/844-brcmsmac-remove-ai_findcore.patch @@ -0,0 +1,145 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +@@ -592,27 +592,6 @@ void ai_detach(struct si_pub *sih) + kfree(sii); + } + +-/* return index of coreid or BADIDX if not found */ +-struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit) +-{ +- struct bcma_device *core; +- struct si_info *sii; +- uint found; +- +- sii = container_of(sih, struct si_info, pub); +- +- found = 0; +- +- list_for_each_entry(core, &sii->icbus->cores, list) +- if (core->id.id == coreid) { +- if (found == coreunit) +- return core; +- found++; +- } +- +- return NULL; +-} +- + /* + * read/modify chipcommon core register. + */ +@@ -689,12 +668,13 @@ ai_clkctl_setdelay(struct si_pub *sih, s + /* initialize power control delay registers */ + void ai_clkctl_init(struct si_pub *sih) + { ++ struct si_info *sii = container_of(sih, struct si_info, pub); + struct bcma_device *cc; + + if (!(ai_get_cccaps(sih) & CC_CAP_PWR_CTL)) + return; + +- cc = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); ++ cc = sii->icbus->drv_cc.core;; + if (cc == NULL) + return; + +@@ -726,7 +706,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si + return 0; + + fpdelay = 0; +- cc = ai_findcore(sih, CC_CORE_ID, 0); ++ cc = sii->icbus->drv_cc.core;; + if (cc) { + slowminfreq = ai_slowclk_freq(sih, false, cc); + fpdelay = (((bcma_read32(cc, CHIPCREGOFFS(pll_on_delay)) + 2) +@@ -750,7 +730,7 @@ bool ai_clkctl_cc(struct si_pub *sih, en + + sii = container_of(sih, struct si_info, pub); + +- cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); ++ cc = sii->icbus->drv_cc.core;; + bcma_core_set_clockmode(cc, mode); + return mode == BCMA_CLKMODE_FAST; + } +@@ -779,9 +759,10 @@ void ai_pci_down(struct si_pub *sih) + /* Enable BT-COEX & Ex-PA for 4313 */ + void ai_epa_4313war(struct si_pub *sih) + { ++ struct si_info *sii =container_of(sih, struct si_info, pub); + struct bcma_device *cc; + +- cc = ai_findcore(sih, CC_CORE_ID, 0); ++ cc = sii->icbus->drv_cc.core; + + /* EPA Fix */ + bcma_set32(cc, CHIPCREGOFFS(gpiocontrol), GPIO_CTRL_EPA_EN_MASK); +--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h ++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +@@ -182,8 +182,6 @@ struct si_info { + + + /* AMBA Interconnect exported externs */ +-extern struct bcma_device *ai_findcore(struct si_pub *sih, +- u16 coreid, u16 coreunit); + extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val); + + /* === exported functions === */ +--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c +@@ -142,10 +142,11 @@ static void si_pmu_res_masks(struct si_p + void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid) + { + u32 tmp = 0; ++ struct si_info *sii = container_of(sih, struct si_info, pub); + struct bcma_device *core; + + /* switch to chipc */ +- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); ++ core = sii->icbus->drv_cc.core; + + switch (ai_get_chip_id(sih)) { + case BCM43224_CHIP_ID: +@@ -286,10 +287,11 @@ u32 si_pmu_alp_clock(struct si_pub *sih) + /* initialize PMU */ + void si_pmu_init(struct si_pub *sih) + { ++ struct si_info *sii = container_of(sih, struct si_info, pub); + struct bcma_device *core; + + /* select chipc */ +- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); ++ core = sii->icbus->drv_cc.core; + + if (ai_get_pmurev(sih) == 1) + bcma_mask32(core, CHIPCREGOFFS(pmucontrol), +@@ -301,11 +303,12 @@ void si_pmu_init(struct si_pub *sih) + /* initialize PMU resources */ + void si_pmu_res_init(struct si_pub *sih) + { ++ struct si_info *sii = container_of(sih, struct si_info, pub); + struct bcma_device *core; + u32 min_mask = 0, max_mask = 0; + + /* select to chipc */ +- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); ++ core = sii->icbus->drv_cc.core; + + /* Determine min/max rsrc masks */ + si_pmu_res_masks(sih, &min_mask, &max_mask); +@@ -328,6 +331,7 @@ void si_pmu_res_init(struct si_pub *sih) + + u32 si_pmu_measure_alpclk(struct si_pub *sih) + { ++ struct si_info *sii = container_of(sih, struct si_info, pub); + struct bcma_device *core; + u32 alp_khz; + +@@ -335,7 +339,7 @@ u32 si_pmu_measure_alpclk(struct si_pub + return 0; + + /* Remember original core before switch to chipc */ +- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); ++ core = sii->icbus->drv_cc.core; + + if (bcma_read32(core, CHIPCREGOFFS(pmustatus)) & PST_EXTLPOAVAIL) { + u32 ilp_ctr, alp_hz; diff --git a/package/mac80211/patches/845-brcmsmac-use-core-id-constants-from-bcma.patch b/package/mac80211/patches/845-brcmsmac-use-core-id-constants-from-bcma.patch new file mode 100644 index 000000000..167f373ab --- /dev/null +++ b/package/mac80211/patches/845-brcmsmac-use-core-id-constants-from-bcma.patch @@ -0,0 +1,86 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c +@@ -640,10 +640,10 @@ struct dma_pub *dma_attach(char *name, s + di->dataoffsetlow = di->ddoffsetlow; + di->dataoffsethigh = di->ddoffsethigh; + /* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */ +- if ((core->id.id == SDIOD_CORE_ID) ++ if ((core->id.id == BCMA_CORE_SDIO_DEV) + && ((rev > 0) && (rev <= 2))) + di->addrext = false; +- else if ((core->id.id == I2S_CORE_ID) && ++ else if ((core->id.id == BCMA_CORE_I2S) && + ((rev == 0) || (rev == 1))) + di->addrext = false; + else +--- a/drivers/net/wireless/brcm80211/include/soc.h ++++ b/drivers/net/wireless/brcm80211/include/soc.h +@@ -19,68 +19,6 @@ + + #define SI_ENUM_BASE 0x18000000 /* Enumeration space base */ + +-/* core codes */ +-#define NODEV_CORE_ID 0x700 /* Invalid coreid */ +-#define CC_CORE_ID 0x800 /* chipcommon core */ +-#define ILINE20_CORE_ID 0x801 /* iline20 core */ +-#define SRAM_CORE_ID 0x802 /* sram core */ +-#define SDRAM_CORE_ID 0x803 /* sdram core */ +-#define PCI_CORE_ID 0x804 /* pci core */ +-#define MIPS_CORE_ID 0x805 /* mips core */ +-#define ENET_CORE_ID 0x806 /* enet mac core */ +-#define CODEC_CORE_ID 0x807 /* v90 codec core */ +-#define USB_CORE_ID 0x808 /* usb 1.1 host/device core */ +-#define ADSL_CORE_ID 0x809 /* ADSL core */ +-#define ILINE100_CORE_ID 0x80a /* iline100 core */ +-#define IPSEC_CORE_ID 0x80b /* ipsec core */ +-#define UTOPIA_CORE_ID 0x80c /* utopia core */ +-#define PCMCIA_CORE_ID 0x80d /* pcmcia core */ +-#define SOCRAM_CORE_ID 0x80e /* internal memory core */ +-#define MEMC_CORE_ID 0x80f /* memc sdram core */ +-#define OFDM_CORE_ID 0x810 /* OFDM phy core */ +-#define EXTIF_CORE_ID 0x811 /* external interface core */ +-#define D11_CORE_ID 0x812 /* 802.11 MAC core */ +-#define APHY_CORE_ID 0x813 /* 802.11a phy core */ +-#define BPHY_CORE_ID 0x814 /* 802.11b phy core */ +-#define GPHY_CORE_ID 0x815 /* 802.11g phy core */ +-#define MIPS33_CORE_ID 0x816 /* mips3302 core */ +-#define USB11H_CORE_ID 0x817 /* usb 1.1 host core */ +-#define USB11D_CORE_ID 0x818 /* usb 1.1 device core */ +-#define USB20H_CORE_ID 0x819 /* usb 2.0 host core */ +-#define USB20D_CORE_ID 0x81a /* usb 2.0 device core */ +-#define SDIOH_CORE_ID 0x81b /* sdio host core */ +-#define ROBO_CORE_ID 0x81c /* roboswitch core */ +-#define ATA100_CORE_ID 0x81d /* parallel ATA core */ +-#define SATAXOR_CORE_ID 0x81e /* serial ATA & XOR DMA core */ +-#define GIGETH_CORE_ID 0x81f /* gigabit ethernet core */ +-#define PCIE_CORE_ID 0x820 /* pci express core */ +-#define NPHY_CORE_ID 0x821 /* 802.11n 2x2 phy core */ +-#define SRAMC_CORE_ID 0x822 /* SRAM controller core */ +-#define MINIMAC_CORE_ID 0x823 /* MINI MAC/phy core */ +-#define ARM11_CORE_ID 0x824 /* ARM 1176 core */ +-#define ARM7S_CORE_ID 0x825 /* ARM7tdmi-s core */ +-#define LPPHY_CORE_ID 0x826 /* 802.11a/b/g phy core */ +-#define PMU_CORE_ID 0x827 /* PMU core */ +-#define SSNPHY_CORE_ID 0x828 /* 802.11n single-stream phy core */ +-#define SDIOD_CORE_ID 0x829 /* SDIO device core */ +-#define ARMCM3_CORE_ID 0x82a /* ARM Cortex M3 core */ +-#define HTPHY_CORE_ID 0x82b /* 802.11n 4x4 phy core */ +-#define MIPS74K_CORE_ID 0x82c /* mips 74k core */ +-#define GMAC_CORE_ID 0x82d /* Gigabit MAC core */ +-#define DMEMC_CORE_ID 0x82e /* DDR1/2 memory controller core */ +-#define PCIERC_CORE_ID 0x82f /* PCIE Root Complex core */ +-#define OCP_CORE_ID 0x830 /* OCP2OCP bridge core */ +-#define SC_CORE_ID 0x831 /* shared common core */ +-#define AHB_CORE_ID 0x832 /* OCP2AHB bridge core */ +-#define SPIH_CORE_ID 0x833 /* SPI host core */ +-#define I2S_CORE_ID 0x834 /* I2S core */ +-#define DMEMS_CORE_ID 0x835 /* SDR/DDR1 memory controller core */ +-#define DEF_SHIM_COMP 0x837 /* SHIM component in ubus/6362 */ +-#define OOB_ROUTER_CORE_ID 0x367 /* OOB router core ID */ +-#define DEF_AI_COMP 0xfff /* Default component, in ai chips it +- * maps all unused address ranges +- */ +- + /* Common core control flags */ + #define SICF_BIST_EN 0x8000 + #define SICF_PME_EN 0x4000 diff --git a/package/mac80211/patches/846-brcmsmac-remove-some-unnessessacry-casts-and-void-po.patch b/package/mac80211/patches/846-brcmsmac-remove-some-unnessessacry-casts-and-void-po.patch new file mode 100644 index 000000000..24c3e2356 --- /dev/null +++ b/package/mac80211/patches/846-brcmsmac-remove-some-unnessessacry-casts-and-void-po.patch @@ -0,0 +1,36 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -4233,9 +4233,8 @@ static void brcms_c_radio_timer(void *ar + } + + /* common low-level watchdog code */ +-static void brcms_b_watchdog(void *arg) ++static void brcms_b_watchdog(struct brcms_c_info *wlc) + { +- struct brcms_c_info *wlc = (struct brcms_c_info *) arg; + struct brcms_hardware *wlc_hw = wlc->hw; + + BCMMSG(wlc->wiphy, "wl%d\n", wlc_hw->unit); +@@ -4256,10 +4255,8 @@ static void brcms_b_watchdog(void *arg) + } + + /* common watchdog code */ +-static void brcms_c_watchdog(void *arg) ++static void brcms_c_watchdog(struct brcms_c_info *wlc) + { +- struct brcms_c_info *wlc = (struct brcms_c_info *) arg; +- + BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); + + if (!wlc->pub->up) +@@ -4299,7 +4296,9 @@ static void brcms_c_watchdog(void *arg) + + static void brcms_c_watchdog_by_timer(void *arg) + { +- brcms_c_watchdog(arg); ++ struct brcms_c_info *wlc = (struct brcms_c_info *) arg; ++ ++ brcms_c_watchdog(wlc); + } + + static bool brcms_c_timers_init(struct brcms_c_info *wlc, int unit) diff --git a/package/mac80211/patches/847-brcmsmac-add-suome-conditions-for-the-bcm4716-again.patch b/package/mac80211/patches/847-brcmsmac-add-suome-conditions-for-the-bcm4716-again.patch new file mode 100644 index 000000000..ecf41b559 --- /dev/null +++ b/package/mac80211/patches/847-brcmsmac-add-suome-conditions-for-the-bcm4716-again.patch @@ -0,0 +1,202 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -1943,7 +1943,8 @@ static bool brcms_b_radio_read_hwdisable + * accesses phyreg throughput mac. This can be skipped since + * only mac reg is accessed below + */ +- flags |= SICF_PCLKE; ++ if (D11REV_GE(wlc_hw->corerev, 18)) ++ flags |= SICF_PCLKE; + + /* + * TODO: test suspend/resume +@@ -2024,7 +2025,8 @@ void brcms_b_corereset(struct brcms_hard + * phyreg throughput mac, AND phy_reset is skipped at early stage when + * band->pi is invalid. need to enable PHY CLK + */ +- flags |= SICF_PCLKE; ++ if (D11REV_GE(wlc_hw->corerev, 18)) ++ flags |= SICF_PCLKE; + + /* + * reset the core +--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c +@@ -17895,6 +17895,9 @@ static u32 *wlc_phy_get_ipa_gaintbl_nphy + nphy_tpc_txgain_ipa_2g_2057rev7; + } else if (NREV_IS(pi->pubpi.phy_rev, 6)) { + tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev6; ++ if (pi->sh->chip == BCM47162_CHIP_ID) { ++ tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5; ++ } + } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { + tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5; + } else { +@@ -19256,8 +19259,14 @@ static void wlc_phy_spurwar_nphy(struct + case 38: + case 102: + case 118: +- nphy_adj_tone_id_buf[0] = 0; +- nphy_adj_noise_var_buf[0] = 0x0; ++ if ((pi->sh->chip == BCM4716_CHIP_ID) && ++ (pi->sh->chippkg == BCM4717_PKG_ID)) { ++ nphy_adj_tone_id_buf[0] = 32; ++ nphy_adj_noise_var_buf[0] = 0x21f; ++ } else { ++ nphy_adj_tone_id_buf[0] = 0; ++ nphy_adj_noise_var_buf[0] = 0x0; ++ } + break; + case 134: + nphy_adj_tone_id_buf[0] = 32; +@@ -20697,12 +20706,22 @@ wlc_phy_chanspec_radio2056_setup(struct + write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | + RADIO_2056_SYN, 0x1f); + +- write_radio_reg(pi, +- RADIO_2056_SYN_PLL_LOOPFILTER4 | +- RADIO_2056_SYN, 0xb); +- write_radio_reg(pi, +- RADIO_2056_SYN_PLL_CP2 | +- RADIO_2056_SYN, 0x14); ++ if ((pi->sh->chip == BCM4716_CHIP_ID) || ++ (pi->sh->chip == BCM47162_CHIP_ID)) { ++ write_radio_reg(pi, ++ RADIO_2056_SYN_PLL_LOOPFILTER4 | ++ RADIO_2056_SYN, 0x14); ++ write_radio_reg(pi, ++ RADIO_2056_SYN_PLL_CP2 | ++ RADIO_2056_SYN, 0x00); ++ } else { ++ write_radio_reg(pi, ++ RADIO_2056_SYN_PLL_LOOPFILTER4 | ++ RADIO_2056_SYN, 0xb); ++ write_radio_reg(pi, ++ RADIO_2056_SYN_PLL_CP2 | ++ RADIO_2056_SYN, 0x14); ++ } + } + } + +@@ -20749,24 +20768,33 @@ wlc_phy_chanspec_radio2056_setup(struct + WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, + PADG_IDAC, 0xcc); + +- bias = 0x25; +- cascbias = 0x20; ++ if ((pi->sh->chip == BCM4716_CHIP_ID) || ++ (pi->sh->chip == ++ BCM47162_CHIP_ID)) { ++ bias = 0x40; ++ cascbias = 0x45; ++ pag_boost_tune = 0x5; ++ pgag_boost_tune = 0x33; ++ padg_boost_tune = 0x77; ++ mixg_boost_tune = 0x55; ++ } else { ++ bias = 0x25; ++ cascbias = 0x20; + +- if ((pi->sh->chip == +- BCM43224_CHIP_ID) +- || (pi->sh->chip == +- BCM43225_CHIP_ID)) { +- if (pi->sh->chippkg == +- BCM43224_FAB_SMIC) { +- bias = 0x2a; +- cascbias = 0x38; ++ if ((pi->sh->chip == BCM43224_CHIP_ID) ++ || (pi->sh->chip == BCM43225_CHIP_ID)) { ++ if (pi->sh->chippkg == ++ BCM43224_FAB_SMIC) { ++ bias = 0x2a; ++ cascbias = 0x38; ++ } + } +- } + +- pag_boost_tune = 0x4; +- pgag_boost_tune = 0x03; +- padg_boost_tune = 0x77; +- mixg_boost_tune = 0x65; ++ pag_boost_tune = 0x4; ++ pgag_boost_tune = 0x03; ++ padg_boost_tune = 0x77; ++ mixg_boost_tune = 0x65; ++ } + + WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, + INTPAG_IMAIN_STAT, bias); +@@ -21180,19 +21208,27 @@ wlc_phy_chanspec_nphy_setup(struct brcms + } else if (NREV_GE(pi->pubpi.phy_rev, 7)) { + if (val == 54) + spuravoid = 1; +- } else { +- if (pi->nphy_aband_spurwar_en && +- ((val == 38) || (val == 102) +- || (val == 118))) ++ } else if (pi->nphy_aband_spurwar_en && ++ ((val == 38) || (val == 102) || (val == 118))) { ++ if ((pi->sh->chip == BCM4716_CHIP_ID) ++ && (pi->sh->chippkg == BCM4717_PKG_ID)) { ++ spuravoid = 0; ++ } else { + spuravoid = 1; ++ } + } + + if (pi->phy_spuravoid == SPURAVOID_FORCEON) + spuravoid = 1; + +- wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); +- si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid); +- wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); ++ if ((pi->sh->chip == BCM4716_CHIP_ID) || ++ (pi->sh->chip == BCM47162_CHIP_ID)) { ++ si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid); ++ } else { ++ wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); ++ si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid); ++ wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); ++ } + + if ((pi->sh->chip == BCM43224_CHIP_ID) || + (pi->sh->chip == BCM43225_CHIP_ID)) { +@@ -21211,7 +21247,10 @@ wlc_phy_chanspec_nphy_setup(struct brcms + } + } + +- wlapi_bmac_core_phypll_reset(pi->sh->physhim); ++ if (!((pi->sh->chip == BCM4716_CHIP_ID) || ++ (pi->sh->chip == BCM47162_CHIP_ID))) { ++ wlapi_bmac_core_phypll_reset(pi->sh->physhim); ++ } + + mod_phy_reg(pi, 0x01, (0x1 << 15), + ((spuravoid > 0) ? (0x1 << 15) : 0)); +@@ -24925,14 +24964,20 @@ wlc_phy_a2_nphy(struct brcms_phy *pi, st + if (txgains->useindex) { + phy_a4 = 15 - ((txgains->index) >> 3); + if (CHSPEC_IS2G(pi->radio_chanspec)) { +- if (NREV_GE(pi->pubpi.phy_rev, 6)) ++ if (NREV_GE(pi->pubpi.phy_rev, 6)) { + phy_a5 = 0x00f7 | (phy_a4 << 8); +- +- else +- if (NREV_IS(pi->pubpi.phy_rev, 5)) ++ if (pi->sh->chip == ++ BCM47162_CHIP_ID) { ++ phy_a5 = ++ 0x10f7 | (phy_a4 << ++ 8); ++ } ++ } else ++ if (NREV_IS(pi->pubpi.phy_rev, 5)) { + phy_a5 = 0x10f7 | (phy_a4 << 8); +- else ++ } else { + phy_a5 = 0x50f7 | (phy_a4 << 8); ++ } + } else { + phy_a5 = 0x70f7 | (phy_a4 << 8); + } diff --git a/package/mac80211/patches/848-brcmsmac-some-more-fixes-for-different-core-revs.patch b/package/mac80211/patches/848-brcmsmac-some-more-fixes-for-different-core-revs.patch new file mode 100644 index 000000000..c5cf2fd67 --- /dev/null +++ b/package/mac80211/patches/848-brcmsmac-some-more-fixes-for-different-core-revs.patch @@ -0,0 +1,73 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -270,7 +270,7 @@ struct brcms_c_bit_desc { + */ + + /* Starting corerev for the fifo size table */ +-#define XMTFIFOTBL_STARTREV 20 ++#define XMTFIFOTBL_STARTREV 10 + + struct d11init { + __le16 addr; +@@ -334,6 +334,26 @@ const u8 wlc_prio2prec_map[] = { + }; + + static const u16 xmtfifo_sz[][NFIFO] = { ++ /* corerev 10: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 11: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 12: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 13: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 14: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 15: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 16: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */ ++ {20, 192, 192, 21, 17, 5}, ++ /* corerev 18: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 19: */ ++ {0, 0, 0, 0, 0, 0}, + /* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */ + {20, 192, 192, 21, 17, 5}, + /* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */ +@@ -344,6 +364,18 @@ static const u16 xmtfifo_sz[][NFIFO] = { + {20, 192, 192, 21, 17, 5}, + /* corerev 24: 2304, 14848, 5632, 3584, 3584, 1280 */ + {9, 58, 22, 14, 14, 5}, ++ /* corerev 25: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 26: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 27: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 28: 5120, 49152, 49152, 5376, 4352, 1280 */ ++ {20, 192, 192, 21, 17, 5}, ++ /* corerev 29: */ ++ {0, 0, 0, 0, 0, 0}, ++ /* corerev 30: */ ++ {0, 0, 0, 0, 0, 0}, + }; + + #ifdef DEBUG +@@ -4611,8 +4643,15 @@ static int brcms_b_attach(struct brcms_c + wlc_hw->machwcap_backup = wlc_hw->machwcap; + + /* init tx fifo size */ ++ WARN_ON((wlc_hw->corerev - XMTFIFOTBL_STARTREV) < 0 || ++ (wlc_hw->corerev - XMTFIFOTBL_STARTREV) > ++ ARRAY_SIZE(xmtfifo_sz)); + wlc_hw->xmtfifo_sz = + xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)]; ++ pr_err("use fifi: %i, %i, %i, %i, %i, %i\n", ++ wlc_hw->xmtfifo_sz[0], wlc_hw->xmtfifo_sz[1], ++ wlc_hw->xmtfifo_sz[2], wlc_hw->xmtfifo_sz[3], ++ wlc_hw->xmtfifo_sz[4], wlc_hw->xmtfifo_sz[5]); + + /* Get a phy for this band */ + wlc_hw->band->pi = diff --git a/package/mac80211/patches/849-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch b/package/mac80211/patches/849-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch new file mode 100644 index 000000000..9cef6975a --- /dev/null +++ b/package/mac80211/patches/849-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch @@ -0,0 +1,39 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +@@ -92,6 +92,7 @@ MODULE_LICENSE("Dual BSD/GPL"); + + /* recognized BCMA Core IDs */ + static struct bcma_device_id brcms_coreid_table[] = { ++// BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS), + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS), + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS), + BCMA_CORETABLE_END +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -751,7 +751,7 @@ static void brcms_c_ucode_bsinit(struct + brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); + + /* do band-specific ucode IHR, SHM, and SCR inits */ +- if (D11REV_IS(wlc_hw->corerev, 23)) { ++ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { + if (BRCMS_ISNPHY(wlc_hw->band)) + brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); + else +@@ -2276,7 +2276,7 @@ static void brcms_ucode_download(struct + if (wlc_hw->ucode_loaded) + return; + +- if (D11REV_IS(wlc_hw->corerev, 23)) { ++ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { + if (BRCMS_ISNPHY(wlc_hw->band)) { + brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, + ucode->bcm43xx_16_mimosz); +@@ -3252,7 +3252,7 @@ static void brcms_b_coreinit(struct brcm + + sflags = bcma_aread32(core, BCMA_IOST); + +- if (D11REV_IS(wlc_hw->corerev, 23)) { ++ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { + if (BRCMS_ISNPHY(wlc_hw->band)) + brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); + else diff --git a/package/mac80211/patches/850-brcmsmac-add-support-for-BCM43224.patch b/package/mac80211/patches/850-brcmsmac-add-support-for-BCM43224.patch new file mode 100644 index 000000000..df53b00f4 --- /dev/null +++ b/package/mac80211/patches/850-brcmsmac-add-support-for-BCM43224.patch @@ -0,0 +1,29 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -4166,6 +4166,7 @@ void brcms_c_wme_setparams(struct brcms_ + M_EDCF_QINFO + + wme_ac2fifo[aci] * M_EDCF_QLEN + i, + *shm_entry++); ++ printk("dummy\n"); + } + + if (suspend) { +@@ -4570,7 +4571,8 @@ static int brcms_b_attach(struct brcms_c + + /* check device id(srom, nvram etc.) to set bands */ + if (wlc_hw->deviceid == BCM43224_D11N_ID || +- wlc_hw->deviceid == BCM43224_D11N_ID_VEN1) ++ wlc_hw->deviceid == BCM43224_D11N_ID_VEN1|| ++ wlc_hw->deviceid == BCM43224_CHIP_ID) + /* Dualband boards */ + wlc_hw->_nbands = 2; + else +@@ -5831,7 +5833,7 @@ bool brcms_c_chipmatch(u16 vendor, u16 d + return false; + } + +- if (device == BCM43224_D11N_ID_VEN1) ++ if (device == BCM43224_D11N_ID_VEN1 || device == BCM43224_CHIP_ID) + return true; + if ((device == BCM43224_D11N_ID) || (device == BCM43225_D11N2G_ID)) + return true; diff --git a/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch b/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch new file mode 100644 index 000000000..1b64f56cc --- /dev/null +++ b/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch @@ -0,0 +1,66 @@ +--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +@@ -95,6 +95,7 @@ static struct bcma_device_id brcms_corei + // BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS), + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS), + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS), ++// BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 28, BCMA_ANY_CLASS), + BCMA_CORETABLE_END + }; + MODULE_DEVICE_TABLE(bcma, brcms_coreid_table); +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -751,7 +751,7 @@ static void brcms_c_ucode_bsinit(struct + brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); + + /* do band-specific ucode IHR, SHM, and SCR inits */ +- if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { ++ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23) || D11REV_IS(wlc_hw->corerev, 28)) { + if (BRCMS_ISNPHY(wlc_hw->band)) + brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); + else +@@ -2276,7 +2276,7 @@ static void brcms_ucode_download(struct + if (wlc_hw->ucode_loaded) + return; + +- if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { ++ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23) || D11REV_IS(wlc_hw->corerev, 28)) { + if (BRCMS_ISNPHY(wlc_hw->band)) { + brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, + ucode->bcm43xx_16_mimosz); +@@ -3252,7 +3252,7 @@ static void brcms_b_coreinit(struct brcm + + sflags = bcma_aread32(core, BCMA_IOST); + +- if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { ++ if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23) || D11REV_IS(wlc_hw->corerev, 28)) { + if (BRCMS_ISNPHY(wlc_hw->band)) + brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); + else +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.h ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h +@@ -65,7 +65,7 @@ + #define SW_TIMER_MAC_STAT_UPD 30 /* periodic MAC stats update */ + + /* max # supported core revisions (0 .. MAXCOREREV - 1) */ +-#define MAXCOREREV 28 ++#define MAXCOREREV 29 + + /* Double check that unsupported cores are not enabled */ + #if CONF_MSK(D11CONF, 0x4f) || CONF_GE(D11CONF, MAXCOREREV) +--- a/drivers/net/wireless/brcm80211/brcmsmac/types.h ++++ b/drivers/net/wireless/brcm80211/brcmsmac/types.h +@@ -93,11 +93,11 @@ + #define BOARD_GPIO_13 0x2000 + + /* **** Core type/rev defaults **** */ +-#define D11CONF 0x0fffffb0 /* Supported D11 revs: 4, 5, 7-27 ++#define D11CONF 0x1fffffb0 /* Supported D11 revs: 4, 5, 7-27 + * also need to update wlc.h MAXCOREREV + */ + +-#define NCONF 0x000001ff /* Supported nphy revs: ++#define NCONF 0x000002ff /* Supported nphy revs: + * 0 4321a0 + * 1 4321a1 + * 2 4321b0/b1/c0/c1 -- cgit v1.2.3