brcmfmac: support for new 14e43:4365 card with BCM4366
cover brcmfmac: support for new 14e43:4365 card with BCM4366
I got D-Link DIR-885L with two 14e4:4365 PCI cards both using BCM4366 chipset. It seems to have newer ChipCommon and separated PMU core so I needed these patches on top of recent Broadcom's work.
Please note this patchset depends on:
[PATCH 2/2] bcma: support PMU present as separated bus core as I had to use BCMA_CC_CAP_EXT_AOB_PRESENT.
Rafał Miłecki (5):
brcmfmac: analyze descriptors of current component only
brcmfmac: allow storing PMU core without wrapper address
brcmfmac: read extended capabilities of ChipCommon core
brcmfmac: access PMU registers using standalone PMU core if available
brcmfmac: add support for 14e4:4365 PCI ID with BCM4366 chipset
.../wireless/broadcom/brcm80211/brcmfmac/chip.c | 45 ++++++++++++++++++---- .../wireless/broadcom/brcm80211/brcmfmac/chip.h | 3 ++ .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 9 ++--- 4 files changed, 49 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.4.5
PATCH 1/5 brcmfmac: analyze descriptors of current component only
So far we were looking for address descriptors without a check for crossing current component border. In case of dealing with unsupported descriptor or descriptor missing at all the code would incorrectly get data from another component.
Consider this binary-described component from BCM4366 EROM:4bf83b01 TAG==CI CID==0x83b
20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
00050000
18107085 TAG==ADDR SZ_4K TYPE_SWRAP
Driver was assigning invalid base address to this core:
brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000 which came from totally different component defined in EROM:43b36701 TAG==CI CID==0x367
00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
18109005 TAG==ADDR SZ_4K TYPE_SLAVE
This change will also allow us to support components without wrapper address in the future.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +8 -1
@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(struct brcmf_chip_priv *ci, u32 *eromaddr, *eromaddr -=4 ;return -EFAULT ; } - }while (desc !=DMP_DESC_ADDRESS ); + }while (desc !=DMP_DESC_ADDRESS && + desc !=DMP_DESC_COMPONENT ); + +/* stop if we crossed current component border */ +if (desc ==DMP_DESC_COMPONENT ) { + *eromaddr -=4 ; +return 0 ; + }/* skip upper 32-bit address descriptor */ if (val &DMP_DESC_ADDRSIZE_GT32 )
Signature · 1 line
1.8.4.5
PATCH 2/5 brcmfmac: allow storing PMU core without wrapper address
In reply to Rafał MiłeckiSeparated PMU core can be found in new devices and should be used for accessing PMU registers (which were routed through ChipCommon so far). This core is one of exceptions that doesn't have or need wrapper address to be still safely accessible.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +2 -1
@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcmf_chip_priv *ci) rev = (val &DMP_COMP_REVISION ) >>DMP_COMP_REVISION_S ;/* need core with ports */ -if (nmw + nsw ==0 ) +if (nmw + nsw ==0 && + id !=BCMA_CORE_PMU )continue ;/* try to obtain register address info */
Signature · 1 line
1.8.4.5
PATCH 3/5 brcmfmac: read extended capabilities of ChipCommon core
In reply to Rafał MiłeckiThis is an extra bitfield with info about some present hardware.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 3 +++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +3 -0
@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf_chip_priv *chip)/* get chipcommon capabilites */ pub->cc_caps = chip->ops->read32 (chip->ctx,CORE_CC_REG (base, capabilities)); + pub->cc_caps_ext = chip->ops->read32 (chip->ctx, +CORE_CC_REG (base, + capabilities_ext));/* get pmu caps & rev */ if (pub->cc_caps &CC_CAP_PMU ) {
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +2 -0
@@ -27,6 +27,7 @@* @chip: chip identifier. * @chiprev: chip revision. * @cc_caps: chipcommon core capabilities. +* @cc_caps_ext: chipcommon core extended capabilities. * @pmucaps: PMU capabilities. * @pmurev: PMU revision. * @rambase: RAM base address (only applicable for ARM CR4 chips).
@@ -38,6 +39,7 @@ struct brcmf_chip {u32 chip;u32 chiprev;u32 cc_caps; +u32 cc_caps_ext;u32 pmucaps;u32 pmurev;u32 rambase;
Signature · 1 line
1.8.4.5
PATCH 4/5 brcmfmac: access PMU registers using standalone PMU core if available
In reply to Rafał MiłeckiOn recent Broadcom chipsets PMU is present as separated core and it can't be accessed using ChipCommon anymore as it fails with e.g.:
[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
Add a new helper function that will return a proper core that should be used for accessing PMU registers.
--- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 30 ++++++++++++++++++---- .../wireless/broadcom/brcm80211/brcmfmac/chip.h | 1 + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 9 +++---- 3 files changed, 30 insertions(+), 10 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +25 -5
@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf_chip_priv *chip) {struct brcmf_chip *pub;struct brcmf_core_priv *cc; +struct brcmf_core *pmu;u32 base;u32 val;int ret =0 ;
@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf_chip_priv *chip) capabilities_ext));/* get pmu caps & rev */ + pmu =brcmf_chip_get_pmu (pub);/* after reading cc_caps_ext */ if (pub->cc_caps &CC_CAP_PMU ) { val = chip->ops->read32 (chip->ctx, -CORE_CC_REG (base, pmucapabilities)); +CORE_CC_REG (pmu->base, pmucapabilities)); pub->pmurev = val &PCAP_REV_MASK ; pub->pmucaps = val; }
@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *pub)return &cc->pub; } +struct brcmf_core *brcmf_chip_get_pmu (struct brcmf_chip *pub) +{ +struct brcmf_core *cc =brcmf_chip_get_chipcommon (pub); +struct brcmf_core *pmu; + +/* See if there is separated PMU core available */ +if (cc->rev >=35 && + pub->cc_caps_ext &BCMA_CC_CAP_EXT_AOB_PRESENT ) { + pmu =brcmf_chip_get_core (pub,BCMA_CORE_PMU ); +if (pmu) +return pmu; + } + +/* Fallback to ChipCommon core for older hardware */ +return cc; +} +bool brcmf_chip_iscoreup (struct brcmf_core *pub) {struct brcmf_core_priv *core;
@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub) {u32 base, addr, reg, pmu_cc3_mask = ~0 ;struct brcmf_chip_priv *chip; +struct brcmf_core *pmu =brcmf_chip_get_pmu (pub);brcmf_dbg (TRACE ,"Enter\n" );
@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub)case BRCM_CC_4335_CHIP_ID :case BRCM_CC_4339_CHIP_ID :/* read PMU chipcontrol register 3 */ - addr =CORE_CC_REG (base, chipcontrol_addr); + addr =CORE_CC_REG (pmu->base, chipcontrol_addr); chip->ops->write32 (chip->ctx, addr,3 ); - addr =CORE_CC_REG (base, chipcontrol_data); + addr =CORE_CC_REG (pmu->base, chipcontrol_data); reg = chip->ops->read32 (chip->ctx, addr);return (reg & pmu_cc3_mask) !=0 ;case BRCM_CC_43430_CHIP_ID :
@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub) reg = chip->ops->read32 (chip->ctx, addr);return reg !=0 ;default : - addr =CORE_CC_REG (base, pmucapabilities_ext); + addr =CORE_CC_REG (pmu->base, pmucapabilities_ext); reg = chip->ops->read32 (chip->ctx, addr);if ((reg &PCAPEXT_SR_SUPPORTED_MASK ) ==0 )return false; - addr =CORE_CC_REG (base, retention_ctl); + addr =CORE_CC_REG (pmu->base, retention_ctl); reg = chip->ops->read32 (chip->ctx, addr);return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |PMU_RCTL_LOGIC_DISABLE_MASK )) ==0 ;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +1 -0
@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(void *ctx,void brcmf_chip_detach (struct brcmf_chip *chip);struct brcmf_core *brcmf_chip_get_core (struct brcmf_chip *chip,u16 coreid);struct brcmf_core *brcmf_chip_get_chipcommon (struct brcmf_chip *chip); +struct brcmf_core *brcmf_chip_get_pmu (struct brcmf_chip *pub);bool brcmf_chip_iscoreup (struct brcmf_core *core);void brcmf_chip_coredisable (struct brcmf_core *core,u32 prereset,u32 reset); void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +4 -5
@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcmf_sdio_dev *sdiodev,const struct sdiod_drive_str *str_tab =NULL ;u32 str_mask;u32 str_shift; -u32 base;u32 i;u32 drivestrength_sel =0 ;u32 cc_data_temp;
@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, }if (str_tab !=NULL ) { +struct brcmf_core *pmu =brcmf_chip_get_pmu (ci); +for (i =0 ; str_tab[i].strength !=0 ; i++) {if (drivestrength >= str_tab[i].strength) { drivestrength_sel = str_tab[i].sel;break ; } } - base =brcmf_chip_get_chipcommon (ci)->base; - addr =CORE_CC_REG (base, chipcontrol_addr); + addr =CORE_CC_REG (pmu->base, chipcontrol_addr);brcmf_sdiod_regwl (sdiodev, addr,1 ,NULL ); cc_data_temp =brcmf_sdiod_regrl (sdiodev, addr,NULL ); cc_data_temp &= ~str_mask;
@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdio *bus) goto fail;/* set PMUControl so a backplane reset does PMU state reload */ - reg_addr =CORE_CC_REG (brcmf_chip_get_chipcommon (bus->ci)->base, - pmucontrol); + reg_addr =CORE_CC_REG (brcmf_chip_get_pmu (bus->ci)->base, pmucontrol); reg_val =brcmf_sdiod_regrl (bus->sdiodev, reg_addr, &err);if (err) goto fail;
Signature · 1 line
1.8.4.5
kbuild test robot
build botRe: [PATCH 4/5] brcmfmac: access PMU registers using standalone PMU core if available
reproduce:
Hi Rafał,
[auto build test ERROR on wireless-drivers/master]
[also build test ERROR on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 'brcmf_chip_get_pmu':
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)
pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
^ drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: each undeclared identifier is reported only once for each function it appears in
vim +/BCMA_CC_CAP_EXT_AOB_PRESENT +1143 drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
1137 {
1138 struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
1139 struct brcmf_core *pmu;
1140
1141 /* See if there is separated PMU core available */
1142 if (cc->rev >= 35 &&
> 1143 pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { 1144 pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
1145 if (pmu)
1146 return pmu;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 4/5] brcmfmac: access PMU registers using standalone PMU core if available
Quoted 13 lines · kbuild test robot
Hi Rafał,
[auto build test ERROR on wireless-drivers/master]
[also build test ERROR on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
Quoted 7 lines
All errors (new ones prefixed by >>):
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 'brcmf_chip_get_pmu':Quoted 1 line
Quoted 1 line
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { ^
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: each undeclared identifier is reported only once for each function it appears in
I think this error was as expected because this set depends on "bcma:
support PMU present as separated bus core" which is not yet applied.
Signature · 1 line
Kalle Valo
Re: [PATCH 4/5] brcmfmac: access PMU registers using standalone PMU core if available
Quoted 17 lines · Kalle Valo
Quoted 15 lines · kbuild test robot
Hi Rafał,
[auto build test ERROR on wireless-drivers/master]
[also build test ERROR on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
Quoted 8 lines
Quoted 5 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 'brcmf_chip_get_pmu':Quoted 1 line
Quoted 1 line
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { ^
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: each undeclared identifier is reported only once for each function it appears inI think this error was as expected because this set depends on "bcma:
support PMU present as separated bus core" which is not yet applied.
Yes, builbot simply couldn't know about this, but I should have reply to make it clear I guess.
Signature · 1 line
Rafał
Re: [PATCH 4/5] brcmfmac: access PMU registers using standalone PMU core if available
Hi Kbuild Test Robot Guys,
Quoted 24 lines · Rafał Miłecki
Quoted 23 lines · Kalle Valo
Quoted 20 lines · kbuild test robot
Hi Rafał,
[auto build test ERROR on wireless-drivers/master]
[also build test ERROR on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 'brcmf_chip_get_pmu':Quoted 1 line
Quoted 1 line
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { ^
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: each undeclared identifier is reported only once for each function it appears in
Quoted 5 lines
Quoted 2 lines
I think this error was as expected because this set depends on "bcma:
support PMU present as separated bus core" which is not yet applied.Yes, builbot simply couldn't know about this, but I should have reply to make it clear I guess.
Is there any way to communicate to the test robot that this series depends on some other series or patch?
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
PATCH 5/5 brcmfmac: add support for 14e4:4365 PCI ID with BCM4366 chipset
In reply to Rafał MiłeckiOn Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID. Unfortunately this ID was already used by Broadcom for cards with BCM43142, a totally different chipset requiring SoftMAC driver. To avoid a conflict between brcmfmac and bcma use more specific ID entry with subvendor and subdevice specified.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +4 -0
@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pciedrvr_pm = {#define BRCMF_PCIE_DEVICE (dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\ PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 } +#define BRCMF_PCIE_DEVICE_SUB (dev_id, subvend, subdev) { \ + BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\ + subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }static struct pci_device_id brcmf_pcie_devid_table[] = {BRCMF_PCIE_DEVICE (BRCM_PCIE_4350_DEVICE_ID ),
@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_devid_table[] = {BRCMF_PCIE_DEVICE (BRCM_PCIE_4365_DEVICE_ID ),BRCMF_PCIE_DEVICE (BRCM_PCIE_4365_2G_DEVICE_ID ),BRCMF_PCIE_DEVICE (BRCM_PCIE_4365_5G_DEVICE_ID ), +BRCMF_PCIE_DEVICE_SUB (0x4365 ,BRCM_PCIE_VENDOR_ID_BROADCOM ,0x4365 ),BRCMF_PCIE_DEVICE (BRCM_PCIE_4366_DEVICE_ID ),BRCMF_PCIE_DEVICE (BRCM_PCIE_4366_2G_DEVICE_ID ), BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
Signature · 1 line
1.8.4.5
Quoted 8 lines · Rafał Miłecki
I got D-Link DIR-885L with two 14e4:4365 PCI cards both using BCM4366 chipset. It seems to have newer ChipCommon and separated PMU core so I needed these patches on top of recent Broadcom's work.
Please note this patchset depends on:
[PATCH 2/2] bcma: support PMU present as separated bus core as I had to useBCMA_CC_CAP_EXT_AOB_PRESENT.
Quoted 6 lines
Rafał Miłecki (5):
brcmfmac: analyze descriptors of current component only
brcmfmac: allow storing PMU core without wrapper address
brcmfmac: read extended capabilities of ChipCommon core
brcmfmac: access PMU registers using standalone PMU core if available
brcmfmac: add support for 14e4:4365 PCI ID with BCM4366 chipset
Manually applied all five to wireless-drivers-next.git, thanks.
Signature · 1 line
Kalle Valo