brcmfmac: cleanup work for 3.14
PATCH 1/8 brcmfmac: Create common nvram parsing routines.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
New bus layers like pcie require nvram parsing routines which are the same routines as being used by sdio. Make these routines common in the new file nvram.c. Update sdio to use these routines and simplify the nvram upload process. Also add memory validation check for downloaded firmware and nvram in debug mode.
--- drivers/net/wireless/brcm80211/brcmfmac/Makefile | 1 + drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 166 ++++++++++---------- drivers/net/wireless/brcm80211/brcmfmac/nvram.c | 94 +++++++++++ drivers/net/wireless/brcm80211/brcmfmac/nvram.h | 24 +++ .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 110 +------------ .../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 3 +- 6 files changed, 208 insertions(+), 190 deletions(-) create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/nvram.c create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/nvram.h
drivers/net/wireless/brcm80211/brcmfmac/Makefile +1 -0
@@ -32,6 +32,7 @@ brcmfmac-objs += \ bcdc.o \ dhd_common.o \ dhd_linux.o \ + nvram.o \ btcoex.o brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ dhd_sdio.o \
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +83 -83
224 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/nvram.c new file +94 -0
94 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/nvram.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2013 Broadcom Corporation +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#ifndef BRCMFMAC_NVRAM_H +#define BRCMFMAC_NVRAM_H + + +void *brcmf_nvram_strip (const struct firmware *nv,u32 *new_length); +void brcmf_nvram_free (void *nvram); + + +#endif /* BRCMFMAC_NVRAM_H */
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +5 -105
151 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +1 -2
@@ -224,7 +224,6 @@ u8 brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid);void brcmf_sdio_chip_enter_download (struct brcmf_sdio_dev *sdiodev,struct chip_info *ci);bool brcmf_sdio_chip_exit_download (struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,char *nvram_dat, -uint nvram_sz); +struct chip_info *ci);#endif /* _BRCMFMAC_SDIO_CHIP_H_ */
Signature · 1 line
1.7.10.4
PATCH 5/8 brcmfmac: restructure brcmf_sdio_chip_recognition()
In reply to Arend van SprielRework function to allow only bcm4329 in case of chip backplane type being sonics sillicon backplane.
--- .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 333 ++++++++++---------- .../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 1 - 2 files changed, 167 insertions(+), 167 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +167 -166
@@ -455,70 +455,38 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci) {u32 regdata; -int ret; +u32 socitype;/* Get CC core rev -* Chipid is assume to be at offset 0 from regs arg +* Chipid is assume to be at offset 0 from SI_ENUM_BASE * For different chiptypes or old sdio hosts w/o chipcommon, * other ways of recognition should be added here. */ - ci->c_inf[0 ].id =BCMA_CORE_CHIPCOMMON ; - ci->c_inf[0 ].base =SI_ENUM_BASE ; regdata =brcmf_sdiod_regrl (sdiodev, -CORE_CC_REG (ci->c_inf[0 ].base, chipid), +CORE_CC_REG (SI_ENUM_BASE , chipid),NULL ); ci->chip = regdata &CID_ID_MASK ; ci->chiprev = (regdata &CID_REV_MASK ) >>CID_REV_SHIFT ;if (sdiodev->func[0 ]->device ==SDIO_DEVICE_ID_BROADCOM_4335_4339 && ci->chiprev >=2 ) ci->chip =BCM4339_CHIP_ID ; - ci->socitype = (regdata &CID_TYPE_MASK ) >>CID_TYPE_SHIFT ; + socitype = (regdata &CID_TYPE_MASK ) >>CID_TYPE_SHIFT ; -brcmf_dbg (INFO ,"chipid=0x%x chiprev=%d\n" , ci->chip, ci->chiprev); +brcmf_dbg (INFO ,"found %s chip: id=0x%x, rev=%d\n" , + socitype ==SOCI_SB ?"SB" :"AXI" , ci->chip, ci->chiprev); -/* Address of cores for new chips should be added here */ -switch (ci->chip) { -case BCM43143_CHIP_ID : - ci->c_inf[0 ].wrapbase = ci->c_inf[0 ].base +0x00100000 ; - ci->c_inf[0 ].cib =0x2b000000 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =BCM43143_CORE_BUS_BASE ; - ci->c_inf[1 ].wrapbase = ci->c_inf[1 ].base +0x00100000 ; - ci->c_inf[1 ].cib =0x18000000 ; - ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; - ci->c_inf[2 ].base =BCM43143_CORE_SOCRAM_BASE ; - ci->c_inf[2 ].wrapbase = ci->c_inf[2 ].base +0x00100000 ; - ci->c_inf[2 ].cib =0x14000000 ; - ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; - ci->c_inf[3 ].base =BCM43143_CORE_ARM_BASE ; - ci->c_inf[3 ].wrapbase = ci->c_inf[3 ].base +0x00100000 ; - ci->c_inf[3 ].cib =0x07000000 ; - ci->c_inf[4 ].id =BCMA_CORE_80211 ; - ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; - ci->ramsize =BCM43143_RAMSIZE ; -break ; -case BCM43241_CHIP_ID : - ci->c_inf[0 ].wrapbase =0x18100000 ; - ci->c_inf[0 ].cib =0x2a084411 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =0x18002000 ; - ci->c_inf[1 ].wrapbase =0x18102000 ; - ci->c_inf[1 ].cib =0x0e004211 ; - ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; - ci->c_inf[2 ].base =0x18004000 ; - ci->c_inf[2 ].wrapbase =0x18104000 ; - ci->c_inf[2 ].cib =0x14080401 ; - ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; - ci->c_inf[3 ].base =0x18003000 ; - ci->c_inf[3 ].wrapbase =0x18103000 ; - ci->c_inf[3 ].cib =0x07004211 ; - ci->c_inf[4 ].id =BCMA_CORE_80211 ; - ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; - ci->ramsize =0x90000 ; -break ; -case BCM4329_CHIP_ID : +if (socitype ==SOCI_SB ) { +if (ci->chip !=BCM4329_CHIP_ID ) { +brcmf_err ("SB chip is not supported\n" ); +return -ENODEV ; + } + ci->iscoreup = brcmf_sdio_sb_iscoreup; + ci->corerev = brcmf_sdio_sb_corerev; + ci->coredisable = brcmf_sdio_sb_coredisable; + ci->resetcore = brcmf_sdio_sb_resetcore; + + ci->c_inf[0 ].id =BCMA_CORE_CHIPCOMMON ; + ci->c_inf[0 ].base =SI_ENUM_BASE ; ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; ci->c_inf[1 ].base =BCM4329_CORE_BUS_BASE ; ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ;
@@ -528,129 +496,162 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, ci->c_inf[4 ].id =BCMA_CORE_80211 ; ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; ci->ramsize =BCM4329_RAMSIZE ; -break ; -case BCM4330_CHIP_ID : - ci->c_inf[0 ].wrapbase =0x18100000 ; - ci->c_inf[0 ].cib =0x27004211 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =0x18002000 ; - ci->c_inf[1 ].wrapbase =0x18102000 ; - ci->c_inf[1 ].cib =0x07004211 ; - ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; - ci->c_inf[2 ].base =0x18004000 ; - ci->c_inf[2 ].wrapbase =0x18104000 ; - ci->c_inf[2 ].cib =0x0d080401 ; - ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; - ci->c_inf[3 ].base =0x18003000 ; - ci->c_inf[3 ].wrapbase =0x18103000 ; - ci->c_inf[3 ].cib =0x03004211 ; - ci->c_inf[4 ].id =BCMA_CORE_80211 ; - ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; - ci->ramsize =0x48000 ; -break ; -case BCM4334_CHIP_ID : - ci->c_inf[0 ].wrapbase =0x18100000 ; - ci->c_inf[0 ].cib =0x29004211 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =0x18002000 ; - ci->c_inf[1 ].wrapbase =0x18102000 ; - ci->c_inf[1 ].cib =0x0d004211 ; - ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; - ci->c_inf[2 ].base =0x18004000 ; - ci->c_inf[2 ].wrapbase =0x18104000 ; - ci->c_inf[2 ].cib =0x13080401 ; - ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; - ci->c_inf[3 ].base =0x18003000 ; - ci->c_inf[3 ].wrapbase =0x18103000 ; - ci->c_inf[3 ].cib =0x07004211 ; - ci->c_inf[4 ].id =BCMA_CORE_80211 ; - ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; - ci->ramsize =0x80000 ; -break ; -case BCM4335_CHIP_ID : - ci->c_inf[0 ].wrapbase =0x18100000 ; - ci->c_inf[0 ].cib =0x2b084411 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =0x18005000 ; - ci->c_inf[1 ].wrapbase =0x18105000 ; - ci->c_inf[1 ].cib =0x0f004211 ; - ci->c_inf[2 ].id =BCMA_CORE_ARM_CR4 ; - ci->c_inf[2 ].base =0x18002000 ; - ci->c_inf[2 ].wrapbase =0x18102000 ; - ci->c_inf[2 ].cib =0x01084411 ; - ci->c_inf[3 ].id =BCMA_CORE_80211 ; - ci->c_inf[3 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[3 ].wrapbase = ci->c_inf[3 ].base +0x00100000 ; - ci->ramsize =0xc0000 ; - ci->rambase =0x180000 ; -break ; -case BCM4339_CHIP_ID : - ci->c_inf[0 ].wrapbase =0x18100000 ; - ci->c_inf[0 ].cib =0x2e084411 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =0x18005000 ; - ci->c_inf[1 ].wrapbase =0x18105000 ; - ci->c_inf[1 ].cib =0x15004211 ; - ci->c_inf[2 ].id =BCMA_CORE_ARM_CR4 ; - ci->c_inf[2 ].base =0x18002000 ; - ci->c_inf[2 ].wrapbase =0x18102000 ; - ci->c_inf[2 ].cib =0x04084411 ; - ci->c_inf[3 ].id =BCMA_CORE_80211 ; - ci->c_inf[3 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[3 ].wrapbase = ci->c_inf[3 ].base +0x00100000 ; - ci->ramsize =0xc0000 ; - ci->rambase =0x180000 ; -break ; -case BCM43362_CHIP_ID : - ci->c_inf[0 ].wrapbase =0x18100000 ; - ci->c_inf[0 ].cib =0x27004211 ; - ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; - ci->c_inf[1 ].base =0x18002000 ; - ci->c_inf[1 ].wrapbase =0x18102000 ; - ci->c_inf[1 ].cib =0x0a004211 ; - ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; - ci->c_inf[2 ].base =0x18004000 ; - ci->c_inf[2 ].wrapbase =0x18104000 ; - ci->c_inf[2 ].cib =0x08080401 ; - ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; - ci->c_inf[3 ].base =0x18003000 ; - ci->c_inf[3 ].wrapbase =0x18103000 ; - ci->c_inf[3 ].cib =0x03004211 ; - ci->c_inf[4 ].id =BCMA_CORE_80211 ; - ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; - ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; - ci->ramsize =0x3C000 ; -break ; -default : -brcmf_err ("chipid 0x%x is not supported\n" , ci->chip); -return -ENODEV ; - } - - ret =brcmf_sdio_chip_cichk (ci); -if (ret) -return ret; - -switch (ci->socitype) { -case SOCI_SB : - ci->iscoreup = brcmf_sdio_sb_iscoreup; - ci->corerev = brcmf_sdio_sb_corerev; - ci->coredisable = brcmf_sdio_sb_coredisable; - ci->resetcore = brcmf_sdio_sb_resetcore; -break ; -case SOCI_AI : + }else if (socitype ==SOCI_AI ) { ci->iscoreup = brcmf_sdio_ai_iscoreup; ci->corerev = brcmf_sdio_ai_corerev; ci->coredisable = brcmf_sdio_ai_coredisable; ci->resetcore = brcmf_sdio_ai_resetcore; -break ; -default : -brcmf_err ("socitype %u not supported\n" , ci->socitype); + + ci->c_inf[0 ].id =BCMA_CORE_CHIPCOMMON ; + ci->c_inf[0 ].base =SI_ENUM_BASE ; + +/* Address of cores for new chips should be added here */ +switch (ci->chip) { +case BCM43143_CHIP_ID : + ci->c_inf[0 ].wrapbase = ci->c_inf[0 ].base +0x00100000 ; + ci->c_inf[0 ].cib =0x2b000000 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =BCM43143_CORE_BUS_BASE ; + ci->c_inf[1 ].wrapbase = ci->c_inf[1 ].base +0x00100000 ; + ci->c_inf[1 ].cib =0x18000000 ; + ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; + ci->c_inf[2 ].base =BCM43143_CORE_SOCRAM_BASE ; + ci->c_inf[2 ].wrapbase = ci->c_inf[2 ].base +0x00100000 ; + ci->c_inf[2 ].cib =0x14000000 ; + ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; + ci->c_inf[3 ].base =BCM43143_CORE_ARM_BASE ; + ci->c_inf[3 ].wrapbase = ci->c_inf[3 ].base +0x00100000 ; + ci->c_inf[3 ].cib =0x07000000 ; + ci->c_inf[4 ].id =BCMA_CORE_80211 ; + ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; + ci->ramsize =BCM43143_RAMSIZE ; +break ; +case BCM43241_CHIP_ID : + ci->c_inf[0 ].wrapbase =0x18100000 ; + ci->c_inf[0 ].cib =0x2a084411 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =0x18002000 ; + ci->c_inf[1 ].wrapbase =0x18102000 ; + ci->c_inf[1 ].cib =0x0e004211 ; + ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; + ci->c_inf[2 ].base =0x18004000 ; + ci->c_inf[2 ].wrapbase =0x18104000 ; + ci->c_inf[2 ].cib =0x14080401 ; + ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; + ci->c_inf[3 ].base =0x18003000 ; + ci->c_inf[3 ].wrapbase =0x18103000 ; + ci->c_inf[3 ].cib =0x07004211 ; + ci->c_inf[4 ].id =BCMA_CORE_80211 ; + ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; + ci->ramsize =0x90000 ; +break ; +case BCM4330_CHIP_ID : + ci->c_inf[0 ].wrapbase =0x18100000 ; + ci->c_inf[0 ].cib =0x27004211 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =0x18002000 ; + ci->c_inf[1 ].wrapbase =0x18102000 ; + ci->c_inf[1 ].cib =0x07004211 ; + ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; + ci->c_inf[2 ].base =0x18004000 ; + ci->c_inf[2 ].wrapbase =0x18104000 ; + ci->c_inf[2 ].cib =0x0d080401 ; + ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; + ci->c_inf[3 ].base =0x18003000 ; + ci->c_inf[3 ].wrapbase =0x18103000 ; + ci->c_inf[3 ].cib =0x03004211 ; + ci->c_inf[4 ].id =BCMA_CORE_80211 ; + ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; + ci->ramsize =0x48000 ; +break ; +case BCM4334_CHIP_ID : + ci->c_inf[0 ].wrapbase =0x18100000 ; + ci->c_inf[0 ].cib =0x29004211 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =0x18002000 ; + ci->c_inf[1 ].wrapbase =0x18102000 ; + ci->c_inf[1 ].cib =0x0d004211 ; + ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; + ci->c_inf[2 ].base =0x18004000 ; + ci->c_inf[2 ].wrapbase =0x18104000 ; + ci->c_inf[2 ].cib =0x13080401 ; + ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; + ci->c_inf[3 ].base =0x18003000 ; + ci->c_inf[3 ].wrapbase =0x18103000 ; + ci->c_inf[3 ].cib =0x07004211 ; + ci->c_inf[4 ].id =BCMA_CORE_80211 ; + ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; + ci->ramsize =0x80000 ; +break ; +case BCM4335_CHIP_ID : + ci->c_inf[0 ].wrapbase =0x18100000 ; + ci->c_inf[0 ].cib =0x2b084411 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =0x18005000 ; + ci->c_inf[1 ].wrapbase =0x18105000 ; + ci->c_inf[1 ].cib =0x0f004211 ; + ci->c_inf[2 ].id =BCMA_CORE_ARM_CR4 ; + ci->c_inf[2 ].base =0x18002000 ; + ci->c_inf[2 ].wrapbase =0x18102000 ; + ci->c_inf[2 ].cib =0x01084411 ; + ci->c_inf[3 ].id =BCMA_CORE_80211 ; + ci->c_inf[3 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[3 ].wrapbase = ci->c_inf[3 ].base +0x00100000 ; + ci->ramsize =0xc0000 ; + ci->rambase =0x180000 ; +break ; +case BCM43362_CHIP_ID : + ci->c_inf[0 ].wrapbase =0x18100000 ; + ci->c_inf[0 ].cib =0x27004211 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =0x18002000 ; + ci->c_inf[1 ].wrapbase =0x18102000 ; + ci->c_inf[1 ].cib =0x0a004211 ; + ci->c_inf[2 ].id =BCMA_CORE_INTERNAL_MEM ; + ci->c_inf[2 ].base =0x18004000 ; + ci->c_inf[2 ].wrapbase =0x18104000 ; + ci->c_inf[2 ].cib =0x08080401 ; + ci->c_inf[3 ].id =BCMA_CORE_ARM_CM3 ; + ci->c_inf[3 ].base =0x18003000 ; + ci->c_inf[3 ].wrapbase =0x18103000 ; + ci->c_inf[3 ].cib =0x03004211 ; + ci->c_inf[4 ].id =BCMA_CORE_80211 ; + ci->c_inf[4 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[4 ].wrapbase = ci->c_inf[4 ].base +0x00100000 ; + ci->ramsize =0x3C000 ; +break ; +case BCM4339_CHIP_ID : + ci->c_inf[0 ].wrapbase =0x18100000 ; + ci->c_inf[0 ].cib =0x2e084411 ; + ci->c_inf[1 ].id =BCMA_CORE_SDIO_DEV ; + ci->c_inf[1 ].base =0x18005000 ; + ci->c_inf[1 ].wrapbase =0x18105000 ; + ci->c_inf[1 ].cib =0x15004211 ; + ci->c_inf[2 ].id =BCMA_CORE_ARM_CR4 ; + ci->c_inf[2 ].base =0x18002000 ; + ci->c_inf[2 ].wrapbase =0x18102000 ; + ci->c_inf[2 ].cib =0x04084411 ; + ci->c_inf[3 ].id =BCMA_CORE_80211 ; + ci->c_inf[3 ].base = BCM43xx_CORE_D11_BASE; + ci->c_inf[3 ].wrapbase = ci->c_inf[3 ].base +0x00100000 ; + ci->ramsize =0xc0000 ; + ci->rambase =0x180000 ; +break ; +default : +brcmf_err ("AXI chip is not supported\n" ); +return -ENODEV ; + } + }else { +brcmf_err ("chip backplane type %u is not supported\n" , + socitype);return -ENODEV ; } -return 0 ; +return brcmf_sdio_chip_cichk (ci); } static int
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +0 -1
@@ -66,7 +66,6 @@ struct chip_core_info {struct chip_info {u32 chip;u32 chiprev; -u32 socitype;/* core info */ /* always put chipcommon core at 0, bus core at 1 */ struct chip_core_info c_inf[BRCMF_MAX_CORENUM ];
Signature · 1 line
1.7.10.4
PATCH 7/8 brcmfmac: initialize escan function pointer during scheduled scan
In reply to Arend van SprielFor scheduled scan results the driver does a escan to obtain BSS details from the firmware. However, the escan uses a dynamically determined function. This needs to be set appropriately when handling scheduled scan results to avoid NULL pointer access.
--- drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +1 -0
@@ -2989,6 +2989,7 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp, }set_bit (BRCMF_SCAN_STATUS_BUSY , &cfg->scan_status); + cfg->escan_info.run = brcmf_run_escan; err =brcmf_do_escan (cfg, wiphy, ifp, request);if (err) {clear_bit (BRCMF_SCAN_STATUS_BUSY , &cfg->scan_status);
Signature · 1 line
1.7.10.4
PATCH 8/8 brcmfmac: handle SDIO card removal
In reply to Arend van SprielWhen removing the card the driver still tries to access registers in the device. This patch adds another state for the bus that indicates the device is no longer reachable. This avoids errors accessing it while cleaning up the driver.
--- drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 40 ++++--- drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | 21 ++++ .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 4 +- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 120 ++++++++------------ drivers/net/wireless/brcm80211/brcmfmac/usb.c | 4 +- 5 files changed, 102 insertions(+), 87 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +26 -14
@@ -287,6 +287,9 @@ static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,s32 retry =0 ;int ret; +if (sdiodev->bus_if->state ==BRCMF_BUS_NOMEDIUM ) +return -ENOMEDIUM ; +/* * figure out how to read the register based on address range * 0x00 ~ 0x7FF: function 0 CCCR and FBR
@@ -306,9 +309,12 @@ static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,usleep_range (1000 ,2000 ); ret =brcmf_sdiod_request_data (sdiodev, func_num, addr, regsz, data, write); - }while (ret !=0 && retry++ <SDIOH_API_ACCESS_RETRY_LIMIT ); + }while (ret !=0 && ret != -ENOMEDIUM && + retry++ <SDIOH_API_ACCESS_RETRY_LIMIT ); -if (ret !=0 ) +if (ret == -ENOMEDIUM ) +brcmf_bus_change_state (sdiodev->bus_if,BRCMF_BUS_NOMEDIUM ); +else if (ret !=0 )brcmf_err ("failed with %d\n" , ret);return ret;
@@ -320,6 +326,9 @@ brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)int err =0 , i;u8 addr[3 ]; +if (sdiodev->bus_if->state ==BRCMF_BUS_NOMEDIUM ) +return -ENOMEDIUM ; + addr[0 ] = (address >>8 ) &SBSDIO_SBADDRLOW_MASK ; addr[1 ] = (address >>16 ) &SBSDIO_SBADDRMID_MASK ; addr[2 ] = (address >>24 ) &SBSDIO_SBADDRHIGH_MASK ;
@@ -429,6 +438,7 @@ static int brcmf_sdiod_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn, bool write, u32 addr, struct sk_buff *pkt) { unsigned int req_sz; +int err;brcmf_sdiod_pm_resume_wait (sdiodev, &sdiodev->request_buffer_wait);if (brcmf_sdiod_pm_resume_error (sdiodev))
@@ -439,18 +449,18 @@ static int brcmf_sdiod_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn, req_sz &= (uint )~3 ;if (write) -return sdio_memcpy_toio (sdiodev->func[fn], addr, - ((u8 *)(pkt->data)), - req_sz); + err =sdio_memcpy_toio (sdiodev->func[fn], addr, + ((u8 *)(pkt->data)), req_sz);else if (fn ==1 ) -return sdio_memcpy_fromio (sdiodev->func[fn], - ((u8 *)(pkt->data)), - addr, req_sz); + err =sdio_memcpy_fromio (sdiodev->func[fn], ((u8 *)(pkt->data)), + addr, req_sz);else /* function 2 read is FIFO operation */ -return sdio_readsb (sdiodev->func[fn], - ((u8 *)(pkt->data)), addr, - req_sz); + err =sdio_readsb (sdiodev->func[fn], ((u8 *)(pkt->data)), addr, + req_sz); +if (err == -ENOMEDIUM ) +brcmf_bus_change_state (sdiodev->bus_if,BRCMF_BUS_NOMEDIUM ); +return err; }/**
@@ -593,7 +603,11 @@ static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn,mmc_wait_for_req (sdiodev->func[fn]->card->host, &mmc_req); ret = mmc_cmd.error ? mmc_cmd.error : mmc_dat.error; -if (ret !=0 ) { +if (ret == -ENOMEDIUM ) { +brcmf_bus_change_state (sdiodev->bus_if, +BRCMF_BUS_NOMEDIUM ); +break ; + }else if (ret !=0 ) {brcmf_err ("CMD53 sg block %s failed %d\n" , write ?"write" :"read" , ret); ret = -EIO ;
@@ -852,8 +866,6 @@ int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn)static int brcmf_sdiod_remove (struct brcmf_sdio_dev *sdiodev) { - sdiodev->bus_if->state =BRCMF_BUS_DOWN ; -if (sdiodev->bus) {brcmf_sdio_remove (sdiodev->bus); sdiodev->bus =NULL ;
drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +21 -0
@@ -17,8 +17,12 @@#ifndef _BRCMF_BUS_H_#define _BRCMF_BUS_H_ +#include "dhd_dbg.h" +/* The level of bus communication with the dongle */ enum brcmf_bus_state { +BRCMF_BUS_UNKNOWN ,/* Not determined yet */ +BRCMF_BUS_NOMEDIUM ,/* No medium access to dongle */ BRCMF_BUS_DOWN ,/* Not ready for frame transfers */ BRCMF_BUS_LOAD ,/* Download access only (CPU reset) */ BRCMF_BUS_DATA /* Ready for frame transfers */
@@ -144,6 +148,23 @@ struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus)return bus->ops->gettxq (bus->dev); } + +static inline bool brcmf_bus_ready (struct brcmf_bus *bus) +{ +return bus->state ==BRCMF_BUS_LOAD || bus->state ==BRCMF_BUS_DATA ; +} + +static inline void brcmf_bus_change_state (struct brcmf_bus *bus, +enum brcmf_bus_state new_state) +{ +/* NOMEDIUM is permanent */ +if (bus->state ==BRCMF_BUS_NOMEDIUM ) +return ; + +brcmf_dbg (TRACE ,"%d -> %d\n" , bus->state, new_state); + bus->state = new_state; +} +/* * interface functions from common layer */
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +3 -1
@@ -934,7 +934,7 @@ int brcmf_bus_start(struct device *dev) p2p_ifp =NULL ;/* signal bus ready */ - bus_if->state =BRCMF_BUS_DATA ; +brcmf_bus_change_state (bus_if,BRCMF_BUS_DATA );/* Bus is ready, do any initialization */ ret =brcmf_c_preinit_dcmds (ifp);
@@ -1029,6 +1029,8 @@ void brcmf_detach(struct device *dev)/* stop firmware event handling */ brcmf_fweh_detach (drvr); +brcmf_bus_change_state (bus_if,BRCMF_BUS_DOWN ); +/* make sure primary interface removed last */ for (i =BRCMF_MAX_IFS -1 ; i >-1 ; i--)if (drvr->iflist[i]) {
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +50 -70
205 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/usb.c +2 -2
@@ -522,10 +522,10 @@ brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state)/* update state of upper layer */ if (state ==BRCMFMAC_USB_STATE_DOWN ) {brcmf_dbg (USB ,"DBUS is down\n" ); - bcmf_bus->state =BRCMF_BUS_DOWN ; +brcmf_bus_change_state (bcmf_bus,BRCMF_BUS_DOWN ); }else if (state ==BRCMFMAC_USB_STATE_UP ) {brcmf_dbg (USB ,"DBUS is up\n" ); - bcmf_bus->state =BRCMF_BUS_DATA ; +brcmf_bus_change_state (bcmf_bus,BRCMF_BUS_DATA ); }else {brcmf_dbg (USB ,"DBUS current state=%d\n" , state); }
Signature · 1 line
1.7.10.4
cover brcmfmac: cleanup work for 3.14
Here a small series of patches that hopefully can make it for the 3.14 merge window. Most changes are on correcting chip core access on SDIO devices.
The series applies to the master branch of the wireless-next repository.
Arend van Spriel (6):
bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
brcmfmac: rework firmware download code
brcmfmac: restructure brcmf_sdio_chip_recognition()
brcmfmac: rename chip and core related structures
brcmfmac: initialize escan function pointer during scheduled scan
brcmfmac: handle SDIO card removal
Hante Meuleman (2):
brcmfmac: Create common nvram parsing routines.
brcmfmac: update core reset and disable routines.
drivers/net/wireless/brcm80211/brcmfmac/Makefile | 1 + drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 40 +- drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | 21 + .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 4 +- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 339 +++++------ drivers/net/wireless/brcm80211/brcmfmac/nvram.c | 94 ++++ drivers/net/wireless/brcm80211/brcmfmac/nvram.h | 24 + .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 593 +++++++++----------- .../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 31 +- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 4 +- .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 1 + include/linux/bcma/bcma_regs.h | 5 +- 12 files changed, 608 insertions(+), 549 deletions(-) create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/nvram.c create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/nvram.h
Signature · 1 line
1.7.10.4
PATCH 4/8 brcmfmac: rework firmware download code
The firmware download code has been restructured so the reset vector does not need to be stored in a structure, but keep it on the stack to be passed to exit download function.
--- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 87 ++++++++------------ .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 11 +-- .../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 2 +- 3 files changed, 40 insertions(+), 60 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +33 -54
@@ -3192,30 +3192,6 @@ brcmf_sdio_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)return rxlen ? (int )rxlen : -ETIMEDOUT ; } -static bool brcmf_sdio_download_state (struct brcmf_sdio *bus,bool enter) -{ -struct chip_info *ci = bus->ci; - -/* To enter download state, disable ARM and reset SOCRAM. -* To exit download state, simply reset ARM (default is RAM boot). -*/ -if (enter) { - bus->alp_only = true; - -brcmf_sdio_chip_enter_download (bus->sdiodev, ci); - }else { -if (!brcmf_sdio_chip_exit_download (bus->sdiodev, ci)) -return false; - -/* Allow HT Clock now that the ARM is running. */ - bus->alp_only = false; - - bus->sdiodev->bus_if->state =BRCMF_BUS_LOAD ; - } - -return true; -} -#ifdef DEBUG static bool brcmf_sdio_verifymemory(struct brcmf_sdio_dev *sdiodev, u32 ram_addr,
@@ -3270,9 +3246,9 @@ brcmf_sdio_verifymemory(struct brcmf_sdio_dev *sdiodev, u32 ram_addr, }#endif /* DEBUG */ -static int brcmf_sdio_download_code_file (struct brcmf_sdio *bus) +static int brcmf_sdio_download_code_file (struct brcmf_sdio *bus, +const struct firmware *fw) { -const struct firmware *fw;int err;int offset;int address;
@@ -3280,14 +3256,6 @@ static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus)brcmf_dbg (TRACE ,"Enter\n" ); - fw =brcmf_sdio_get_fw (bus,BRCMF_FIRMWARE_BIN ); -if (fw ==NULL ) -return -ENOENT ; - -if (brcmf_sdio_chip_getinfidx (bus->ci,BCMA_CORE_ARM_CR4 ) != -BRCMF_MAX_CORENUM ) -memcpy (&bus->ci->rst_vec, fw->data,sizeof (bus->ci->rst_vec)); - err =0 ; offset =0 ; address = bus->ci->rambase;
@@ -3299,7 +3267,7 @@ static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus)if (err) {brcmf_err ("error %d on writing %d membytes at 0x%08x\n" , err, len, address); - goto failure; +return err; } offset += len; address += len;
@@ -3309,15 +3277,12 @@ static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus) (u8 *)fw->data, fw->size)) err = -EIO ; -failure: -release_firmware (fw); -return err; } -static int brcmf_sdio_download_nvram (struct brcmf_sdio *bus) +static int brcmf_sdio_download_nvram (struct brcmf_sdio *bus, +const struct firmware *nv) { -const struct firmware *nv;void *vars;u32 varsz;int address;
@@ -3325,12 +3290,7 @@ static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus)brcmf_dbg (TRACE ,"Enter\n" ); - nv =brcmf_sdio_get_fw (bus,BRCMF_FIRMWARE_NVRAM ); -if (nv ==NULL ) -return -ENOENT ; - vars =brcmf_nvram_strip (nv, &varsz); -release_firmware (nv);if (vars ==NULL )return -EINVAL ;
@@ -3351,33 +3311,52 @@ static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus)static int brcmf_sdio_download_firmware (struct brcmf_sdio *bus) {int bcmerror = -EFAULT ; - +const struct firmware *fw; +u32 rstvec;sdio_claim_host (bus->sdiodev->func[1 ]);brcmf_sdio_clkctl (bus,CLK_AVAIL , false);/* Keep arm in reset */ -if (!brcmf_sdio_download_state (bus, true)) { -brcmf_err ("error placing ARM core in reset\n" ); +brcmf_sdio_chip_enter_download (bus->sdiodev, bus->ci); + + fw =brcmf_sdio_get_fw (bus,BRCMF_FIRMWARE_BIN ); +if (fw ==NULL ) { + bcmerror = -ENOENT ; goto err; } -if (brcmf_sdio_download_code_file (bus)) { + rstvec =get_unaligned_le32 (fw->data); +brcmf_dbg (SDIO ,"firmware rstvec: %x\n" , rstvec); + + bcmerror =brcmf_sdio_download_code_file (bus, fw); +release_firmware (fw); +if (bcmerror) {brcmf_err ("dongle image file download failed\n" ); goto err; } -if (brcmf_sdio_download_nvram (bus)) { + fw =brcmf_sdio_get_fw (bus,BRCMF_FIRMWARE_NVRAM ); +if (fw ==NULL ) { + bcmerror = -ENOENT ; + goto err; + } + + bcmerror =brcmf_sdio_download_nvram (bus, fw); +release_firmware (fw); +if (bcmerror) {brcmf_err ("dongle nvram file download failed\n" ); goto err; }/* Take arm out of reset */ -if (!brcmf_sdio_download_state (bus, false)) { +if (!brcmf_sdio_chip_exit_download (bus->sdiodev, bus->ci, rstvec)) {brcmf_err ("error getting out of ARM core reset\n" ); goto err; } +/* Allow HT Clock now that the ARM is running. */ + bus->sdiodev->bus_if->state =BRCMF_BUS_LOAD ; bcmerror =0 ; err:
@@ -3566,9 +3545,11 @@ static int brcmf_sdio_bus_init(struct device *dev)/* try to download image and nvram to the dongle */ if (bus_if->state ==BRCMF_BUS_DOWN ) { + bus->alp_only = true; err =brcmf_sdio_download_firmware (bus);if (err)return err; + bus->alp_only = false; }if (!bus->sdiodev->bus_if->drvr)
@@ -3778,8 +3759,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdio *bus)u32 reg_val;u32 drivestrength; - bus->alp_only = true; -sdio_claim_host (bus->sdiodev->func[1 ]); pr_debug("F1 signature read @0x18000000=0x%4x\n",
@@ -4088,7 +4067,7 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus)* essentially resets all necessary cores */ msleep (20 ); -brcmf_sdio_download_state (bus, true); +brcmf_sdio_chip_enter_download (bus->sdiodev, bus->ci);brcmf_sdio_clkctl (bus,CLK_NONE , false);sdio_release_host (bus->sdiodev->func[1 ]);brcmf_sdio_chip_detach (&bus->ci);
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +6 -5
@@ -917,7 +917,8 @@ brcmf_sdio_chip_cr4_enterdl(struct brcmf_sdio_dev *sdiodev, }static bool -brcmf_sdio_chip_cr4_exitdl (struct brcmf_sdio_dev *sdiodev,struct chip_info *ci) +brcmf_sdio_chip_cr4_exitdl (struct brcmf_sdio_dev *sdiodev,struct chip_info *ci, +u32 rstvec) {u8 core_idx;u32 reg_addr;
@@ -929,8 +930,8 @@ brcmf_sdio_chip_cr4_exitdl(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci)brcmf_sdiod_regwl (sdiodev, reg_addr,0xFFFFFFFF ,NULL );/* Write reset vector to address 0 */ -brcmf_sdiod_ramrw (sdiodev, true,0 , (void *)&ci->rst_vec, -sizeof (ci->rst_vec)); +brcmf_sdiod_ramrw (sdiodev, true,0 , (void *)&rstvec, +sizeof (rstvec));/* restore ARM */ ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CR4, BCMA_IOCTL_ARMCR4_HALT,
@@ -954,7 +955,7 @@ void brcmf_sdio_chip_enter_download(struct brcmf_sdio_dev *sdiodev, }bool brcmf_sdio_chip_exit_download (struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci) +struct chip_info *ci,u32 rstvec) {u8 arm_core_idx;
@@ -962,5 +963,5 @@ bool brcmf_sdio_chip_exit_download(struct brcmf_sdio_dev *sdiodev,if (BRCMF_MAX_CORENUM != arm_core_idx)return brcmf_sdio_chip_cm3_exitdl (sdiodev, ci); -return brcmf_sdio_chip_cr4_exitdl (sdiodev, ci); +return brcmf_sdio_chip_cr4_exitdl (sdiodev, ci, rstvec); }
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +1 -1
@@ -226,6 +226,6 @@ u8 brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid);void brcmf_sdio_chip_enter_download (struct brcmf_sdio_dev *sdiodev,struct chip_info *ci);bool brcmf_sdio_chip_exit_download (struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci); +struct chip_info *ci,u32 rstvec);#endif /* _BRCMFMAC_SDIO_CHIP_H_ */
Signature · 1 line
1.7.10.4
PATCH 3/8 bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
In reply to Arend van SprielThe IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
--- .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 22 +++++++------------- include/linux/bcma/bcma_regs.h | 5 ++++- 2 files changed, 12 insertions(+), 15 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +8 -14
@@ -66,13 +66,6 @@#define CIB_REV_MASK 0xff000000#define CIB_REV_SHIFT 24 -/* ARM CR4 core specific control flag bits */ -#define ARMCR4_BCMA_IOCTL_CPUHALT 0x0020 - -/* D11 core specific control flag bits */ -#define D11_BCMA_IOCTL_PHYCLOCKEN 0x0004 -#define D11_BCMA_IOCTL_PHYRESET 0x0008 -#define SDIOD_DRVSTR_KEY (chip, pmu) (((chip) << 16) | (pmu))/* SDIO Pad drive strength to select value mappings */ struct sdiod_drive_str {
@@ -873,8 +866,8 @@ brcmf_sdio_chip_cm3_enterdl(struct brcmf_sdio_dev *sdiodev, { ci->coredisable (sdiodev, ci,BCMA_CORE_ARM_CM3 ,0 ,0 ); ci->resetcore (sdiodev, ci,BCMA_CORE_80211 , -D11_BCMA_IOCTL_PHYRESET |D11_BCMA_IOCTL_PHYCLOCKEN , -D11_BCMA_IOCTL_PHYCLOCKEN ,D11_BCMA_IOCTL_PHYCLOCKEN ); +BCMA_IOCTL_80211_PHYCLOCKEN |BCMA_IOCTL_80211_PHYRESET , +BCMA_IOCTL_80211_PHYCLOCKEN ,BCMA_IOCTL_80211_PHYCLOCKEN ); ci->resetcore (sdiodev, ci,BCMA_CORE_INTERNAL_MEM ,0 ,0 ,0 ); }
@@ -913,13 +906,14 @@ brcmf_sdio_chip_cr4_enterdl(struct brcmf_sdio_dev *sdiodev,return ; wrapbase = ci->c_inf[idx].wrapbase; +/* clear all IOCTL bits except HALT bit */ regdata =brcmf_sdiod_regrl (sdiodev, wrapbase +BCMA_IOCTL ,NULL ); - regdata &=ARMCR4_BCMA_IOCTL_CPUHALT ; + regdata &=BCMA_IOCTL_ARMCR4_HALT ; ci->resetcore (sdiodev, ci,BCMA_CORE_ARM_CR4 , regdata, -ARMCR4_BCMA_IOCTL_CPUHALT ,ARMCR4_BCMA_IOCTL_CPUHALT ); +BCMA_IOCTL_ARMCR4_HALT ,BCMA_IOCTL_ARMCR4_HALT ); ci->resetcore (sdiodev, ci,BCMA_CORE_80211 , -D11_BCMA_IOCTL_PHYRESET |D11_BCMA_IOCTL_PHYCLOCKEN , -D11_BCMA_IOCTL_PHYCLOCKEN ,D11_BCMA_IOCTL_PHYCLOCKEN ); +BCMA_IOCTL_80211_PHYCLOCKEN |BCMA_IOCTL_80211_PHYRESET , +BCMA_IOCTL_80211_PHYCLOCKEN ,BCMA_IOCTL_80211_PHYCLOCKEN ); } static bool
@@ -939,7 +933,7 @@ brcmf_sdio_chip_cr4_exitdl(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci) sizeof(ci->rst_vec));/* restore ARM */ - ci->resetcore (sdiodev, ci,BCMA_CORE_ARM_CR4 ,ARMCR4_BCMA_IOCTL_CPUHALT , + ci->resetcore (sdiodev, ci,BCMA_CORE_ARM_CR4 ,BCMA_IOCTL_ARMCR4_HALT ,0 ,0 );return true;
include/linux/bcma/bcma_regs.h +4 -1
@@ -22,10 +22,13 @@#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000/* 4328a0 has reversed bits */ #define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000/* 4328a0 has reversed bits */ -/* Agent registers (common for every core) */ +/* Agent registers (common unless indicated) */ #define BCMA_IOCTL 0x0408/* IO control */ #define BCMA_IOCTL_CLK 0x0001#define BCMA_IOCTL_FGC 0x0002 +#define BCMA_IOCTL_80211_PHYCLOCKEN 0x0004/* for 80211 core */ +#define BCMA_IOCTL_80211_PHYRESET 0x0008/* for 80211 core */ +#define BCMA_IOCTL_ARMCR4_HALT 0x0020/* for ARM CR4 core */ #define BCMA_IOCTL_CORE_BITS 0x3FFC#define BCMA_IOCTL_PME_EN 0x4000#define BCMA_IOCTL_BIST_EN 0x8000
Signature · 1 line
1.7.10.4
PATCH 6/8 brcmfmac: rename chip and core related structures
In reply to Arend van Spriel--- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 2 +- .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 54 ++++++++++---------- .../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 27 +++++----- 3 files changed, 41 insertions(+), 42 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +1 -1
@@ -369,7 +369,7 @@ struct brcmf_sdio_hdrinfo {/* Private data for SDIO bus interaction */ struct brcmf_sdio {struct brcmf_sdio_dev *sdiodev;/* sdio device handler */ -struct chip_info *ci;/* Chip info struct */ +struct brcmf_chip *ci;/* Chip info struct */ u32 ramsize;/* Size of RAM in SOCRAM (bytes) */
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +26 -28
191 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +14 -13
@@ -54,7 +54,7 @@#define BRCMF_MAX_CORENUM 6 -struct chip_core_info { +struct brcmf_core {u16 id;u16 rev;u32 base;
@@ -63,27 +63,27 @@ struct chip_core_info {u32 cib; }; -struct chip_info { +struct brcmf_chip {u32 chip;u32 chiprev;/* core info */ /* always put chipcommon core at 0, bus core at 1 */ -struct chip_core_info c_inf[BRCMF_MAX_CORENUM ]; +struct brcmf_core c_inf[BRCMF_MAX_CORENUM ];u32 pmurev;u32 pmucaps;u32 ramsize;u32 rambase;u32 rst_vec;/* reset vertor for ARM CR4 core */ -bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev,struct chip_info *ci, +bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev,struct brcmf_chip *ci,u16 coreid); -u32 (*corerev)(struct brcmf_sdio_dev *sdiodev,struct chip_info *ci, +u32 (*corerev)(struct brcmf_sdio_dev *sdiodev,struct brcmf_chip *ci,u16 coreid);void (*coredisable)(struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,u16 coreid,u32 pre_resetbits, +struct brcmf_chip *ci,u16 coreid,u32 pre_resetbits,u32 in_resetbits);void (*resetcore)(struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,u16 coreid,u32 pre_resetbits, +struct brcmf_chip *ci,u16 coreid,u32 pre_resetbits,u32 in_resetbits,u32 post_resetbits); };
@@ -217,14 +217,15 @@ struct sdpcmd_regs { };int brcmf_sdio_chip_attach (struct brcmf_sdio_dev *sdiodev, -struct chip_info **ci_ptr); -void brcmf_sdio_chip_detach (struct chip_info **ci_ptr); +struct brcmf_chip **ci_ptr); +void brcmf_sdio_chip_detach (struct brcmf_chip **ci_ptr);void brcmf_sdio_chip_drivestrengthinit (struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,u32 drivestrength); -u8 brcmf_sdio_chip_getinfidx (struct chip_info *ci,u16 coreid); +struct brcmf_chip *ci, +u32 drivestrength); +u8 brcmf_sdio_chip_getinfidx (struct brcmf_chip *ci,u16 coreid);void brcmf_sdio_chip_enter_download (struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci); +struct brcmf_chip *ci);bool brcmf_sdio_chip_exit_download (struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,u32 rstvec); +struct brcmf_chip *ci,u32 rstvec);#endif /* _BRCMFMAC_SDIO_CHIP_H_ */
Signature · 1 line
1.7.10.4
PATCH 2/8 brcmfmac: update core reset and disable routines.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
The original core reset and disable routines do not work always on running system. These routines were updated to properly reset a core. When module is unloaded the device is put into download state where all necessary cores have been reset. This will make sure the device is in idle mode after module unload.
--- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 8 +- .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 149 +++++++++++++------- .../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 6 +- 3 files changed, 106 insertions(+), 57 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +6 -2
@@ -2263,8 +2263,6 @@ static void brcmf_sdio_bus_stop(struct device *dev)w_sdreg32 (bus, local_hostintmask, offsetof(struct sdpcmd_regs , intstatus)); -/* Turn off the backplane clock (only) */ -brcmf_sdio_clkctl (bus,CLK_SDONLY , false);sdio_release_host (bus->sdiodev->func[1 ]);/* Clear the data packet queues */
@@ -4085,6 +4083,12 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus)if (bus->ci) {sdio_claim_host (bus->sdiodev->func[1 ]);brcmf_sdio_clkctl (bus,CLK_AVAIL , false); +/* Leave the device in state where it is 'quiet'. This +* is done by putting it in download_state which +* essentially resets all necessary cores +*/ +msleep (20 ); +brcmf_sdio_download_state (bus, true);brcmf_sdio_clkctl (bus,CLK_NONE , false);sdio_release_host (bus->sdiodev->func[1 ]);brcmf_sdio_chip_detach (&bus->ci);
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +96 -53
294 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +4 -2
@@ -81,9 +81,11 @@ struct chip_info {u32 (*corerev)(struct brcmf_sdio_dev *sdiodev,struct chip_info *ci,u16 coreid);void (*coredisable)(struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,u16 coreid,u32 core_bits); +struct chip_info *ci,u16 coreid,u32 pre_resetbits, +u32 in_resetbits);void (*resetcore)(struct brcmf_sdio_dev *sdiodev, -struct chip_info *ci,u16 coreid,u32 core_bits); +struct chip_info *ci,u16 coreid,u32 pre_resetbits, +u32 in_resetbits,u32 post_resetbits); };struct sbconfig {
Signature · 1 line
1.7.10.4
Rafał Miłecki
maintainerRe: [PATCH 3/8] bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
In reply to Arend van Spriel2014/1/13 Arend van Spriel <[email protected]>:
Quoted 2 lines
The IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
I'm not sure about this. I don't think we want to keep device-specific bits in a commond (bcma's) code.
For example, I can't see PCI defines (like linux/pci_regs.h) having any device specific bits in this shared code.
Our case with bcma is a bit more tricky, because we have a single register with common and device-specific bits at the same time. So maybe I'll find another example.
What about USB? Let's say linux/usb/ch9.h. There is a struct usb_ctrlrequest that has bRequestType and bRequest. bRequestType accepts some common values like USB_DIR_IN, USB_RECIP_INTERFACE, etc. They are defined in the same file. bRequest values are device-specific and you don't have them defined in the above file.
That makes pretty much sense for me.
Re: [PATCH 3/8] bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
Quoted 6 lines · Rafał Miłecki
2014/1/13 Arend van Spriel <[email protected]>:
Quoted 2 lines
The IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
I'm not sure about this. I don't think we want to keep device-specific bits in a commond (bcma's) code.
True. We can put these in brcm80211 includes so both brcmfmac and brcmsmac can use it. That said the bcma_core_disable() and bcma_core_enable() do need to be corrected to be reliable. Patch #2 in this series show what needs to be changed.
Regards,
Arend
Quoted 19 lines
For example, I can't see PCI defines (like
linux/pci_regs.h) having any device specific bits in this shared code.Our case with bcma is a bit more tricky, because we have a single register with common and device-specific bits at the same time. So maybe I'll find another example.
What about USB? Let's say
linux/usb/ch9.h. There is a structusb_ctrlrequestthat has bRequestType and bRequest.
bRequestType accepts some common values likeUSB_DIR_IN,USB_RECIP_INTERFACE, etc. They are defined in the same file. bRequest values are device-specific and you don't have them defined in the above file.
That makes pretty much sense for me.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Rafał Miłecki
maintainerRe: [PATCH 3/8] bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
2014/1/14 Arend van Spriel <[email protected]>:
Quoted 5 lines · Rafał Miłecki
Quoted 4 lines
2014/1/13 Arend van Spriel <[email protected]>:
Quoted 2 lines
The IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
Quoted 7 lines
Quoted 2 lines
I'm not sure about this. I don't think we want to keep device-specific bits in a commond (bcma's) code.
True. We can put these in brcm80211 includes so both brcmfmac and brcmsmac can use it. That said the
bcma_core_disable()andbcma_core_enable()do need to be corrected to be reliable. Patch #2 in this series show what needs to be changed.
I'm looking at
[PATCH 2/8] brcmfmac: update core reset and disable routines. and it's unclear for me, what needs to be changed in bcma_core_[enable|disable]. Could you specify, please?
Re: [PATCH 3/8] bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
In reply to Rafał MiłeckiQuoted 6 lines · Rafał Miłecki
2014/1/13 Arend van Spriel <[email protected]>:
Quoted 2 lines
The IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
I'm not sure about this. I don't think we want to keep device-specific bits in a commond (bcma's) code.
Hi John,
Given that I agree with Rafał's argument, can you drop patch #3 from this series. I applied the other patches using 'git am -3' and that works. Let me know if I should resend them.
Gr. AvS
Quoted 19 lines
For example, I can't see PCI defines (like
linux/pci_regs.h) having any device specific bits in this shared code.Our case with bcma is a bit more tricky, because we have a single register with common and device-specific bits at the same time. So maybe I'll find another example.
What about USB? Let's say
linux/usb/ch9.h. There is a structusb_ctrlrequestthat has bRequestType and bRequest.
bRequestType accepts some common values likeUSB_DIR_IN,USB_RECIP_INTERFACE, etc. They are defined in the same file. bRequest values are device-specific and you don't have them defined in the above file.
That makes pretty much sense for me.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/8] bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
In reply to Rafał MiłeckiQuoted 14 lines · Rafał Miłecki
2014/1/14 Arend van Spriel <[email protected]>:
Quoted 5 lines · Rafał Miłecki
Quoted 4 lines
2014/1/13 Arend van Spriel <[email protected]>:
Quoted 2 lines
The IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
Quoted 7 lines
Quoted 2 lines
I'm not sure about this. I don't think we want to keep device-specific bits in a commond (bcma's) code.
True. We can put these in brcm80211 includes so both brcmfmac and brcmsmac can use it. That said the
bcma_core_disable()andbcma_core_enable()do need to be corrected to be reliable. Patch #2 in this series show what needs to be changed.
Quoted 4 lines
I'm looking at
[PATCH 2/8] brcmfmac: update core reset and disable routines. and it's unclear for me, what needs to be changed in bcma_core_[enable|disable]. Could you specify, please?
Basically, the whole sequence in bcma_core_enable() and disable() is derived from aiutils.c in the original brcmsmac mainline patch (or at least it has very, very close resemblance). It turned out this sequence was cooked up by software devs, but the hardware documentation states another sequence, which is what Patch #2 implements. For this it needs additional parameters. You know what, I will create a patch for this.
Gr. AvS
Re: [PATCH 3/8] bcma: add agent IOCTL bit values for Broadcom 802.11 and CR4 cores
In reply to Arend van SprielQuoted 8 lines · Arend van Spriel
Quoted 6 lines · Rafał Miłecki
2014/1/13 Arend van Spriel <[email protected]>:
Quoted 2 lines
The IOCTL register in the agent/wrapper contains additional bits that are core specific and use in the core reset sequence.
I'm not sure about this. I don't think we want to keep device-specific bits in a commond (bcma's) code.
Quoted 7 lines
Hi John,
Given that I agree with Rafał's argument, can you drop patch #3 from this series. I applied the other patches using 'git am -3' and that works. Let me know if I should resend them.
Gr. AvS
OK.
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.