brcm80211: fullmac 4430 support and softmac switch to bcma
PATCH 2/23 brcm80211: fmac: fix firmware shared structures version
In reply to Franky LinSome shared structures in fullmac have a wrong combination of version number and declarations. This patch fixes it by upgrading them to the latest version. This allows brcmfmac to support new firmwares with new features.
--- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 2 +- drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd.h +1 -1
@@ -87,7 +87,7 @@#define TOE_TX_CSUM_OL 0x00000001#define TOE_RX_CSUM_OL 0x00000002 -#define BRCMF_BSS_INFO_VERSION 108/* curr ver of brcmf_bss_info_le struct */ +#define BRCMF_BSS_INFO_VERSION 109/* curr ver of brcmf_bss_info_le struct */ /* size of brcmf_scan_params not including variable length array */ #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c +3 -3
@@ -58,7 +58,7 @@ struct brcmf_proto_cdc_dcmd {* Used on data packets to convey priority across USB. */ #define BDC_HEADER_LEN 4 -#define BDC_PROTO_VER 1/* Protocol version */ +#define BDC_PROTO_VER 2/* Protocol version */ #define BDC_FLAG_VER_MASK 0xf0/* Protocol version mask */ #define BDC_FLAG_VER_SHIFT 4/* Protocol version shift */ #define BDC_FLAG_SUM_GOOD 0x04/* Good RX checksums */
@@ -77,7 +77,7 @@ struct brcmf_proto_bdc_header {u8 flags;u8 priority;/* 802.1d Priority, 4:7 flow control info for usb */ u8 flags2; -u8 rssi; +u8 data_offset; };
@@ -372,7 +372,7 @@ void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx, h->priority = (pktbuf->priority &BDC_PRIORITY_MASK ); h->flags2 =0 ; - h->rssi =0 ; + h->data_offset =0 ;BDC_SET_IF_IDX (h, ifidx); }
Signature · 1 line
1.7.5.4
cover brcm80211: fullmac 4430 support and softmac switch to bcma
This train contains patches enable the support for bcm4330 for fullmac and part of the patch series of switching to bcma bus interface for softmac.
Arend van Spriel (19):
bcma: add set/mask macros for 16-bit register access
bcma: use static keyword for inline function declaration in bcma.h
brcm80211: smac: remove unused fields from struct si_pub definition
brcm80211: smac: move fields from struct si_pub to struct si_info
brcm80211: smac: use inline access functions for struct si_pub fields
brcm80211: smac: change from pci device driver to bcma device driver
brcm80211: smac: change attach interfaces in main.c for bcma support
brcm80211: smac: rename struct si_info field pbus to pcibus
brcm80211: smac: change ai_attach interface taking a bcma_bus object
brcm80211: smac: remove enumeration rom parsing function
brcm80211: smac: use bcma core register access functions for 802.11
core
brcm80211: smac: use DMA-API calls for descriptor allocations
brcm80211: smac: use bcma function for register access in dma.c
brcm80211: smac: use bcma functions for register access in phy code
brcm80211: smac: remove SI_FAST() macro usage
brcm80211: smac: replace ai_corereg() function with ai_cc_reg()
brcm80211: smac: remove unused functions and/or prototypes
brcm80211: smac: use bcma core control functions
brcm80211: smac: use bcma core access functions in nicpci.c
Franky Lin (4):
brcm80211: fmac: save bus interface structure in function 2 device
brcm80211: fmac: fix firmware shared structures version
brcm80211: fmac: add bcm4330 support
brcm80211: fmac: remove drive strength code for unsupported chips
drivers/net/wireless/brcm80211/Kconfig | 3 +- drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 3 +- .../net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 25 +- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 2 +- drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c | 6 +- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 2 + .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 74 +- .../net/wireless/brcm80211/brcmfmac/sdio_host.h | 1 + drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 873 ++++---------------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 100 ++- drivers/net/wireless/brcm80211/brcmsmac/ampdu.c | 7 +- drivers/net/wireless/brcm80211/brcmsmac/d11.h | 3 + drivers/net/wireless/brcm80211/brcmsmac/dma.c | 220 +++--- drivers/net/wireless/brcm80211/brcmsmac/dma.h | 9 +- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 166 ++--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.h | 2 - drivers/net/wireless/brcm80211/brcmsmac/main.c | 676 ++++++++-------- drivers/net/wireless/brcm80211/brcmsmac/main.h | 4 +- drivers/net/wireless/brcm80211/brcmsmac/nicpci.c | 238 +++--- drivers/net/wireless/brcm80211/brcmsmac/nicpci.h | 11 +- drivers/net/wireless/brcm80211/brcmsmac/otp.c | 20 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 225 +++--- .../net/wireless/brcm80211/brcmsmac/phy/phy_hal.h | 4 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_int.h | 6 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 69 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c | 81 +- drivers/net/wireless/brcm80211/brcmsmac/pmu.c | 48 +- drivers/net/wireless/brcm80211/brcmsmac/pub.h | 6 +- drivers/net/wireless/brcm80211/brcmsmac/srom.c | 4 +- drivers/net/wireless/brcm80211/brcmsmac/types.h | 3 + include/linux/bcma/bcma.h | 55 +- 31 files changed, 1184 insertions(+), 1762 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/23 brcm80211: fmac: save bus interface structure in function 2 device
bus interface was stored in sdio card device. The device pointer is used as parameter of interface functions between common layer and bus layer to make the function declaration generic for different bus type. But the card device is a parent device layer for SDIO function devices. It doesn't contain all contexts needed by udev. This patch moves the shared structure to private driver data pointer of SDIO function 2 device which is more appopriate for net device and cfg80211 registration.
--- drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 3 +- .../net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 23 +++++++++---------- .../net/wireless/brcm80211/brcmfmac/sdio_host.h | 1 + 3 files changed, 13 insertions(+), 14 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +1 -2
@@ -40,8 +40,7 @@static void brcmf_sdioh_irqhandler (struct sdio_func *func) { -struct brcmf_bus *bus_if =dev_get_drvdata (&func->card->dev); -struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv; +struct brcmf_sdio_dev *sdiodev =dev_get_drvdata (&func->card->dev);brcmf_dbg (TRACE ,"***IRQHandler\n" );
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +11 -12
@@ -481,12 +481,12 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,kfree (bus_if);return -ENOMEM ; } - sdiodev->dev = &func->card->dev; sdiodev->func[0 ] = func->card->sdio_func[0 ]; sdiodev->func[1 ] = func; + sdiodev->bus_if = bus_if; bus_if->bus_priv = sdiodev; bus_if->type =SDIO_BUS ; -dev_set_drvdata (&func->card->dev, bus_if); +dev_set_drvdata (&func->card->dev, sdiodev);atomic_set (&sdiodev->suspend, false);init_waitqueue_head (&sdiodev->request_byte_wait);
@@ -496,12 +496,15 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, }if (func->num ==2 ) { - bus_if =dev_get_drvdata (&func->card->dev); - sdiodev = bus_if->bus_priv; + sdiodev =dev_get_drvdata (&func->card->dev);if ((!sdiodev) || (sdiodev->func[1 ]->card != func->card))return -ENODEV ; sdiodev->func[2 ] = func; + bus_if = sdiodev->bus_if; + sdiodev->dev = &func->dev; +dev_set_drvdata (&func->dev, bus_if); +brcmf_dbg (TRACE ,"F2 found, calling brcmf_sdio_probe...\n" ); ret =brcmf_sdio_probe (sdiodev); }
@@ -520,11 +523,12 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func)brcmf_dbg (INFO ,"Function#: 0x%04x\n" , func->num);if (func->num ==2 ) { - bus_if =dev_get_drvdata (&func->card->dev); + bus_if =dev_get_drvdata (&func->dev); sdiodev = bus_if->bus_priv;brcmf_dbg (TRACE ,"F2 found, calling brcmf_sdio_remove...\n" );brcmf_sdio_remove (sdiodev);dev_set_drvdata (&func->card->dev,NULL ); +dev_set_drvdata (&func->dev,NULL );kfree (bus_if);kfree (sdiodev); }
@@ -534,15 +538,12 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func)static int brcmf_sdio_suspend (struct device *dev) {mmc_pm_flag_t sdio_flags; -struct brcmf_sdio_dev *sdiodev;struct sdio_func *func =dev_to_sdio_func (dev); -struct brcmf_bus *bus_if =dev_get_drvdata (&func->card->dev); +struct brcmf_sdio_dev *sdiodev =dev_get_drvdata (&func->card->dev);int ret =0 ;brcmf_dbg (TRACE ,"\n" ); - sdiodev = bus_if->bus_priv; -atomic_set (&sdiodev->suspend, true); sdio_flags =sdio_get_host_pm_caps (sdiodev->func[1 ]);
@@ -564,11 +565,9 @@ static int brcmf_sdio_suspend(struct device *dev)static int brcmf_sdio_resume (struct device *dev) { -struct brcmf_sdio_dev *sdiodev;struct sdio_func *func =dev_to_sdio_func (dev); -struct brcmf_bus *bus_if =dev_get_drvdata (&func->card->dev); +struct brcmf_sdio_dev *sdiodev =dev_get_drvdata (&func->card->dev); - sdiodev = bus_if->bus_priv;brcmf_sdio_wdtmr_enable (sdiodev, true);atomic_set (&sdiodev->suspend, false);return 0 ;
drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h +1 -0
@@ -135,6 +135,7 @@ struct brcmf_sdio_dev {wait_queue_head_t request_chain_wait;wait_queue_head_t request_buffer_wait;struct device *dev; +struct brcmf_bus *bus_if; };/* Register/deregister device interrupt handler. */
Signature · 1 line
1.7.5.4
PATCH 21/23 brcm80211: smac: remove unused functions and/or prototypes
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Several functions provided by aiutils.c are not used in brcmsmac driver and have been removed.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 127 +-------------------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 25 ---- 2 files changed, 1 insertions(+), 151 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +1 -126
@@ -525,75 +525,6 @@ void __iomem *ai_setcoreidx(struct si_pub *sih, uint coreidx)return sii->curmap; } -/* Return the number of address spaces in current core */ -int ai_numaddrspaces (struct si_pub *sih) -{ -return 2 ; -} - -/* Return the address of the nth address space in the current core */ -u32 ai_addrspace (struct si_pub *sih,uint asidx) -{ -struct si_info *sii; -uint cidx; - - sii = (struct si_info *)sih; - cidx = sii->curidx; - -if (asidx ==0 ) -return sii->coresba[cidx]; -else if (asidx ==1 ) -return sii->coresba2[cidx]; -else { -/* Need to parse the erom again to find addr space */ -return 0 ; - } -} - -/* Return the size of the nth address space in the current core */ -u32 ai_addrspacesize (struct si_pub *sih,uint asidx) -{ -struct si_info *sii; -uint cidx; - - sii = (struct si_info *)sih; - cidx = sii->curidx; - -if (asidx ==0 ) -return sii->coresba_size[cidx]; -else if (asidx ==1 ) -return sii->coresba2_size[cidx]; -else { -/* Need to parse the erom again to find addr */ -return 0 ; - } -} - -uint ai_flag (struct si_pub *sih) -{ -struct si_info *sii; -struct aidmp *ai; - - sii = (struct si_info *)sih; - ai = sii->curwrap; - -return R_REG (&ai->oobselouta30) &0x1f ; -} - -void ai_setint (struct si_pub *sih,int siflag) -{ -} - -uint ai_corevendor (struct si_pub *sih) -{ -struct si_info *sii; -u32 cia; - - sii = (struct si_info *)sih; - cia = sii->cia[sii->curidx]; -return (cia &CIA_MFG_MASK ) >>CIA_MFG_SHIFT ; -} -uint ai_corerev (struct si_pub *sih) {struct si_info *sii;
@@ -617,22 +548,6 @@ bool ai_iscoreup(struct si_pub *sih) && ((R_REG(&ai->resetctrl) & AIRC_RESET) == 0)); } -void ai_core_cflags_wo (struct si_pub *sih,u32 mask,u32 val) -{ -struct si_info *sii; -struct aidmp *ai; -u32 w; - - sii = (struct si_info *)sih; - - ai = sii->curwrap; - -if (mask || val) { - w = ((R_REG (&ai->ioctrl) & ~mask) | val); -W_REG (&ai->ioctrl, w); - } -} -u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val) {struct si_info *sii;
@@ -1016,11 +931,6 @@ uint ai_coreidx(struct si_pub *sih)return sii->curidx; } -bool ai_backplane64 (struct si_pub *sih) -{ -return (ai_get_cccaps (sih) &CC_CAP_BKPLN64 ) !=0 ; -} -/* return index of coreid or BADIDX if not found */ uint ai_findcoreidx (struct si_pub *sih,uint coreid,uint coreunit) {
@@ -1085,14 +995,6 @@ void ai_restore_core(struct si_pub *sih, uint coreid, uint intr_val)INTR_RESTORE (sii, intr_val); } -void ai_write_wrapperreg (struct si_pub *sih,u32 offset,u32 val) -{ -struct si_info *sii = (struct si_info *)sih; -u32 *w = (u32 *) sii->curwrap; -W_REG (w + (offset /4 ), val); -return ; -} -/* * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set * operation, switch back to the original core, and return the new value.
@@ -1514,27 +1416,6 @@ bool ai_clkctl_cc(struct si_pub *sih, uint mode)return _ai_clkctl_cc (sii, mode); } -/* Build device path */ -int ai_devpath (struct si_pub *sih,char *path,int size) -{ -int slen; - -if (!path || size <=0 ) -return -1 ; - - slen =snprintf (path, (size_t ) size,"pci/%u/%u/" , - ((struct si_info *)sih)->pcibus->bus->number, -PCI_SLOT (((struct pci_dev *) - (((struct si_info *)(sih))->pcibus))->devfn)); - -if (slen <0 || slen >= size) { - path[0 ] ='\0' ; -return -1 ; - } - -return 0 ; -} -void ai_pci_up (struct si_pub *sih) {struct si_info *sii;
@@ -1581,7 +1462,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask) {struct si_info *sii;struct sbpciregs __iomem *regs =NULL ; -u32 siflag =0 , w; +u32 w;uint idx =0 ; sii = (struct si_info *)sih;
@@ -1590,9 +1471,6 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)/* get current core index */ idx = sii->curidx; -/* we interrupt on this backplane flag number */ - siflag =ai_flag (sih); -/* switch over to pci core */ regs =ai_setcoreidx (sih, sii->buscoreidx); }
@@ -1606,9 +1484,6 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)pci_read_config_dword (sii->pcibus,PCI_INT_MASK , &w); w |= (coremask <<PCI_SBIM_SHIFT );pci_write_config_dword (sii->pcibus,PCI_INT_MASK , w); - }else { -/* set sbintvec bit for our flag number */ -ai_setint (sih, siflag); }if (PCI (sih)) {
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +0 -25
@@ -219,21 +219,13 @@ struct si_info {/* AMBA Interconnect exported externs */ -extern uint ai_flag (struct si_pub *sih); -extern void ai_setint (struct si_pub *sih,int siflag);extern uint ai_coreidx (struct si_pub *sih); -extern uint ai_corevendor (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih);extern bool ai_iscoreup (struct si_pub *sih);extern u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val); -extern void ai_core_cflags_wo (struct si_pub *sih,u32 mask,u32 val);extern u32 ai_core_sflags (struct si_pub *sih,u32 mask,u32 val);extern void ai_core_reset (struct si_pub *sih,u32 bits,u32 resetbits);extern void ai_core_disable (struct si_pub *sih,u32 bits); -extern int ai_numaddrspaces (struct si_pub *sih); -extern u32 ai_addrspace (struct si_pub *sih,uint asidx); -extern u32 ai_addrspacesize (struct si_pub *sih,uint asidx); -extern void ai_write_wrap_reg (struct si_pub *sih,u32 offset,u32 val);/* === exported functions === */ extern struct si_pub *ai_attach (struct bcma_bus *pbus);
@@ -241,23 +233,13 @@ extern void ai_detach(struct si_pub *sih);extern uint ai_coreid (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih);extern uint ai_cc_reg (struct si_pub *sih,uint regoff,u32 mask,u32 val); -extern void ai_write_wrapperreg (struct si_pub *sih,u32 offset,u32 val); -extern u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val); -extern u32 ai_core_sflags (struct si_pub *sih,u32 mask,u32 val); -extern bool ai_iscoreup (struct si_pub *sih);extern uint ai_findcoreidx (struct si_pub *sih,uint coreid,uint coreunit);extern void __iomem *ai_setcoreidx (struct si_pub *sih,uint coreidx);extern void __iomem *ai_setcore (struct si_pub *sih,uint coreid,uint coreunit);extern void __iomem *ai_switch_core (struct si_pub *sih,uint coreid,uint *origidx,uint *intr_val);extern void ai_restore_core (struct si_pub *sih,uint coreid,uint intr_val); -extern void ai_core_reset (struct si_pub *sih,u32 bits,u32 resetbits); -extern void ai_core_disable (struct si_pub *sih,u32 bits); -extern u32 ai_alp_clock (struct si_pub *sih); -extern u32 ai_ilp_clock (struct si_pub *sih);extern void ai_pci_setup (struct si_pub *sih,uint coremask); -extern void ai_setint (struct si_pub *sih,int siflag); -extern bool ai_backplane64 (struct si_pub *sih);extern void ai_register_intr_callback (struct si_pub *sih,void *intrsoff_fn,void *intrsrestore_fn,void *intrsenabled_fn,void *intr_arg);
@@ -276,13 +258,6 @@ extern bool ai_is_otp_disabled(struct si_pub *sih);/* SPROM availability */ extern bool ai_is_sprom_available (struct si_pub *sih); -/* -* Build device path. Path size must be >= SI_DEVPATH_BUFSZ. -* The returned path is NULL terminated and has trailing '/'. -* Return 0 on success, nonzero otherwise. -*/ -extern int ai_devpath (struct si_pub *sih,char *path,int size); -extern void ai_pci_sleep (struct si_pub *sih);extern void ai_pci_down (struct si_pub *sih);extern void ai_pci_up (struct si_pub *sih);
Signature · 1 line
1.7.5.4
PATCH 4/23 brcm80211: fmac: remove drive strength code for unsupported chips
In reply to Franky Linbcm4325 and bcm4336 are not supported by brcmfmac. Remove the drive strength setting code specific for these chips.
--- .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 52 +------------------- 1 files changed, 2 insertions(+), 50 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +2 -50
@@ -59,40 +59,8 @@ struct sdiod_drive_str {u8 strength;/* Pad Drive Strength in mA */ u8 sel;/* Chip-specific select value */ }; -/* SDIO Drive Strength to sel value table for PMU Rev 1 */ -static const struct sdiod_drive_str sdiod_drive_strength_tab1[] = { - { -4 ,0x2 }, { -2 ,0x3 }, { -1 ,0x0 }, { -0 ,0x0 } - }; -/* SDIO Drive Strength to sel value table for PMU Rev 2, 3 */ -static const struct sdiod_drive_str sdiod_drive_strength_tab2[] = { - { -12 ,0x7 }, { -10 ,0x6 }, { -8 ,0x5 }, { -6 ,0x4 }, { -4 ,0x2 }, { -2 ,0x1 }, { -0 ,0x0 } - }; -/* SDIO Drive Strength to sel value table for PMU Rev 8 (1.8V) */ -static const struct sdiod_drive_str sdiod_drive_strength_tab3[] = { - { -32 ,0x7 }, { -26 ,0x6 }, { -22 ,0x5 }, { -16 ,0x4 }, { -12 ,0x3 }, { -8 ,0x2 }, { -4 ,0x1 }, { -0 ,0x0 } - }; -/* SDIO Drive Strength to sel value table for PMU Rev 11 (1.8V) */ -static const struct sdiod_drive_str sdiod_drvstr_tab4_1v8[] = { +static const struct sdiod_drive_str sdiod_drvstr_tab1_1v8[] = { {32 ,0x6 }, {26 ,0x7 }, {22 ,0x4 },
@@ -598,24 +566,8 @@ brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev,return ;switch (SDIOD_DRVSTR_KEY (ci->chip, ci->pmurev)) { -case SDIOD_DRVSTR_KEY (BCM4325_CHIP_ID ,1 ): - str_tab = (struct sdiod_drive_str *)&sdiod_drive_strength_tab1; - str_mask =0x30000000 ; - str_shift =28 ; -break ; -case SDIOD_DRVSTR_KEY (BCM4325_CHIP_ID ,2 ): -case SDIOD_DRVSTR_KEY (BCM4325_CHIP_ID ,3 ): - str_tab = (struct sdiod_drive_str *)&sdiod_drive_strength_tab2; - str_mask =0x00003800 ; - str_shift =11 ; -break ; -case SDIOD_DRVSTR_KEY (BCM4336_CHIP_ID ,8 ): - str_tab = (struct sdiod_drive_str *)&sdiod_drive_strength_tab3; - str_mask =0x00003800 ; - str_shift =11 ; -break ;case SDIOD_DRVSTR_KEY (BCM4330_CHIP_ID ,12 ): - str_tab = (struct sdiod_drive_str *)&sdiod_drvstr_tab4_1v8; + str_tab = (struct sdiod_drive_str *)&sdiod_drvstr_tab1_1v8; str_mask =0x00003800 ; str_shift =11 ;break ;
Signature · 1 line
1.7.5.4
PATCH 5/23 bcma: add set/mask macros for 16-bit register access
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The BCMA header only had definitions for 32-bit register access. Used those as a template for the 16-bit flavour. Also changed them to inline functions to be on the safe side. As offset parameter is used twice there would be a problem when used like this: bcma_set32(core, offset++, val);
--- include/linux/bcma/bcma.h | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-)
include/linux/bcma/bcma.h +26 -6
@@ -254,12 +254,32 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) core->bus->ops->awrite32 (core, offset, value); } -#define bcma_mask32 (cc, offset, mask) \ - bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) -#define bcma_set32 (cc, offset, set) \ - bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) -#define bcma_maskset32 (cc, offset, mask, set) \ - bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) +static inline void bcma_mask32 (struct bcma_device *cc,u16 offset,u32 mask) +{ +bcma_write32 (cc, offset,bcma_read32 (cc, offset) & mask); +} +static inline void bcma_set32 (struct bcma_device *cc,u16 offset,u32 set) +{ +bcma_write32 (cc, offset,bcma_read32 (cc, offset) | set); +} +static inline void bcma_maskset32 (struct bcma_device *cc, +u16 offset,u32 mask,u32 set) +{ +bcma_write32 (cc, offset, (bcma_read32 (cc, offset) & mask) | set); +} +static inline void bcma_mask16 (struct bcma_device *cc,u16 offset,u16 mask) +{ +bcma_write16 (cc, offset,bcma_read16 (cc, offset) & mask); +} +static inline void bcma_set16 (struct bcma_device *cc,u16 offset,u16 set) +{ +bcma_write16 (cc, offset,bcma_read16 (cc, offset) | set); +} +static inline void bcma_maskset16 (struct bcma_device *cc, +u16 offset,u16 mask,u16 set) +{ +bcma_write16 (cc, offset, (bcma_read16 (cc, offset) & mask) | set); +}extern bool bcma_core_is_enabled (struct bcma_device *core);extern void bcma_core_disable (struct bcma_device *core,u32 flags);
Signature · 1 line
1.7.5.4
PATCH 7/23 brcm80211: smac: remove unused fields from struct si_pub definition
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Several fields from the si_pub structure were not used or only set once but never checked. These fields have been removed.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 7 ------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 7 ------- 2 files changed, 0 insertions(+), 14 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +0 -7
@@ -932,10 +932,6 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)/* get chipcommon capabilites */ sii->pub.cccaps =R_REG (&cc->capabilities); -/* get chipcommon extended capabilities */ - -if (sii->pub.ccrev >=35 ) - sii->pub.cccaps_ext =R_REG (&cc->capabilities_ext);/* get pmu rev and caps */ if (sii->pub.cccaps &CC_CAP_PMU ) {
@@ -1023,7 +1019,6 @@ static __used void ai_nvram_process(struct si_info *sii) sii->pub.boardvendor = w &0xffff ; sii->pub.boardtype = (w >>16 ) &0xffff ; - sii->pub.boardflags =getintvar (&sii->pub,BRCMS_SROM_BOARDFLAGS ); } static struct si_info *ai_doattach(struct si_info *sii,
@@ -1071,8 +1066,6 @@ static struct si_info *ai_doattach(struct si_info *sii, sih->chiprev = (w &CID_REV_MASK ) >>CID_REV_SHIFT ; sih->chippkg = (w &CID_PKG_MASK ) >>CID_PKG_SHIFT ; - sih->issim = false; -/* scan for cores */ if (socitype ==SOCI_AI ) {SI_MSG ("Found chip type AI (0x%08x)\n" , w);
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +0 -7
@@ -149,21 +149,14 @@ struct si_pub {uint buscoreidx;/* buscore index */ int ccrev;/* chip common core rev */ u32 cccaps;/* chip common capabilities */ -u32 cccaps_ext;/* chip common capabilities extension */ int pmurev;/* pmu core rev */ u32 pmucaps;/* pmu capabilities */ uint boardtype;/* board type */ uint boardvendor;/* board vendor */ -uint boardflags;/* board flags */ -uint boardflags2;/* board flags2 */ uint chip;/* chip number */ uint chiprev;/* chip revision */ uint chippkg;/* chip package option */ u32 chipst;/* chip status */ -bool issim;/* chip is in simulation or emulation */ -uint socirev;/* SOC interconnect rev */ -bool pci_pr32414; - };struct pci_dev ;
Signature · 1 line
1.7.5.4
PATCH 10/23 brcm80211: smac: change from pci device driver to bcma device driver
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
A new bus driver called "bcma" has been introduced into the kernel tree which considers the Broadcom AMBA chip interconnect as a bus. Each core in the chip is a bcma device. This commit changes brcms_mac80211.c into a bcma device driver.
--- drivers/net/wireless/brcm80211/Kconfig | 3 +- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 168 ++++++++------------ .../net/wireless/brcm80211/brcmsmac/mac80211_if.h | 2 - 3 files changed, 64 insertions(+), 109 deletions(-)
drivers/net/wireless/brcm80211/Kconfig +1 -2
@@ -3,9 +3,8 @@ config BRCMUTIL config BRCMSMAC tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver" - depends on PCI depends on MAC80211 - depends on BCMA=n + depends on BCMA select BRCMUTIL select FW_LOADER select CRC_CCITT
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +63 -105
344 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h +0 -2
@@ -68,8 +68,6 @@ struct brcms_info {spinlock_t lock;/* per-device perimeter lock */ spinlock_t isr_lock;/* per-device ISR synchronization lock */ -/* regsva for unmap in brcms_free() */ -void __iomem *regsva;/* opaque chip registers virtual address */ /* timer related fields */ atomic_t callbacks;/* # outstanding callback functions */
Signature · 1 line
1.7.5.4
PATCH 11/23 brcm80211: smac: change attach interfaces in main.c for bcma support
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The driver is probed through bcma which provides a device representing the core. This device is now passed in brcms_c_attach and brcms_b_attach functions.
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 4 +-- drivers/net/wireless/brcm80211/brcmsmac/main.c | 31 +++++++++---------- drivers/net/wireless/brcm80211/brcmsmac/pub.h | 6 ++-- 3 files changed, 19 insertions(+), 22 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +1 -3
@@ -1030,9 +1030,7 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev) }/* common load-time initialization */ - wl->wlc =brcms_c_attach ((void *)wl, pdev->bus->host_pci->vendor, - pdev->bus->host_pci->device, unit, false, - pdev->bus->mmio, pdev->bus->host_pci, &err); + wl->wlc =brcms_c_attach ((void *)wl, pdev, unit, false, &err);brcms_release_fw (wl);if (!wl->wlc) { wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n",
drivers/net/wireless/brcm80211/brcmsmac/main.c +15 -16
@@ -4437,9 +4437,8 @@ struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc)* initialize software state for each core and band * put the whole chip in reset(driver down state), no clock */ -static int brcms_b_attach (struct brcms_c_info *wlc,u16 vendor,u16 device, -uint unit,bool piomode,void __iomem *regsva, -struct pci_dev *btparam) +static int brcms_b_attach (struct brcms_c_info *wlc,struct bcma_device *core, +uint unit,bool piomode) {struct brcms_hardware *wlc_hw;struct d11regs __iomem *regs;
@@ -4449,9 +4448,11 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,bool wme = false;struct shared_phy_params sha_params;struct wiphy *wiphy = wlc->wiphy; +struct pci_dev *pcidev = core->bus->host_pci; -BCMMSG (wlc->wiphy,"wl%d: vendor 0x%x device 0x%x\n" , unit, vendor, - device); +BCMMSG (wlc->wiphy,"wl%d: vendor 0x%x device 0x%x\n" , unit, + pcidev->vendor, + pcidev->device); wme = true;
@@ -4468,7 +4469,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,* Do the hardware portion of the attach. Also initialize software * state that depends on the particular hardware we are running. */ - wlc_hw->sih =ai_attach (regsva, btparam); + wlc_hw->sih =ai_attach (core->bus->mmio, core->bus->host_pci);if (wlc_hw->sih ==NULL ) {wiphy_err (wiphy,"wl%d: brcms_b_attach: si_attach failed\n" , unit);
@@ -4477,16 +4478,16 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, }/* verify again the device is supported */ -if (!brcms_c_chipmatch (vendor, device)) { +if (!brcms_c_chipmatch (pcidev->vendor, pcidev->device)) {wiphy_err (wiphy,"wl%d: brcms_b_attach: Unsupported " "vendor/device (0x%x/0x%x)\n" , - unit, vendor, device); + unit, pcidev->vendor, pcidev->device); err =12 ; goto fail; } - wlc_hw->vendorid = vendor; - wlc_hw->deviceid = device; + wlc_hw->vendorid = pcidev->vendor; + wlc_hw->deviceid = pcidev->device;/* set bar0 window to point at D11 core */ wlc_hw->regs = (struct d11regs __iomem *)
@@ -8351,9 +8352,8 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)* The common driver entry routine. Error codes should be unique */ struct brcms_c_info * -brcms_c_attach (struct brcms_info *wl,u16 vendor,u16 device,uint unit, -bool piomode,void __iomem *regsva,struct pci_dev *btparam, -uint *perr) +brcms_c_attach (struct brcms_info *wl,struct bcma_device *core,uint unit, +bool piomode,uint *perr) {struct brcms_c_info *wlc;uint err =0 ;
@@ -8361,7 +8361,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,struct brcms_pub *pub;/* allocate struct brcms_c_info state and its substructures */ - wlc = (struct brcms_c_info *)brcms_c_attach_malloc (unit, &err, device); + wlc = (struct brcms_c_info *)brcms_c_attach_malloc (unit, &err,0 );if (wlc ==NULL ) goto fail; wlc->wiphy = wl->wiphy;
@@ -8388,8 +8388,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,* low level attach steps(all hw accesses go * inside, no more in rest of the attach) */ - err =brcms_b_attach (wlc, vendor, device, unit, piomode, regsva, - btparam); + err =brcms_b_attach (wlc, core, unit, piomode);if (err) goto fail;
drivers/net/wireless/brcm80211/brcmsmac/pub.h +3 -3
@@ -17,6 +17,7 @@#ifndef _BRCM_PUB_H_#define _BRCM_PUB_H_ +#include <linux/bcma/bcma.h> #include <brcmu_wifi.h> #include "types.h" #include "defs.h"
@@ -530,9 +531,8 @@ struct brcms_antselcfg {/* common functions for every port */ extern struct brcms_c_info * -brcms_c_attach (struct brcms_info *wl,u16 vendor,u16 device,uint unit, -bool piomode,void __iomem *regsva,struct pci_dev *btparam, -uint *perr); +brcms_c_attach (struct brcms_info *wl,struct bcma_device *core,uint unit, +bool piomode,uint *perr);extern uint brcms_c_detach (struct brcms_c_info *wlc);extern int brcms_c_up (struct brcms_c_info *wlc);extern uint brcms_c_down (struct brcms_c_info *wlc);
Signature · 1 line
1.7.5.4
PATCH 17/23 brcm80211: smac: use bcma function for register access in dma.c
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The dma.c source file now uses the register access functions provided by bcma.
--- drivers/net/wireless/brcm80211/brcmsmac/dma.c | 174 +++++++++++++----------- drivers/net/wireless/brcm80211/brcmsmac/dma.h | 3 +- drivers/net/wireless/brcm80211/brcmsmac/main.c | 22 ++-- 3 files changed, 108 insertions(+), 91 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/dma.c +97 -77
@@ -27,6 +27,13 @@#include "soc.h" /* +* dma register field offset calculation +*/ +#define DMA64REGOFFS (field) offsetof(struct dma64regs, field) +#define DMA64TXREGOFFS (di, field) (di->d64txregbase + DMA64REGOFFS(field)) +#define DMA64RXREGOFFS (di, field) (di->d64rxregbase + DMA64REGOFFS(field)) + +/* * DMA hardware requires each descriptor ring to be 8kB aligned, and fit within * a contiguous 8kB physical address. */
@@ -227,9 +234,9 @@ struct dma_info {bool addrext;/* this dma engine supports DmaExtendedAddrChanges */ /* 64-bit dma tx engine registers */ -struct dma64regs __iomem *d64txregs; +uint d64txregbase;/* 64-bit dma rx engine registers */ -struct dma64regs __iomem *d64rxregs; +uint d64rxregbase;/* pointer to dma64 tx descriptor ring */ struct dma64desc *txd64;/* pointer to dma64 rx descriptor ring */
@@ -376,15 +383,16 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)if (dmactrlflags &DMA_CTRL_PEN ) {u32 control; - control =R_REG (&di->d64txregs->control); -W_REG (&di->d64txregs->control, + control =bcma_read32 (di->d11core,DMA64TXREGOFFS (di, control)); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, control), control |D64_XC_PD ); -if (R_REG (&di->d64txregs->control) &D64_XC_PD ) +if (bcma_read32 (di->d11core,DMA64TXREGOFFS (di, control)) & +D64_XC_PD )/* We *can* disable it so it is supported, * restore control register */ -W_REG (&di->d64txregs->control, - control); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, control), + control);else /* Not supported, don't allow it to be enabled */ dmactrlflags &= ~DMA_CTRL_PEN ;
@@ -395,12 +403,12 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)return dmactrlflags; } -static bool _dma64_addrext (struct dma64regs __iomem *dma64regs) +static bool _dma64_addrext (struct dma_info *di,uint ctrl_offset) {u32 w; -OR_REG (&dma64regs->control,D64_XC_AE ); - w =R_REG (&dma64regs->control); -AND_REG (&dma64regs->control, ~D64_XC_AE ); +bcma_set32 (di->d11core, ctrl_offset,D64_XC_AE ); + w =bcma_read32 (di->d11core, ctrl_offset); +bcma_mask32 (di->d11core, ctrl_offset, ~D64_XC_AE );return (w &D64_XC_AE ) ==D64_XC_AE ; }
@@ -413,13 +421,13 @@ static bool _dma_isaddrext(struct dma_info *di)/* DMA64 supports full 32- or 64-bit operation. AE is always valid */ /* not all tx or rx channel are available */ -if (di->d64txregs !=NULL ) { -if (!_dma64_addrext (di->d64txregs)) +if (di->d64txregbase !=0 ) { +if (!_dma64_addrext (di,DMA64TXREGOFFS (di, control)))DMA_ERROR ("%s: DMA64 tx doesn't have AE set\n" , di->name);return true; - }else if (di->d64rxregs !=NULL ) { -if (!_dma64_addrext (di->d64rxregs)) + }else if (di->d64rxregbase !=0 ) { +if (!_dma64_addrext (di,DMA64RXREGOFFS (di, control)))DMA_ERROR ("%s: DMA64 rx doesn't have AE set\n" , di->name);return true;
@@ -433,14 +441,14 @@ static bool _dma_descriptor_align(struct dma_info *di)u32 addrl;/* Check to see if the descriptors need to be aligned on 4K/8K or not */ -if (di->d64txregs !=NULL ) { -W_REG (&di->d64txregs->addrlow,0xff0 ); - addrl =R_REG (&di->d64txregs->addrlow); +if (di->d64txregbase !=0 ) { +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, addrlow),0xff0 ); + addrl =bcma_read32 (di->d11core,DMA64TXREGOFFS (di, addrlow));if (addrl !=0 )return false; - }else if (di->d64rxregs !=NULL ) { -W_REG (&di->d64rxregs->addrlow,0xff0 ); - addrl =R_REG (&di->d64rxregs->addrlow); + }else if (di->d64rxregbase !=0 ) { +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, addrlow),0xff0 ); + addrl =bcma_read32 (di->d11core,DMA64RXREGOFFS (di, addrlow));if (addrl !=0 )return false; }
@@ -558,8 +566,7 @@ static bool _dma_alloc(struct dma_info *di, uint direction)struct dma_pub *dma_attach (char *name,struct si_pub *sih,struct bcma_device *d11core, -void __iomem *dmaregstx,void __iomem *dmaregsrx, -uint ntxd,uint nrxd, +uint txregbase,uint rxregbase,uint ntxd,uint nrxd,uint rxbufsize,int rxextheadroom,uint nrxpost,uint rxoffset,uint *msg_level) {
@@ -576,10 +583,10 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, di->dma64 = ((ai_core_sflags (sih,0 ,0 ) &SISF_DMA64 ) ==SISF_DMA64 ); -/* init dma reg pointer */ +/* init dma reg info */ di->d11core = d11core; - di->d64txregs = (struct dma64regs __iomem *) dmaregstx; - di->d64rxregs = (struct dma64regs __iomem *) dmaregsrx; + di->d64txregbase = txregbase; + di->d64rxregbase = rxregbase;/* * Default flags (which can be changed by the driver calling
@@ -588,10 +595,11 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,*/ _dma_ctrlflags (di,DMA_CTRL_ROC |DMA_CTRL_PEN ,0 ); -DMA_TRACE ("%s: %s flags 0x%x ntxd %d nrxd %d rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d dmaregstx %p dmaregsrx %p\n" , - name,"DMA64" , +DMA_TRACE ("%s: %s flags 0x%x ntxd %d nrxd %d " +"rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d " +"txregbase %u rxregbase %u\n" , name,"DMA64" , di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, - rxextheadroom, nrxpost, rxoffset, dmaregstx, dmaregsrx); + rxextheadroom, nrxpost, rxoffset, txregbase, rxregbase);/* make a private copy of our callers name */ strncpy (di->name, name,MAXNAMEL );
@@ -783,11 +791,15 @@ _dma_ddtable_init(struct dma_info *di, uint direction, dma_addr_t pa)if ((di->ddoffsetlow ==0 ) || !(pa &PCI32ADDR_HIGH )) {if (direction ==DMA_TX ) { -W_REG (&di->d64txregs->addrlow, pa + di->ddoffsetlow); -W_REG (&di->d64txregs->addrhigh, di->ddoffsethigh); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, addrlow), + pa + di->ddoffsetlow); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, addrhigh), + di->ddoffsethigh); }else { -W_REG (&di->d64rxregs->addrlow, pa + di->ddoffsetlow); -W_REG (&di->d64rxregs->addrhigh, di->ddoffsethigh); +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, addrlow), + pa + di->ddoffsetlow); +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, addrhigh), + di->ddoffsethigh); } }else {/* DMA64 32bits address extension */
@@ -798,15 +810,19 @@ _dma_ddtable_init(struct dma_info *di, uint direction, dma_addr_t pa) pa &= ~PCI32ADDR_HIGH ;if (direction ==DMA_TX ) { -W_REG (&di->d64txregs->addrlow, pa + di->ddoffsetlow); -W_REG (&di->d64txregs->addrhigh, di->ddoffsethigh); -SET_REG (&di->d64txregs->control, -D64_XC_AE , (ae <<D64_XC_AE_SHIFT )); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, addrlow), + pa + di->ddoffsetlow); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, addrhigh), + di->ddoffsethigh); +bcma_maskset32 (di->d11core,DMA64TXREGOFFS (di, control), +D64_XC_AE , (ae <<D64_XC_AE_SHIFT )); }else { -W_REG (&di->d64rxregs->addrlow, pa + di->ddoffsetlow); -W_REG (&di->d64rxregs->addrhigh, di->ddoffsethigh); -SET_REG (&di->d64rxregs->control, -D64_RC_AE , (ae <<D64_RC_AE_SHIFT )); +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, addrlow), + pa + di->ddoffsetlow); +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, addrhigh), + di->ddoffsethigh); +bcma_maskset32 (di->d11core,DMA64RXREGOFFS (di, control), +D64_RC_AE , (ae <<D64_RC_AE_SHIFT )); } } }
@@ -818,9 +834,9 @@ static void _dma_rxenable(struct dma_info *di)DMA_TRACE ("%s:\n" , di->name); - control = - (R_REG (&di->d64rxregs->control) &D64_RC_AE ) | -D64_RC_RE ; + control =D64_RC_RE | (bcma_read32 (di->d11core, +DMA64RXREGOFFS (di, control)) & +D64_RC_AE );if ((dmactrlflags &DMA_CTRL_PEN ) ==0 ) control |=D64_RC_PD ;
@@ -828,7 +844,7 @@ static void _dma_rxenable(struct dma_info *di)if (dmactrlflags &DMA_CTRL_ROC ) control |=D64_RC_OC ; -W_REG (&di->d64rxregs->control, +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, control), ((di->rxoffset <<D64_RC_RO_SHIFT ) | control)); }
@@ -871,7 +887,8 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)return NULL ; curr = -B2I (((R_REG (&di->d64rxregs->status0) &D64_RS0_CD_MASK ) - +B2I (((bcma_read32 (di->d11core, +DMA64RXREGOFFS (di, status0)) &D64_RS0_CD_MASK ) - di->rcvptrbase) & D64_RS0_CD_MASK, struct dma64desc);/* ignore curr if forceall */
@@ -953,12 +970,12 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)if (resid >0 ) {uint cur; cur = -B2I (((R_REG (&di->d64rxregs->status0) & -D64_RS0_CD_MASK ) - - di->rcvptrbase) &D64_RS0_CD_MASK , - struct dma64desc); +B2I (((bcma_read32 (di->d11core, +DMA64RXREGOFFS (di, status0)) & +D64_RS0_CD_MASK ) - di->rcvptrbase) & + D64_RS0_CD_MASK, struct dma64desc);DMA_ERROR ("rxin %d rxout %d, hw_curr %d\n" , - di->rxin, di->rxout, cur); + di->rxin, di->rxout, cur); }#endif /* BCMDBG */
@@ -986,8 +1003,10 @@ static bool dma64_rxidle(struct dma_info *di)if (di->nrxd ==0 )return true; -return ((R_REG (&di->d64rxregs->status0) &D64_RS0_CD_MASK ) == - (R_REG (&di->d64rxregs->ptr) &D64_RS0_CD_MASK )); +return ((bcma_read32 (di->d11core, +DMA64RXREGOFFS (di, status0)) &D64_RS0_CD_MASK ) == + (bcma_read32 (di->d11core,DMA64RXREGOFFS (di, ptr)) & +D64_RS0_CD_MASK )); }/*
@@ -1070,7 +1089,7 @@ bool dma_rxfill(struct dma_pub *pub) di->rxout = rxout;/* update the chip lastdscr pointer */ -W_REG (&di->d64rxregs->ptr, +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, ptr), di->rcvptrbase + I2B(rxout, struct dma64desc));return ring_empty;
@@ -1131,7 +1150,7 @@ void dma_txinit(struct dma_pub *pub)if ((di->dma.dmactrlflags &DMA_CTRL_PEN ) ==0 ) control |=D64_XC_PD ; -OR_REG (&di->d64txregs->control, control); +bcma_set32 (di->d11core,DMA64TXREGOFFS (di, control), control);/* DMA engine with alignment requirement requires table to be inited * before enabling the engine
@@ -1149,7 +1168,7 @@ void dma_txsuspend(struct dma_pub *pub)if (di->ntxd ==0 )return ; -OR_REG (&di->d64txregs->control,D64_XC_SE ); +bcma_set32 (di->d11core,DMA64TXREGOFFS (di, control),D64_XC_SE ); }void dma_txresume (struct dma_pub *pub)
@@ -1161,7 +1180,7 @@ void dma_txresume(struct dma_pub *pub)if (di->ntxd ==0 )return ; -AND_REG (&di->d64txregs->control, ~D64_XC_SE ); +bcma_mask32 (di->d11core,DMA64TXREGOFFS (di, control), ~D64_XC_SE ); }bool dma_txsuspended (struct dma_pub *pub)
@@ -1169,8 +1188,9 @@ bool dma_txsuspended(struct dma_pub *pub)struct dma_info *di = (struct dma_info *)pub;return (di->ntxd ==0 ) || - ((R_REG (&di->d64txregs->control) &D64_XC_SE ) == -D64_XC_SE ); + ((bcma_read32 (di->d11core, +DMA64TXREGOFFS (di, control)) &D64_XC_SE ) == +D64_XC_SE ); }void dma_txreclaim (struct dma_pub *pub,enum txd_range range)
@@ -1203,16 +1223,17 @@ bool dma_txreset(struct dma_pub *pub)return true;/* suspend tx DMA first */ -W_REG (&di->d64txregs->control,D64_XC_SE ); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, control),D64_XC_SE );SPINWAIT (((status = - (R_REG (&di->d64txregs->status0) &D64_XS0_XS_MASK )) - !=D64_XS0_XS_DISABLED ) && (status !=D64_XS0_XS_IDLE ) - && (status !=D64_XS0_XS_STOPPED ),10000 ); + (bcma_read32 (di->d11core,DMA64TXREGOFFS (di, status0)) & +D64_XS0_XS_MASK )) !=D64_XS0_XS_DISABLED ) && + (status !=D64_XS0_XS_IDLE ) && (status !=D64_XS0_XS_STOPPED ), +10000 ); -W_REG (&di->d64txregs->control,0 ); +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, control),0 );SPINWAIT (((status = - (R_REG (&di->d64txregs->status0) &D64_XS0_XS_MASK )) - !=D64_XS0_XS_DISABLED ),10000 ); + (bcma_read32 (di->d11core,DMA64TXREGOFFS (di, status0)) & +D64_XS0_XS_MASK )) !=D64_XS0_XS_DISABLED ),10000 );/* wait for the last transaction to complete */ udelay (300 );
@@ -1228,10 +1249,10 @@ bool dma_rxreset(struct dma_pub *pub)if (di->nrxd ==0 )return true; -W_REG (&di->d64rxregs->control,0 ); +bcma_write32 (di->d11core,DMA64RXREGOFFS (di, control),0 );SPINWAIT (((status = - (R_REG (&di->d64rxregs->status0) &D64_RS0_RS_MASK )) - !=D64_RS0_RS_DISABLED ),10000 ); + (bcma_read32 (di->d11core,DMA64RXREGOFFS (di, status0)) & +D64_RS0_RS_MASK )) !=D64_RS0_RS_DISABLED ),10000 );return status ==D64_RS0_RS_DISABLED ; }
@@ -1293,7 +1314,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit)/* kick the chip */ if (commit) -W_REG (&di->d64txregs->ptr, +bcma_write32 (di->d11core,DMA64TXREGOFFS (di, ptr), di->xmtptrbase + I2B(txout, struct dma64desc));/* tx flow control */
@@ -1341,16 +1362,15 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)if (range ==DMA_RANGE_ALL ) end = di->txout;else { -struct dma64regs __iomem *dregs = di->d64txregs; - - end = (u16) (B2I (((R_REG (&dregs->status0) & -D64_XS0_CD_MASK ) - - di->xmtptrbase) &D64_XS0_CD_MASK , - struct dma64desc)); + end = (u16) (B2I (((bcma_read32 (di->d11core, +DMA64TXREGOFFS (di, status0)) & +D64_XS0_CD_MASK ) - di->xmtptrbase) & + D64_XS0_CD_MASK, struct dma64desc));if (range ==DMA_RANGE_TRANSFERED ) { active_desc = - (u16) (R_REG (&dregs->status1) & + (u16)(bcma_read32 (di->d11core, +DMA64TXREGOFFS (di, status1)) &D64_XS1_AD_MASK ); active_desc = (active_desc - di->xmtptrbase) &D64_XS0_CD_MASK ;
drivers/net/wireless/brcm80211/brcmsmac/dma.h +1 -2
@@ -76,8 +76,7 @@ struct dma_pub {extern struct dma_pub *dma_attach (char *name,struct si_pub *sih,struct bcma_device *d11core, -void __iomem *dmaregstx, -void __iomem *dmaregsrx, +uint txregbase,uint rxregbase,uint ntxd,uint nrxd,uint rxbufsize,int rxextheadroom,uint nrxpost,uint rxoffset,uint *msg_level);
drivers/net/wireless/brcm80211/brcmsmac/main.c +10 -12
@@ -1065,14 +1065,12 @@ brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init) } } -static struct dma64regs __iomem * -dmareg (struct brcms_hardware *hw,uint direction,uint fifonum) +static uint +dmareg (uint direction,uint fifonum) { -struct d11regs __iomem *regs = hw->d11core->bus->mmio; -if (direction ==DMA_TX ) -return &(regs->fifo64regs[fifonum].dmaxmt); -return &(regs->fifo64regs[fifonum].dmarcv); + return offsetof(struct d11regs, fifo64regs[fifonum].dmaxmt); + return offsetof(struct d11regs, fifo64regs[fifonum].dmarcv); }static bool brcms_b_attach_dmapio (struct brcms_c_info *wlc,uint j,bool wme)
@@ -1099,8 +1097,8 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* RX: RX_FIFO (RX data packets) */ wlc_hw->di[0 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core, - (wme ?dmareg (wlc_hw,DMA_TX ,0 ) : -NULL ),dmareg (wlc_hw,DMA_RX ,0 ), + (wme ?dmareg (DMA_TX ,0 ) :0 ), +dmareg (DMA_RX ,0 ), (wme ?NTXD :0 ),NRXD ,RXBUFSZ ,-1 ,NRXBUFPOST ,BRCMS_HWRXOFF , &brcm_msg_level);
@@ -1113,7 +1111,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* RX: UNUSED */ wlc_hw->di[1 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core, -dmareg (wlc_hw,DMA_TX ,1 ),NULL , +dmareg (DMA_TX ,1 ),0 ,NTXD ,0 ,0 ,-1 ,0 ,0 , &brcm_msg_level); dma_attach_err |= (NULL == wlc_hw->di[1 ]);
@@ -1124,7 +1122,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* RX: UNUSED */ wlc_hw->di[2 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core, -dmareg (wlc_hw,DMA_TX ,2 ),NULL , +dmareg (DMA_TX ,2 ),0 ,NTXD ,0 ,0 ,-1 ,0 ,0 , &brcm_msg_level); dma_attach_err |= (NULL == wlc_hw->di[2 ]);
@@ -1134,8 +1132,8 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* (legacy) TX_CTL_FIFO (TX control & mgmt packets) */ wlc_hw->di[3 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core, -dmareg (wlc_hw,DMA_TX ,3 ), -NULL ,NTXD ,0 ,0 ,-1 , +dmareg (DMA_TX ,3 ), +0 ,NTXD ,0 ,0 ,-1 ,0 ,0 , &brcm_msg_level); dma_attach_err |= (NULL == wlc_hw->di[3 ]);/* Cleaner to leave this as if with AP defined */
Signature · 1 line
1.7.5.4
PATCH 19/23 brcm80211: smac: remove SI_FAST() macro usage
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The use of SI_FAST() macro interferes with the BCMA integration as it causes BCMA and aiutils.c to get out of sync on what the current core is. When everything is using BCMA we will try to add SI_FAST functionality to BCMA to avoid unnecessary core switching.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 157 +++++---------------- 1 files changed, 35 insertions(+), 122 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +35 -122
@@ -318,16 +318,6 @@#define BADIDX (SI_MAXCORES + 1) -/* Newer chips can access PCI/PCIE and CC core without requiring to change -* PCI BAR0 WIN -*/ -#define SI_FAST (sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) || \ - ((ai_get_buscoretype(sih) == PCI_CORE_ID) && \ - ai_get_buscorerev(sih) >= 13)) - -#define CCREGS_FAST (si) (((char __iomem *)((si)->curmap) + \ - PCI_16KB0_CCREGS_OFFSET)) -#define IS_SIM (chippkg) \ ((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID))
@@ -360,9 +350,6 @@ (((x) >= (b)) && ((x) < ((b ) +SI_MAXCORES *SI_CORE_SIZE )) && \ IS_ALIGNED((x), SI_CORE_SIZE)) -#define PCIEREGS (si) ((__iomem char *)((si)->curmap) + \ - PCI_16KB0_PCIREGS_OFFSET) -struct aidmp {u32 oobselina30;/* 0x000 */ u32 oobselina74;/* 0x004 */
@@ -777,13 +764,11 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx) }/* fixup necessary chip/core configurations */ -if (SI_FAST (&sii->pub)) { -if (!sii->pch) { - sii->pch =pcicore_init (&sii->pub, sii->pcibus, - (__iomem void *)PCIEREGS (sii)); -if (sii->pch ==NULL ) -return false; - } +if (!sii->pch) { + sii->pch =pcicore_init (&sii->pub, sii->pcibus, + sii->curmap +PCI_16KB0_PCIREGS_OFFSET ); +if (sii->pch ==NULL ) +return false; }if (ai_pci_fixcfg (&sii->pub)) {/* si_doattach: si_pci_fixcfg failed */
@@ -1084,17 +1069,6 @@ void __iomem *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx, sii = (struct si_info *)sih; -if (SI_FAST (sih)) { -/* Overloading the origidx variable to remember the coreid, -* this works because the core ids cannot be confused with -* core indices. -*/ - *origidx = coreid; -if (coreid ==CC_CORE_ID ) -return CCREGS_FAST (sii); -else if (coreid ==ai_get_buscoretype (sih)) -return PCIEREGS (sii); - }INTR_OFF (sii, *intr_val); *origidx = sii->curidx; cc =ai_setcore (sih, coreid,0 );
@@ -1107,9 +1081,6 @@ void ai_restore_core(struct si_pub *sih, uint coreid, uint intr_val)struct si_info *sii; sii = (struct si_info *)sih; -if (SI_FAST (sih) - && ((coreid ==CC_CORE_ID ) || (coreid ==ai_get_buscoretype (sih)))) -return ;ai_setcoreidx (sih, coreid);INTR_RESTORE (sii, intr_val);
@@ -1140,7 +1111,6 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,u32 __iomem *r =NULL ;uint w;uint intr_val =0 ; -bool fast = false;struct si_info *sii; sii = (struct si_info *)sih;
@@ -1148,41 +1118,14 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,if (coreidx >=SI_MAXCORES )return 0 ; -/* -* If pci/pcie, we can get at pci/pcie regs -* and on newer cores to chipc -*/ -if ((sii->coreid[coreidx] ==CC_CORE_ID ) &&SI_FAST (sih)) { -/* Chipc registers are mapped at 12KB */ - fast = true; - r = (u32 __iomem *)((__iomem char *)sii->curmap + -PCI_16KB0_CCREGS_OFFSET + regoff); - }else if (sii->buscoreidx == coreidx) { -/* -* pci registers are at either in the last 2KB of -* an 8KB window or, in pcie and pci rev 13 at 8KB -*/ - fast = true; -if (SI_FAST (sih)) - r = (u32 __iomem *)((__iomem char *)sii->curmap + -PCI_16KB0_PCIREGS_OFFSET + regoff); -else - r = (u32 __iomem *)((__iomem char *)sii->curmap + - ((regoff >=SBCONFIGOFF ) ? -PCI_BAR0_PCISBR_OFFSET : -PCI_BAR0_PCIREGS_OFFSET ) + regoff); - } - -if (!fast) { -INTR_OFF (sii, intr_val); +INTR_OFF (sii, intr_val); -/* save current core index */ - origidx =ai_coreidx (&sii->pub); +/* save current core index */ + origidx =ai_coreidx (&sii->pub); -/* switch core */ - r = (u32 __iomem *) ((unsigned char __iomem *) -ai_setcoreidx (&sii->pub, coreidx) + regoff); - } +/* switch core */ + r = (u32 __iomem *) ((unsigned char __iomem *) +ai_setcoreidx (&sii->pub, coreidx) + regoff);/* mask and set */ if (mask || val) {
@@ -1193,13 +1136,11 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,/* readback */ w =R_REG (r); -if (!fast) { -/* restore core index */ -if (origidx != coreidx) -ai_setcoreidx (&sii->pub, origidx); +/* restore core index */ +if (origidx != coreidx) +ai_setcoreidx (&sii->pub, origidx); -INTR_RESTORE (sii, intr_val); - } +INTR_RESTORE (sii, intr_val);return w; }
@@ -1354,24 +1295,16 @@ void ai_clkctl_init(struct si_pub *sih)struct si_info *sii;uint origidx =0 ;struct chipcregs __iomem *cc; -bool fast;if (!(ai_get_cccaps (sih) &CC_CAP_PWR_CTL ))return ; sii = (struct si_info *)sih; - fast =SI_FAST (sih); -if (!fast) { - origidx = sii->curidx; - cc = (struct chipcregs __iomem *) -ai_setcore (sih,CC_CORE_ID ,0 ); -if (cc ==NULL ) -return ; - }else { - cc = (struct chipcregs __iomem *)CCREGS_FAST (sii); -if (cc ==NULL ) -return ; - } + origidx = sii->curidx; + cc = (struct chipcregs __iomem *) +ai_setcore (sih,CC_CORE_ID ,0 ); +if (cc ==NULL ) +return ;/* set all Instaclk chip ILP to 1 MHz */ if (ai_get_ccrev (sih) >=10 )
@@ -1380,8 +1313,7 @@ void ai_clkctl_init(struct si_pub *sih)ai_clkctl_setdelay (sii, cc); -if (!fast) -ai_setcoreidx (sih, origidx); +ai_setcoreidx (sih, origidx); }/*
@@ -1396,7 +1328,6 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)uint slowminfreq;u16 fpdelay;uint intr_val =0 ; -bool fast; sii = (struct si_info *)sih;if (ai_get_cccaps (sih) &CC_CAP_PMU ) {
@@ -1409,30 +1340,21 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)if (!(ai_get_cccaps (sih) &CC_CAP_PWR_CTL ))return 0 ; - fast =SI_FAST (sih); fpdelay =0 ; -if (!fast) { - origidx = sii->curidx; -INTR_OFF (sii, intr_val); - cc = (struct chipcregs __iomem *) -ai_setcore (sih,CC_CORE_ID ,0 ); -if (cc ==NULL ) - goto done; - }else { - cc = (struct chipcregs __iomem *)CCREGS_FAST (sii); -if (cc ==NULL ) - goto done; - } + origidx = sii->curidx; +INTR_OFF (sii, intr_val); + cc = (struct chipcregs __iomem *) +ai_setcore (sih,CC_CORE_ID ,0 ); +if (cc ==NULL ) + goto done; slowminfreq =ai_slowclk_freq (sii, false, cc); fpdelay = (((R_REG (&cc->pll_on_delay) +2 ) *1000000 ) + (slowminfreq -1 )) / slowminfreq; done: -if (!fast) { -ai_setcoreidx (sih, origidx); -INTR_RESTORE (sii, intr_val); - } +ai_setcoreidx (sih, origidx); +INTR_RESTORE (sii, intr_val);return fpdelay; }
@@ -1506,22 +1428,15 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)struct chipcregs __iomem *cc;u32 scc;uint intr_val =0 ; -bool fast =SI_FAST (&sii->pub);/* chipcommon cores prior to rev6 don't support dynamic clock control */ if (ai_get_ccrev (&sii->pub) <6 )return false; -if (!fast) { -INTR_OFF (sii, intr_val); - origidx = sii->curidx; - cc = (struct chipcregs __iomem *) -ai_setcore (&sii->pub,CC_CORE_ID ,0 ); - }else { - cc = (struct chipcregs __iomem *)CCREGS_FAST (sii); -if (cc ==NULL ) - goto done; - } +INTR_OFF (sii, intr_val); + origidx = sii->curidx; + cc = (struct chipcregs __iomem *) +ai_setcore (&sii->pub,CC_CORE_ID ,0 );if (!(ai_get_cccaps (&sii->pub) &CC_CAP_PWR_CTL ) && (ai_get_ccrev (&sii->pub) <20 ))
@@ -1580,10 +1495,8 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode) } done: -if (!fast) { -ai_setcoreidx (&sii->pub, origidx); -INTR_RESTORE (sii, intr_val); - } +ai_setcoreidx (&sii->pub, origidx); +INTR_RESTORE (sii, intr_val);return mode ==CLK_FAST ; }
Signature · 1 line
1.7.5.4
PATCH 3/23 brcm80211: fmac: add bcm4330 support
In reply to Franky LinThis patch adds support for bcm4330 chip which has a SDIO device id 0x4330. All basic functionalities of bcm4330 are supported by brcmfmac after this patch.
--- .../net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 2 + drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 2 + .../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 34 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 0 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +2 -0
@@ -40,6 +40,7 @@#define DMA_ALIGN_MASK 0x03#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 +#define SDIO_DEVICE_ID_BROADCOM_4330 0x4330#define SDIO_FUNC1_BLOCKSIZE 64#define SDIO_FUNC2_BLOCKSIZE 512
@@ -47,6 +48,7 @@/* devices we support, null terminated */ static const struct sdio_device_id brcmf_sdmmc_ids[] = { {SDIO_DEVICE (SDIO_VENDOR_ID_BROADCOM ,SDIO_DEVICE_ID_BROADCOM_4329 )}, + {SDIO_DEVICE (SDIO_VENDOR_ID_BROADCOM ,SDIO_DEVICE_ID_BROADCOM_4330 )}, {/* end: all zeroes */ }, };MODULE_DEVICE_TABLE (sdio, brcmf_sdmmc_ids);
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +2 -0
@@ -3636,6 +3636,8 @@ static bool brcmf_sdbrcm_chipmatch(u16 chipid) {if (chipid ==BCM4329_CHIP_ID )return true; +if (chipid ==BCM4330_CHIP_ID ) +return true;return false; }
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +34 -0
@@ -91,6 +91,18 @@ static const struct sdiod_drive_str sdiod_drive_strength_tab3[] = { 0, 0x0} }; +/* SDIO Drive Strength to sel value table for PMU Rev 11 (1.8V) */ +static const struct sdiod_drive_str sdiod_drvstr_tab4_1v8[] = { + {32 ,0x6 }, + {26 ,0x7 }, + {22 ,0x4 }, + {16 ,0x5 }, + {12 ,0x2 }, + {8 ,0x3 }, + {4 ,0x0 }, + {0 ,0x1 } +}; +u8 brcmf_sdio_chip_getinfidx (struct chip_info *ci,u16 coreid) {
@@ -396,6 +408,23 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, ci->c_inf[3 ].base =BCM4329_CORE_ARM_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->ramsize =0x48000 ; +break ;default :brcmf_dbg (ERROR ,"chipid 0x%x is not supported\n" , ci->chip);return -ENODEV ;
@@ -585,6 +614,11 @@ brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, str_mask =0x00003800 ; str_shift =11 ;break ; +case SDIOD_DRVSTR_KEY (BCM4330_CHIP_ID ,12 ): + str_tab = (struct sdiod_drive_str *)&sdiod_drvstr_tab4_1v8; + str_mask =0x00003800 ; + str_shift =11 ; +break ;default : brcmf_dbg(ERROR, "No SDIO Drive strength init done for chip %s rev %d pmurev %d\n", brcmf_sdio_chip_name(ci->chip, chn, 8),
Signature · 1 line
1.7.5.4
PATCH 6/23 bcma: use static keyword for inline function declaration in bcma.h
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Just scratching an itch here, but it makes more sense to use the static keyword if you think about how the compiler treats inline functions.
--- include/linux/bcma/bcma.h | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
include/linux/bcma/bcma.h +12 -11
@@ -205,50 +205,51 @@ struct bcma_bus {struct ssb_sprom sprom; }; -extern inline u32 bcma_read8 (struct bcma_device *core,u16 offset) +static inline u32 bcma_read8 (struct bcma_device *core,u16 offset) {return core->bus->ops->read8 (core, offset); } -extern inline u32 bcma_read16 (struct bcma_device *core,u16 offset) +static inline u32 bcma_read16 (struct bcma_device *core,u16 offset) {return core->bus->ops->read16 (core, offset); } -extern inline u32 bcma_read32 (struct bcma_device *core,u16 offset) +static inline u32 bcma_read32 (struct bcma_device *core,u16 offset) {return core->bus->ops->read32 (core, offset); } -extern inline +static inline void bcma_write8 (struct bcma_device *core,u16 offset,u32 value) { core->bus->ops->write8 (core, offset, value); } -extern inline +static inline void bcma_write16 (struct bcma_device *core,u16 offset,u32 value) { core->bus->ops->write16 (core, offset, value); } -extern inline +static inline void bcma_write32 (struct bcma_device *core,u16 offset,u32 value) { core->bus->ops->write32 (core, offset, value); }#ifdef CONFIG_BCMA_BLOCKIO -extern inline void bcma_block_read (struct bcma_device *core,void *buffer, +static inline void bcma_block_read (struct bcma_device *core,void *buffer,size_t count,u16 offset,u8 reg_width) { core->bus->ops->block_read (core, buffer, count, offset, reg_width); } -extern inline void bcma_block_write (struct bcma_device *core,const void *buffer, -size_t count,u16 offset,u8 reg_width) +static inline void bcma_block_write (struct bcma_device *core, +const void *buffer,size_t count, +u16 offset,u8 reg_width) { core->bus->ops->block_write (core, buffer, count, offset, reg_width); }#endif -extern inline u32 bcma_aread32 (struct bcma_device *core,u16 offset) +static inline u32 bcma_aread32 (struct bcma_device *core,u16 offset) {return core->bus->ops->aread32 (core, offset); } -extern inline +static inline void bcma_awrite32 (struct bcma_device *core,u16 offset,u32 value) { core->bus->ops->awrite32 (core, offset, value);
Signature · 1 line
1.7.5.4
PATCH 8/23 brcm80211: smac: move fields from struct si_pub to struct si_info
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The structure si_pub contained couple of fields that were only used internally in aiutils.c. These have been moved to the si_info structure.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 24 +++++++++++--------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 4 +- 2 files changed, 15 insertions(+), 13 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +13 -11
@@ -928,7 +928,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)/* get chipcommon chipstatus */ if (sii->pub.ccrev >=11 ) - sii->pub.chipst =R_REG (&cc->chipstatus); + sii->chipst =R_REG (&cc->chipstatus);/* get chipcommon capabilites */ sii->pub.cccaps =R_REG (&cc->capabilities);
@@ -942,7 +942,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)/* figure out bus/orignal core idx */ sii->pub.buscoretype =NODEV_CORE_ID ; sii->pub.buscorerev =NOREV ; - sii->pub.buscoreidx =BADIDX ; + sii->buscoreidx =BADIDX ; pci = pcie = false; pcirev = pcierev =NOREV ;
@@ -980,11 +980,11 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)if (pci) { sii->pub.buscoretype =PCI_CORE_ID ; sii->pub.buscorerev = pcirev; - sii->pub.buscoreidx = pciidx; + sii->buscoreidx = pciidx; }else if (pcie) { sii->pub.buscoretype =PCIE_CORE_ID ; sii->pub.buscorerev = pcierev; - sii->pub.buscoreidx = pcieidx; + sii->buscoreidx = pcieidx; }/* fixup necessary chip/core configurations */
@@ -1034,7 +1034,7 @@ static struct si_info *ai_doattach(struct si_info *sii, savewin =0 ; - sih->buscoreidx =BADIDX ; + sii->buscoreidx =BADIDX ; sii->curmap = regs; sii->pbus = pbus;
@@ -1372,7 +1372,7 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask, fast = true; r = (u32 __iomem *)((__iomem char *)sii->curmap +PCI_16KB0_CCREGS_OFFSET + regoff); - }else if (sii->pub.buscoreidx == coreidx) { + }else if (sii->buscoreidx == coreidx) {/* * pci registers are at either in the last 2KB of * an 8KB window or, in pcie and pci rev 13 at 8KB
@@ -1904,7 +1904,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask) siflag =ai_flag (sih);/* switch over to pci core */ - regs =ai_setcoreidx (sih, sii->pub.buscoreidx); + regs =ai_setcoreidx (sih, sii->buscoreidx); }/*
@@ -2035,8 +2035,9 @@ bool ai_deviceremoved(struct si_pub *sih)bool ai_is_sprom_available (struct si_pub *sih) { +struct si_info *sii = (struct si_info *)sih; +if (sih->ccrev >=31 ) { -struct si_info *sii;uint origidx;struct chipcregs __iomem *cc;u32 sromctrl;
@@ -2044,7 +2045,6 @@ bool ai_is_sprom_available(struct si_pub *sih)if ((sih->cccaps &CC_CAP_SROM ) ==0 )return false; - sii = (struct si_info *)sih; origidx = sii->curidx; cc =ai_setcoreidx (sih,SI_CC_IDX ); sromctrl =R_REG (&cc->sromcontrol);
@@ -2054,7 +2054,7 @@ bool ai_is_sprom_available(struct si_pub *sih)switch (sih->chip) {case BCM4313_CHIP_ID : -return (sih->chipst &CST4313_SPROM_PRESENT ) !=0 ; +return (sii->chipst &CST4313_SPROM_PRESENT ) !=0 ;default :return true; }
@@ -2062,9 +2062,11 @@ bool ai_is_sprom_available(struct si_pub *sih)bool ai_is_otp_disabled (struct si_pub *sih) { +struct si_info *sii = (struct si_info *)sih; +switch (sih->chip) {case BCM4313_CHIP_ID : -return (sih->chipst &CST4313_OTP_PRESENT ) ==0 ; +return (sii->chipst &CST4313_OTP_PRESENT ) ==0 ;/* These chips always have their OTP on */ case BCM43224_CHIP_ID :case BCM43225_CHIP_ID :
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +2 -2
@@ -146,7 +146,6 @@struct si_pub {uint buscoretype;/* PCI_CORE_ID, PCIE_CORE_ID, PCMCIA_CORE_ID */ uint buscorerev;/* buscore rev */ -uint buscoreidx;/* buscore index */ int ccrev;/* chip common core rev */ u32 cccaps;/* chip common capabilities */ int pmurev;/* pmu core rev */
@@ -156,7 +155,6 @@ struct si_pub {uint chip;/* chip number */ uint chiprev;/* chip revision */ uint chippkg;/* chip package option */ -u32 chipst;/* chip status */ };struct pci_dev ;
@@ -188,7 +186,9 @@ struct si_info {void __iomem *curmap;/* current regs va */ void __iomem *regs[SI_MAXCORES ];/* other regs va */ +u32 chipst;/* chip status */ uint curidx;/* current core index */ +uint buscoreidx;/* buscore index */ uint numcores;/* # discovered cores */ uint coreid[SI_MAXCORES ];/* id of each core */ u32 coresba[SI_MAXCORES ];/* backplane address of each core */
Signature · 1 line
1.7.5.4
PATCH 9/23 brcm80211: smac: use inline access functions for struct si_pub fields
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Instead of directly accessing the fields in struct si_pub the driver now uses inline access functions. This is in preparation of the bcma integration as a lot of information will be provided by bcma module.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 118 ++++++++++---------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 46 ++++++++ drivers/net/wireless/brcm80211/brcmsmac/main.c | 56 +++++----- drivers/net/wireless/brcm80211/brcmsmac/nicpci.c | 35 +++--- drivers/net/wireless/brcm80211/brcmsmac/otp.c | 20 ++-- .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 2 - .../net/wireless/brcm80211/brcmsmac/phy/phy_hal.h | 2 - .../net/wireless/brcm80211/brcmsmac/phy/phy_int.h | 2 - drivers/net/wireless/brcm80211/brcmsmac/pmu.c | 20 ++-- drivers/net/wireless/brcm80211/brcmsmac/srom.c | 4 +- 10 files changed, 174 insertions(+), 131 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +60 -58
@@ -321,9 +321,9 @@/* Newer chips can access PCI/PCIE and CC core without requiring to change * PCI BAR0 WIN */ -#define SI_FAST (si) (((si)->pub.buscoretype == PCIE_CORE_ID) || \ - (((si)->pub.buscoretype == PCI_CORE_ID) && \ - (si)->pub.buscorerev >= 13)) +#define SI_FAST (sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) || \ + ((ai_get_buscoretype(sih) == PCI_CORE_ID) && \ + ai_get_buscorerev(sih) >= 13))#define CCREGS_FAST (si) (((char __iomem *)((si)->curmap) + \ PCI_16KB0_CCREGS_OFFSET))
@@ -345,10 +345,10 @@ (si)->coreid[(si)->curidx] == (si)->dev_coreid) \ (*(si)->intrsrestore_fn)((si)->intr_arg, intr_val) -#define PCI (si) ((si)->pub.buscoretype == PCI_CORE_ID) -#define PCIE (si) ((si)->pub.buscoretype == PCIE_CORE_ID) +#define PCI (sih) (ai_get_buscoretype(sih) == PCI_CORE_ID) +#define PCIE (sih) (ai_get_buscoretype(sih) == PCIE_CORE_ID) -#define PCI_FORCEHT (si) (PCIE(si) && (si->pub.chip == BCM4716_CHIP_ID)) +#define PCI_FORCEHT (sih) (PCIE(sih) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID))#ifdef BCMDBG #define SI_MSG (fmt, ...) pr_debug(fmt, ##__VA_ARGS__)
@@ -927,14 +927,14 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx) sii->pub.ccrev = (int )ai_corerev (&sii->pub);/* get chipcommon chipstatus */ -if (sii->pub.ccrev >=11 ) +if (ai_get_ccrev (&sii->pub) >=11 ) sii->chipst =R_REG (&cc->chipstatus);/* get chipcommon capabilites */ sii->pub.cccaps =R_REG (&cc->capabilities);/* get pmu rev and caps */ -if (sii->pub.cccaps &CC_CAP_PMU ) { +if (ai_get_cccaps (&sii->pub) &CC_CAP_PMU ) { sii->pub.pmucaps =R_REG (&cc->pmucapabilities); sii->pub.pmurev = sii->pub.pmucaps &PCAP_REV_MASK ; }
@@ -988,7 +988,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx) }/* fixup necessary chip/core configurations */ -if (SI_FAST (sii)) { +if (SI_FAST (&sii->pub)) {if (!sii->pch) { sii->pch =pcicore_init (&sii->pub, sii->pbus, (__iomem void *)PCIEREGS (sii));
@@ -1097,7 +1097,7 @@ static struct si_info *ai_doattach(struct si_info *sii,ai_setcoreidx (sih, origidx);/* PMU specific initializations */ -if (sih->cccaps &CC_CAP_PMU ) { +if (ai_get_cccaps (sih) &CC_CAP_PMU ) {u32 xtalfreq;si_pmu_init (sih);si_pmu_chip_init (sih);
@@ -1115,15 +1115,15 @@ static struct si_info *ai_doattach(struct si_info *sii,ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , gpiotimerval), ~0 , w); -if (PCIE (sii)) +if (PCIE (sih))pcicore_attach (sii->pch,SI_DOATTACH ); -if (sih->chip ==BCM43224_CHIP_ID ) { +if (ai_get_chip_id (sih) ==BCM43224_CHIP_ID ) {/* * enable 12 mA drive strenth for 43224 and * set chipControl register bit 15 */ -if (sih->chiprev ==0 ) { +if (ai_get_chiprev (sih) ==0 ) {SI_MSG ("Applying 43224A0 WARs\n" ); ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, chipcontrol),
@@ -1132,14 +1132,14 @@ static struct si_info *ai_doattach(struct si_info *sii,si_pmu_chipcontrol (sih,0 ,CCTRL_43224A0_12MA_LED_DRIVE ,CCTRL_43224A0_12MA_LED_DRIVE ); } -if (sih->chiprev >=1 ) { +if (ai_get_chiprev (sih) >=1 ) {SI_MSG ("Applying 43224B0+ WARs\n" );si_pmu_chipcontrol (sih,0 ,CCTRL_43224B0_12MA_LED_DRIVE ,CCTRL_43224B0_12MA_LED_DRIVE ); } } -if (sih->chip ==BCM4313_CHIP_ID ) { +if (ai_get_chip_id (sih) ==BCM4313_CHIP_ID ) {/* * enable 12 mA drive strenth for 4313 and * set chipControl register bit 1
@@ -1249,7 +1249,7 @@ uint ai_coreidx(struct si_pub *sih)bool ai_backplane64 (struct si_pub *sih) { -return (sih->cccaps &CC_CAP_BKPLN64 ) !=0 ; +return (ai_get_cccaps (sih) &CC_CAP_BKPLN64 ) !=0 ; }/* return index of coreid or BADIDX if not found */
@@ -1299,7 +1299,7 @@ void __iomem *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx, sii = (struct si_info *)sih; -if (SI_FAST (sii)) { +if (SI_FAST (sih)) {/* Overloading the origidx variable to remember the coreid, * this works because the core ids cannot be confused with * core indices.
@@ -1307,7 +1307,7 @@ void __iomem *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx, *origidx = coreid;if (coreid ==CC_CORE_ID )return CCREGS_FAST (sii); -else if (coreid == sih->buscoretype) +else if (coreid ==ai_get_buscoretype (sih))return PCIEREGS (sii); }INTR_OFF (sii, *intr_val);
@@ -1322,8 +1322,8 @@ void ai_restore_core(struct si_pub *sih, uint coreid, uint intr_val)struct si_info *sii; sii = (struct si_info *)sih; -if (SI_FAST (sii) - && ((coreid ==CC_CORE_ID ) || (coreid == sih->buscoretype))) +if (SI_FAST (sih) + && ((coreid ==CC_CORE_ID ) || (coreid ==ai_get_buscoretype (sih))))return ;ai_setcoreidx (sih, coreid);
@@ -1367,7 +1367,7 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,* If pci/pcie, we can get at pci/pcie regs * and on newer cores to chipc */ -if ((sii->coreid[coreidx] ==CC_CORE_ID ) &&SI_FAST (sii)) { +if ((sii->coreid[coreidx] ==CC_CORE_ID ) &&SI_FAST (sih)) {/* Chipc registers are mapped at 12KB */ fast = true; r = (u32 __iomem *)((__iomem char *)sii->curmap +
@@ -1378,7 +1378,7 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,* an 8KB window or, in pcie and pci rev 13 at 8KB */ fast = true; -if (SI_FAST (sii)) +if (SI_FAST (sih)) r = (u32 __iomem *)((__iomem char *)sii->curmap +PCI_16KB0_PCIREGS_OFFSET + regoff);else
@@ -1480,13 +1480,13 @@ static uint ai_slowclk_src(struct si_info *sii)struct chipcregs __iomem *cc;u32 val; -if (sii->pub.ccrev <6 ) { +if (ai_get_ccrev (&sii->pub) <6 ) {pci_read_config_dword (sii->pbus,PCI_GPIO_OUT , &val);if (val &PCI_CFG_GPIO_SCS )return SCC_SS_PCI ;return SCC_SS_XTAL ; - }else if (sii->pub.ccrev <10 ) { + }else if (ai_get_ccrev (&sii->pub) <10 ) { cc = (struct chipcregs __iomem *)ai_setcoreidx (&sii->pub, sii->curidx);return R_REG (&cc->slow_clk_ctl) &SCC_SS_MASK ;
@@ -1505,14 +1505,14 @@ static uint ai_slowclk_freq(struct si_info *sii, bool max_freq,uint div; slowclk =ai_slowclk_src (sii); -if (sii->pub.ccrev <6 ) { +if (ai_get_ccrev (&sii->pub) <6 ) {if (slowclk ==SCC_SS_PCI )return max_freq ? (PCIMAXFREQ /64 ) : (PCIMINFREQ /64 );else return max_freq ? (XTALMAXFREQ /32 ) : (XTALMINFREQ /32 ); - }else if (sii->pub.ccrev <10 ) { + }else if (ai_get_ccrev (&sii->pub) <10 ) { div =4 * (((R_REG (&cc->slow_clk_ctl) &SCC_CD_MASK ) >>SCC_CD_SHIFT ) +1 );
@@ -1553,7 +1553,8 @@ ai_clkctl_setdelay(struct si_info *sii, struct chipcregs __iomem *cc)/* Starting with 4318 it is ILP that is used for the delays */ slowmaxfreq = -ai_slowclk_freq (sii, (sii->pub.ccrev >=10 ) ? false : true, cc); +ai_slowclk_freq (sii, + (ai_get_ccrev (&sii->pub) >=10 ) ? false : true, cc); pll_on_delay = ((slowmaxfreq * pll_delay) +999999 ) /1000000 ; fref_sel_delay = ((slowmaxfreq *FREF_DELAY ) +999999 ) /1000000 ;
@@ -1570,11 +1571,11 @@ void ai_clkctl_init(struct si_pub *sih)struct chipcregs __iomem *cc;bool fast; -if (!(sih->cccaps &CC_CAP_PWR_CTL )) +if (!(ai_get_cccaps (sih) &CC_CAP_PWR_CTL ))return ; sii = (struct si_info *)sih; - fast =SI_FAST (sii); + fast =SI_FAST (sih);if (!fast) { origidx = sii->curidx; cc = (struct chipcregs __iomem *)
@@ -1588,7 +1589,7 @@ void ai_clkctl_init(struct si_pub *sih) }/* set all Instaclk chip ILP to 1 MHz */ -if (sih->ccrev >=10 ) +if (ai_get_ccrev (sih) >=10 )SET_REG (&cc->system_clk_ctl,SYCC_CD_MASK , (ILP_DIV_1MHZ <<SYCC_CD_SHIFT ));
@@ -1613,17 +1614,17 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)bool fast; sii = (struct si_info *)sih; -if (sih->cccaps &CC_CAP_PMU ) { +if (ai_get_cccaps (sih) &CC_CAP_PMU ) {INTR_OFF (sii, intr_val); fpdelay =si_pmu_fast_pwrup_delay (sih);INTR_RESTORE (sii, intr_val);return fpdelay; } -if (!(sih->cccaps &CC_CAP_PWR_CTL )) +if (!(ai_get_cccaps (sih) &CC_CAP_PWR_CTL ))return 0 ; - fast =SI_FAST (sii); + fast =SI_FAST (sih); fpdelay =0 ;if (!fast) { origidx = sii->curidx;
@@ -1659,7 +1660,7 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on) sii = (struct si_info *)sih;/* pcie core doesn't have any mapping to control the xtal pu */ -if (PCIE (sii)) +if (PCIE (sih))return -1 ;pci_read_config_dword (sii->pbus,PCI_GPIO_IN , &in);
@@ -1720,10 +1721,10 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)struct chipcregs __iomem *cc;u32 scc;uint intr_val =0 ; -bool fast =SI_FAST (sii); +bool fast =SI_FAST (&sii->pub);/* chipcommon cores prior to rev6 don't support dynamic clock control */ -if (sii->pub.ccrev <6 ) +if (ai_get_ccrev (&sii->pub) <6 )return false;if (!fast) {
@@ -1737,12 +1738,13 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode) goto done; } -if (!(sii->pub.cccaps &CC_CAP_PWR_CTL ) && (sii->pub.ccrev <20 )) +if (!(ai_get_cccaps (&sii->pub) &CC_CAP_PWR_CTL ) && + (ai_get_ccrev (&sii->pub) <20 )) goto done;switch (mode) {case CLK_FAST :/* FORCEHT, fast (pll) clock */ -if (sii->pub.ccrev <10 ) { +if (ai_get_ccrev (&sii->pub) <10 ) {/* * don't forget to force xtal back * on before we clear SCC_DYN_XTAL..
@@ -1750,14 +1752,14 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)ai_clkctl_xtal (&sii->pub,XTAL ,ON );SET_REG (&cc->slow_clk_ctl, (SCC_XC |SCC_FS |SCC_IP ),SCC_IP ); - }else if (sii->pub.ccrev <20 ) { + }else if (ai_get_ccrev (&sii->pub) <20 ) {OR_REG (&cc->system_clk_ctl,SYCC_HR ); }else {OR_REG (&cc->clk_ctl_st,CCS_FORCEHT ); }/* wait for the PLL */ -if (sii->pub.cccaps &CC_CAP_PMU ) { +if (ai_get_cccaps (&sii->pub) &CC_CAP_PMU ) {u32 htavail =CCS_HTAVAIL ;SPINWAIT (((R_REG (&cc->clk_ctl_st) & htavail) ==0 ),PMU_MAX_TRANSITION_DLY );
@@ -1767,7 +1769,7 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)break ;case CLK_DYNAMIC :/* enable dynamic clock control */ -if (sii->pub.ccrev <10 ) { +if (ai_get_ccrev (&sii->pub) <10 ) { scc =R_REG (&cc->slow_clk_ctl); scc &= ~(SCC_FS |SCC_IP |SCC_XC );if ((scc &SCC_SS_MASK ) !=SCC_SS_XTAL )
@@ -1780,7 +1782,7 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)*/ if (scc &SCC_XC )ai_clkctl_xtal (&sii->pub,XTAL ,OFF ); - }else if (sii->pub.ccrev <20 ) { + }else if (ai_get_ccrev (&sii->pub) <20 ) {/* Instaclock */ AND_REG (&cc->system_clk_ctl, ~SYCC_HR ); }else {
@@ -1815,10 +1817,10 @@ bool ai_clkctl_cc(struct si_pub *sih, uint mode) sii = (struct si_info *)sih;/* chipcommon cores prior to rev6 don't support dynamic clock control */ -if (sih->ccrev <6 ) +if (ai_get_ccrev (sih) <6 )return false; -if (PCI_FORCEHT (sii)) +if (PCI_FORCEHT (sih))return mode ==CLK_FAST ;return _ai_clkctl_cc (sii, mode);
@@ -1851,10 +1853,10 @@ void ai_pci_up(struct si_pub *sih) sii = (struct si_info *)sih; -if (PCI_FORCEHT (sii)) +if (PCI_FORCEHT (sih))_ai_clkctl_cc (sii,CLK_FAST ); -if (PCIE (sii)) +if (PCIE (sih))pcicore_up (sii->pch,SI_PCIUP ); }
@@ -1877,7 +1879,7 @@ void ai_pci_down(struct si_pub *sih) sii = (struct si_info *)sih;/* release FORCEHT since chip is going to "down" state */ -if (PCI_FORCEHT (sii)) +if (PCI_FORCEHT (sih))_ai_clkctl_cc (sii,CLK_DYNAMIC );pcicore_down (sii->pch,SI_PCIDOWN );
@@ -1896,7 +1898,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask) sii = (struct si_info *)sih; -if (PCI (sii)) { +if (PCI (sih)) {/* get current core index */ idx = sii->curidx;
@@ -1911,7 +1913,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)* Enable sb->pci interrupts. Assume * PCI rev 2.3 support was added in pci core rev 6 and things changed.. */ -if (PCIE (sii) || (PCI (sii) && ((sii->pub.buscorerev) >=6 ))) { +if (PCIE (sih) || (PCI (sih) && (ai_get_buscorerev (sih) >=6 ))) {/* pci config write to set this core bit in PCIIntMask */ pci_read_config_dword (sii->pbus,PCI_INT_MASK , &w); w |= (coremask <<PCI_SBIM_SHIFT );
@@ -1921,7 +1923,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)ai_setint (sih, siflag); } -if (PCI (sii)) { +if (PCI (sih)) {pcicore_pci_setup (sii->pch, regs);/* switch back to previous core */
@@ -1944,11 +1946,11 @@ int ai_pci_fixcfg(struct si_pub *sih) origidx =ai_coreidx (&sii->pub);/* check 'pi' is correct and fix it if not */ - regs =ai_setcore (&sii->pub, sii->pub.buscoretype,0 ); -if (sii->pub.buscoretype ==PCIE_CORE_ID ) + regs =ai_setcore (&sii->pub,ai_get_buscoretype (sih),0 ); +if (ai_get_buscoretype (sih) ==PCIE_CORE_ID )pcicore_fixcfg_pcie (sii->pch, (struct sbpcieregs __iomem *)regs); -else if (sii->pub.buscoretype ==PCI_CORE_ID ) +else if (ai_get_buscoretype (sih) ==PCI_CORE_ID )pcicore_fixcfg_pci (sii->pch, (struct sbpciregs __iomem *)regs);/* restore the original index */
@@ -1982,7 +1984,7 @@ void ai_chipcontrl_epa4331(struct si_pub *sih, bool on) val =R_REG (&cc->chipcontrol);if (on) { -if (sih->chippkg ==9 || sih->chippkg ==0xb ) +if (ai_get_chippkg (sih) ==9 ||ai_get_chippkg (sih) ==0xb )/* Ext PA Controls for 4331 12x9 Package */ W_REG(&cc->chipcontrol, val | CCTRL4331_EXTPA_EN |
@@ -2037,12 +2039,12 @@ bool ai_is_sprom_available(struct si_pub *sih) {struct si_info *sii = (struct si_info *)sih; -if (sih->ccrev >=31 ) { +if (ai_get_ccrev (sih) >=31 ) {uint origidx;struct chipcregs __iomem *cc;u32 sromctrl; -if ((sih->cccaps &CC_CAP_SROM ) ==0 ) +if ((ai_get_cccaps (sih) &CC_CAP_SROM ) ==0 )return false; origidx = sii->curidx;
@@ -2052,7 +2054,7 @@ bool ai_is_sprom_available(struct si_pub *sih)return sromctrl &SRC_PRESENT ; } -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM4313_CHIP_ID :return (sii->chipst &CST4313_SPROM_PRESENT ) !=0 ;default :
@@ -2064,7 +2066,7 @@ bool ai_is_otp_disabled(struct si_pub *sih) {struct si_info *sii = (struct si_info *)sih; -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM4313_CHIP_ID :return (sii->chipst &CST4313_OTP_PRESENT ) ==0 ;/* These chips always have their OTP on */
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +46 -0
50 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/main.c +27 -29
152 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/nicpci.c +19 -16
@@ -224,9 +224,9 @@ struct pcicore_info { };#define PCIE_ASPM (sih) \ - (((sih)->buscoretype == PCIE_CORE_ID) && \ - (((sih)->buscorerev >= 3) && \ - ((sih)->buscorerev <= 5))) + ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && \ + ((ai_get_buscorerev(sih) >= 3) && \ + (ai_get_buscorerev(sih) <= 5)))/* delay needed between the mdio control/ mdiodata register data access */
@@ -251,7 +251,7 @@ struct pcicore_info *pcicore_init(struct si_pub *sih, struct pci_dev *pdev, pi->sih = sih; pi->dev = pdev; -if (sih->buscoretype ==PCIE_CORE_ID ) { +if (ai_get_buscoretype (sih) ==PCIE_CORE_ID ) {u8 cap_ptr; pi->regs.pcieregs = regs; cap_ptr = pcicore_find_pci_capability(pi->dev, PCI_CAP_ID_EXP,
@@ -504,7 +504,8 @@ static void pcie_extendL1timer(struct pcicore_info *pi, bool extend)struct si_pub *sih = pi->sih;struct sbpcieregs __iomem *pcieregs = pi->regs.pcieregs; -if (sih->buscoretype !=PCIE_CORE_ID || sih->buscorerev <7 ) +if (ai_get_buscoretype (sih) !=PCIE_CORE_ID || +ai_get_buscorerev (sih) <7 )return ; w =pcie_readreg (pcieregs,PCIE_PCIEREGS ,PCIE_DLLP_PMTHRESHREG );
@@ -527,7 +528,8 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)pcie_clkreq (pi,1 ,0 );break ;case SI_PCIDOWN : -if (sih->buscorerev ==6 ) {/* turn on serdes PLL down */ +/* turn on serdes PLL down */ +if (ai_get_buscorerev (sih) ==6 ) {ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , chipcontrol_addr), ~0 ,0 );
@@ -539,7 +541,8 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state) }break ;case SI_PCIUP : -if (sih->buscorerev ==6 ) {/* turn off serdes PLL down */ +/* turn off serdes PLL down */ +if (ai_get_buscorerev (sih) ==6 ) {ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , chipcontrol_addr), ~0 ,0 );
@@ -678,7 +681,7 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)struct sbpcieregs __iomem *pcieregs = pi->regs.pcieregs;u32 w; -if (sih->buscorerev ==0 || sih->buscorerev ==1 ) { +if (ai_get_buscorerev (sih) ==0 ||ai_get_buscorerev (sih) ==1 ) { w =pcie_readreg (pcieregs,PCIE_PCIEREGS ,PCIE_TLP_WORKAROUNDSREG ); w |=0x8 ;
@@ -686,13 +689,13 @@ static void pcie_war_pci_setup(struct pcicore_info *pi) PCIE_TLP_WORKAROUNDSREG, w); } -if (sih->buscorerev ==1 ) { +if (ai_get_buscorerev (sih) ==1 ) { w =pcie_readreg (pcieregs,PCIE_PCIEREGS ,PCIE_DLLP_LCREG ); w |=0x40 ;pcie_writereg (pcieregs,PCIE_PCIEREGS ,PCIE_DLLP_LCREG , w); } -if (sih->buscorerev ==0 ) { +if (ai_get_buscorerev (sih) ==0 ) {pcie_mdiowrite (pi,MDIODATA_DEV_RX ,SERDES_RX_TIMER1 ,0x8128 );pcie_mdiowrite (pi,MDIODATA_DEV_RX ,SERDES_RX_CDR ,0x0100 );pcie_mdiowrite (pi,MDIODATA_DEV_RX ,SERDES_RX_CDRBW ,0x1466 );
@@ -708,13 +711,13 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)pcie_war_serdes (pi);pcie_war_aspm_clkreq (pi); - }else if (pi->sih->buscorerev ==7 ) + }else if (ai_get_buscorerev (pi->sih) ==7 )pcie_war_noplldown (pi);/* Note that the fix is actually in the SROM, * that's why this is open-ended */ -if (pi->sih->buscorerev >=6 ) +if (ai_get_buscorerev (pi->sih) >=6 )pcie_misc_config_fixup (pi); }
@@ -745,7 +748,7 @@ void pcicore_attach(struct pcicore_info *pi, int state)void pcicore_hwup (struct pcicore_info *pi) { -if (!pi || pi->sih->buscoretype !=PCIE_CORE_ID ) +if (!pi ||ai_get_buscoretype (pi->sih) !=PCIE_CORE_ID )return ;pcie_war_pci_setup (pi);
@@ -753,7 +756,7 @@ void pcicore_hwup(struct pcicore_info *pi)void pcicore_up (struct pcicore_info *pi,int state) { -if (!pi || pi->sih->buscoretype !=PCIE_CORE_ID ) +if (!pi ||ai_get_buscoretype (pi->sih) !=PCIE_CORE_ID )return ;/* Restore L1 timer for better performance */
@@ -781,7 +784,7 @@ void pcicore_sleep(struct pcicore_info *pi)void pcicore_down (struct pcicore_info *pi,int state) { -if (!pi || pi->sih->buscoretype !=PCIE_CORE_ID ) +if (!pi ||ai_get_buscoretype (pi->sih) !=PCIE_CORE_ID )return ;pcie_clkreq_upd (pi, state);
@@ -826,7 +829,7 @@ pcicore_pci_setup(struct pcicore_info *pi, struct sbpciregs __iomem *pciregs)OR_REG (&pciregs->sbtopci2,SBTOPCI_PREF |SBTOPCI_BURST ); -if (((struct si_info *)(pi->sih))->pub.buscorerev >=11 ) { +if (ai_get_buscorerev (pi->sih) >=11 ) {OR_REG (&pciregs->sbtopci2,SBTOPCI_RC_READMULTI ); w =R_REG (&pciregs->clkrun);W_REG (&pciregs->clkrun, w |PCI_CLKRUN_DSBL );
drivers/net/wireless/brcm80211/brcmsmac/otp.c +10 -10
@@ -146,7 +146,7 @@ static int ipxotp_max_rgnsz(struct si_pub *sih, int osizew) {int ret =0 ; -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM43224_CHIP_ID :case BCM43225_CHIP_ID : ret = osizew *2 -OTP_SZ_FU_72 -OTP_SZ_CHECKSUM ;
@@ -170,10 +170,10 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs __iomem *cc)* record word offset of General Use Region * for various chipcommon revs */ -if (oi->sih->ccrev ==21 || oi->sih->ccrev ==24 - || oi->sih->ccrev ==27 ) { +if (oi->ccrev ==21 || oi->ccrev ==24 + || oi->ccrev ==27 ) { oi->otpgu_base =REVA4_OTPGU_BASE ; - }else if (oi->sih->ccrev ==36 ) { + }else if (oi->ccrev ==36 ) {/* * OTP size greater than equal to 2KB (128 words), * otpgu_base is similar to rev23
@@ -182,7 +182,7 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs __iomem *cc) oi->otpgu_base =REVB8_OTPGU_BASE ; else oi->otpgu_base = REV36_OTPGU_BASE; - }else if (oi->sih->ccrev ==23 || oi->sih->ccrev >=25 ) { + }else if (oi->ccrev ==23 || oi->ccrev >=25 ) { oi->otpgu_base =REVB8_OTPGU_BASE ; }
@@ -201,8 +201,8 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs __iomem *cc)/* Read OTP lock bits and subregion programmed indication bits */ oi->status =R_REG (&cc->otpstatus); -if ((oi->sih->chip ==BCM43224_CHIP_ID ) - || (oi->sih->chip ==BCM43225_CHIP_ID )) { +if ((ai_get_chip_id (oi->sih) ==BCM43224_CHIP_ID ) + || (ai_get_chip_id (oi->sih) ==BCM43225_CHIP_ID )) {u32 p_bits; p_bits = (ipxotp_otpr(oi, cc, oi->otpgu_base + OTPGU_P_OFF) &
@@ -244,7 +244,7 @@ static int ipxotp_init(struct si_pub *sih, struct otpinfo *oi)struct chipcregs __iomem *cc;/* Make sure we're running IPX OTP */ -if (!OTPTYPE_IPX (sih->ccrev)) +if (!OTPTYPE_IPX (oi->ccrev))return -EBADE ;/* Make sure OTP is not disabled */
@@ -252,7 +252,7 @@ static int ipxotp_init(struct si_pub *sih, struct otpinfo *oi)return -EBADE ;/* Check for otp size */ -switch ((sih->cccaps &CC_CAP_OTPSIZE ) >>CC_CAP_OTPSIZE_SHIFT ) { +switch ((ai_get_cccaps (sih) &CC_CAP_OTPSIZE ) >>CC_CAP_OTPSIZE_SHIFT ) {case 0 :/* Nothing there */ return -EBADE ;
@@ -389,7 +389,7 @@ static int otp_init(struct si_pub *sih, struct otpinfo *oi)memset (oi,0 ,sizeof (struct otpinfo )); - oi->ccrev = sih->ccrev; + oi->ccrev =ai_get_ccrev (sih);if (OTPTYPE_IPX (oi->ccrev)) oi->fn = &ipxotp_fn;
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c +0 -2
@@ -404,10 +404,8 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp) sh->sromrev = shp->sromrev; sh->boardtype = shp->boardtype; sh->boardrev = shp->boardrev; - sh->boardvendor = shp->boardvendor; sh->boardflags = shp->boardflags; sh->boardflags2 = shp->boardflags2; - sh->buscorerev = shp->buscorerev; sh->fast_timer =PHY_SW_TIMER_FAST ; sh->slow_timer =PHY_SW_TIMER_SLOW ;
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h +0 -2
@@ -166,7 +166,6 @@ struct shared_phy_params {struct phy_shim_info *physhim;uint unit;uint corerev; -uint buscorerev;u16 vid;u16 did;uint chip;
@@ -175,7 +174,6 @@ struct shared_phy_params {uint sromrev;uint boardtype;uint boardrev; -uint boardvendor;u32 boardflags;u32 boardflags2; };
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h +0 -2
@@ -503,10 +503,8 @@ struct shared_phy {uint sromrev;uint boardtype;uint boardrev; -uint boardvendor;u32 boardflags;u32 boardflags2; -uint buscorerev;uint fast_timer;uint slow_timer;uint glacial_timer;
drivers/net/wireless/brcm80211/brcmsmac/pmu.c +10 -10
@@ -115,10 +115,10 @@ static void si_pmu_res_masks(struct si_pub *sih, u32 * pmin, u32 * pmax)uint rsrcs;/* # resources */ - rsrcs = (sih->pmucaps &PCAP_RC_MASK ) >>PCAP_RC_SHIFT ; + rsrcs = (ai_get_pmucaps (sih) &PCAP_RC_MASK ) >>PCAP_RC_SHIFT ;/* determine min/max rsrc masks */ -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM43224_CHIP_ID :case BCM43225_CHIP_ID :/* ??? */
@@ -145,7 +145,7 @@ si_pmu_spuravoid_pllupdate(struct si_pub *sih, struct chipcregs __iomem *cc, {u32 tmp =0 ; -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM43224_CHIP_ID :case BCM43225_CHIP_ID :if (spuravoid ==1 ) {
@@ -207,7 +207,7 @@ u16 si_pmu_fast_pwrup_delay(struct si_pub *sih) {uint delay =PMU_MAX_TRANSITION_DLY ; -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM43224_CHIP_ID :case BCM43225_CHIP_ID :case BCM4313_CHIP_ID :
@@ -276,10 +276,10 @@ u32 si_pmu_alp_clock(struct si_pub *sih)u32 clock =ALP_CLOCK ;/* bail out with default */ -if (!(sih->cccaps &CC_CAP_PMU )) +if (!(ai_get_cccaps (sih) &CC_CAP_PMU ))return clock; -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM43224_CHIP_ID :case BCM43225_CHIP_ID :case BCM4313_CHIP_ID :
@@ -319,9 +319,9 @@ void si_pmu_init(struct si_pub *sih) origidx =ai_coreidx (sih); cc =ai_setcoreidx (sih,SI_CC_IDX ); -if (sih->pmurev ==1 ) +if (ai_get_pmurev (sih) ==1 )AND_REG (&cc->pmucontrol, ~PCTL_NOILP_ON_WAIT ); -else if (sih->pmurev >=2 ) +else if (ai_get_pmurev (sih) >=2 )OR_REG (&cc->pmucontrol,PCTL_NOILP_ON_WAIT );/* Return to original core */
@@ -358,7 +358,7 @@ void si_pmu_pll_init(struct si_pub *sih, uint xtalfreq) origidx =ai_coreidx (sih); cc =ai_setcoreidx (sih,SI_CC_IDX ); -switch (sih->chip) { +switch (ai_get_chip_id (sih)) {case BCM4313_CHIP_ID :case BCM43224_CHIP_ID :case BCM43225_CHIP_ID :
@@ -411,7 +411,7 @@ u32 si_pmu_measure_alpclk(struct si_pub *sih)uint origidx;u32 alp_khz; -if (sih->pmurev <10 ) +if (ai_get_pmurev (sih) <10 )return 0 ;/* Remember original core before switch to chipc */
drivers/net/wireless/brcm80211/brcmsmac/srom.c +2 -2
@@ -589,9 +589,9 @@ static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE];static u8 __iomem *srom_window_address (struct si_pub *sih,u8 __iomem *curmap) { -if (sih->ccrev <32 ) +if (ai_get_ccrev (sih) <32 )return curmap +PCI_BAR0_SPROM_OFFSET ; -if (sih->cccaps &CC_CAP_SROM ) +if (ai_get_cccaps (sih) &CC_CAP_SROM )return curmap +PCI_16KB0_CCREGS_OFFSET +CC_SROM_OTP ;return NULL ;
Signature · 1 line
1.7.5.4
PATCH 12/23 brcm80211: smac: rename struct si_info field pbus to pcibus
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
When moving to bcma usage there are two busses in play. The pci bus connecting the device to the host and the bcma bus connecting the cores in the device. To distinguish this the attribute pbus has been renamed to a more explicit name, ie. pcibus.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 46 ++++++++++---------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 2 +- drivers/net/wireless/brcm80211/brcmsmac/dma.c | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +23 -23
@@ -564,7 +564,7 @@ static void ai_scan(struct si_pub *sih, struct chipcregs __iomem *cc) sii->curwrap = (void *)((unsigned long )cc +SI_CORE_SIZE );/* Now point the window at the erom */ -pci_write_config_dword (sii->pbus,PCI_BAR0_WIN , erombase); +pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN , erombase); eromptr = regs; eromlim = eromptr + (ER_REMAPCONTROL /sizeof (u32));
@@ -741,9 +741,9 @@ void __iomem *ai_setcoreidx(struct si_pub *sih, uint coreidx)return NULL ;/* point bar0 window */ -pci_write_config_dword (sii->pbus,PCI_BAR0_WIN , addr); +pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN , addr);/* point bar0 2nd 4KB window */ -pci_write_config_dword (sii->pbus,PCI_BAR0_WIN2 , wrap); +pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN2 , wrap); sii->curidx = coreidx;return sii->curmap;
@@ -880,7 +880,7 @@ static bool ai_ispcie(struct si_info *sii)u8 cap_ptr; cap_ptr = -pcicore_find_pci_capability (sii->pbus,PCI_CAP_ID_EXP ,NULL , +pcicore_find_pci_capability (sii->pcibus,PCI_CAP_ID_EXP ,NULL ,NULL );if (!cap_ptr)return false;
@@ -990,7 +990,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)/* fixup necessary chip/core configurations */ if (SI_FAST (&sii->pub)) {if (!sii->pch) { - sii->pch =pcicore_init (&sii->pub, sii->pbus, + sii->pch =pcicore_init (&sii->pub, sii->pcibus, (__iomem void *)PCIEREGS (sii));if (sii->pch ==NULL )return false;
@@ -1015,7 +1015,7 @@ static __used void ai_nvram_process(struct si_info *sii)uint w =0 ;/* do a pci config read to get subsystem id and subvendor id */ -pci_read_config_dword (sii->pbus,PCI_SUBSYSTEM_VENDOR_ID , &w); +pci_read_config_dword (sii->pcibus,PCI_SUBSYSTEM_VENDOR_ID , &w); sii->pub.boardvendor = w &0xffff ; sii->pub.boardtype = (w >>16 ) &0xffff ;
@@ -1037,14 +1037,14 @@ static struct si_info *ai_doattach(struct si_info *sii, sii->buscoreidx =BADIDX ; sii->curmap = regs; - sii->pbus = pbus; + sii->pcibus = pbus;/* find Chipcommon address */ -pci_read_config_dword (sii->pbus,PCI_BAR0_WIN , &savewin); +pci_read_config_dword (sii->pcibus,PCI_BAR0_WIN , &savewin);if (!GOODCOREADDR (savewin,SI_ENUM_BASE )) savewin =SI_ENUM_BASE ; -pci_write_config_dword (sii->pbus,PCI_BAR0_WIN , +pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN ,SI_ENUM_BASE ); cc = (struct chipcregs __iomem *) regs;
@@ -1481,7 +1481,7 @@ static uint ai_slowclk_src(struct si_info *sii)u32 val;if (ai_get_ccrev (&sii->pub) <6 ) { -pci_read_config_dword (sii->pbus,PCI_GPIO_OUT , +pci_read_config_dword (sii->pcibus,PCI_GPIO_OUT , &val);if (val &PCI_CFG_GPIO_SCS )return SCC_SS_PCI ;
@@ -1663,9 +1663,9 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on)if (PCIE (sih))return -1 ; -pci_read_config_dword (sii->pbus,PCI_GPIO_IN , &in); -pci_read_config_dword (sii->pbus,PCI_GPIO_OUT , &out); -pci_read_config_dword (sii->pbus,PCI_GPIO_OUTEN , &outen); +pci_read_config_dword (sii->pcibus,PCI_GPIO_IN , &in); +pci_read_config_dword (sii->pcibus,PCI_GPIO_OUT , &out); +pci_read_config_dword (sii->pcibus,PCI_GPIO_OUTEN , &outen);/* * Avoid glitching the clock if GPRS is already using it.
@@ -1686,9 +1686,9 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on) out |=PCI_CFG_GPIO_XTAL ;if (what &PLL ) out |=PCI_CFG_GPIO_PLL ; -pci_write_config_dword (sii->pbus, +pci_write_config_dword (sii->pcibus,PCI_GPIO_OUT , out); -pci_write_config_dword (sii->pbus, +pci_write_config_dword (sii->pcibus,PCI_GPIO_OUTEN , outen);udelay (XTAL_ON_DELAY ); }
@@ -1696,7 +1696,7 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on)/* turn pll on */ if (what &PLL ) { out &= ~PCI_CFG_GPIO_PLL ; -pci_write_config_dword (sii->pbus, +pci_write_config_dword (sii->pcibus,PCI_GPIO_OUT , out);mdelay (2 ); }
@@ -1705,9 +1705,9 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on) out &= ~PCI_CFG_GPIO_XTAL ;if (what &PLL ) out |=PCI_CFG_GPIO_PLL ; -pci_write_config_dword (sii->pbus, +pci_write_config_dword (sii->pcibus,PCI_GPIO_OUT , out); -pci_write_config_dword (sii->pbus, +pci_write_config_dword (sii->pcibus,PCI_GPIO_OUTEN , outen); }
@@ -1835,9 +1835,9 @@ int ai_devpath(struct si_pub *sih, char *path, int size)return -1 ; slen =snprintf (path, (size_t ) size,"pci/%u/%u/" , - ((struct si_info *)sih)->pbus->bus->number, + ((struct si_info *)sih)->pcibus->bus->number,PCI_SLOT (((struct pci_dev *) - (((struct si_info *)(sih))->pbus))->devfn)); + (((struct si_info *)(sih))->pcibus))->devfn));if (slen <0 || slen >= size) { path[0 ] ='\0' ;
@@ -1915,9 +1915,9 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)*/ if (PCIE (sih) || (PCI (sih) && (ai_get_buscorerev (sih) >=6 ))) {/* pci config write to set this core bit in PCIIntMask */ -pci_read_config_dword (sii->pbus,PCI_INT_MASK , &w); +pci_read_config_dword (sii->pcibus,PCI_INT_MASK , &w); w |= (coremask <<PCI_SBIM_SHIFT ); -pci_write_config_dword (sii->pbus,PCI_INT_MASK , w); +pci_write_config_dword (sii->pcibus,PCI_INT_MASK , w); }else {/* set sbintvec bit for our flag number */ ai_setint (sih, siflag);
@@ -2028,7 +2028,7 @@ bool ai_deviceremoved(struct si_pub *sih) sii = (struct si_info *)sih; -pci_read_config_dword (sii->pbus,PCI_VENDOR_ID , &w); +pci_read_config_dword (sii->pcibus,PCI_VENDOR_ID , &w);if ((w &0xFFFF ) !=PCI_VENDOR_ID_BROADCOM )return true;
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +1 -1
@@ -170,7 +170,7 @@ struct gpioh_item {/* misc si info needed by some of the routines */ struct si_info {struct si_pub pub;/* back plane public state (must be first) */ -struct pci_dev *pbus;/* handle to pci bus */ +struct pci_dev *pcibus;/* handle to pci bus */ uint dev_coreid;/* the core provides driver functions */ void *intr_arg;/* interrupt callback function arg */ u32 (*intrsoff_fn) (void *intr_arg);/* turns chip interrupts off */
drivers/net/wireless/brcm80211/brcmsmac/dma.c +1 -1
@@ -594,7 +594,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,strncpy (di->name, name,MAXNAMEL ); di->name[MAXNAMEL -1 ] ='\0' ; - di->pbus = ((struct si_info *)sih)->pbus; + di->pbus = ((struct si_info *)sih)->pcibus;/* save tunables */ di->ntxd = (u16 ) ntxd;
Signature · 1 line
1.7.5.4
PATCH 13/23 brcm80211: smac: change ai_attach interface taking a bcma_bus object
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The ai_attach now takes a bcma_bus object as its parameter to obtain all required information needed for chip control.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 18 +++++++++--------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 5 ++++- drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +9 -9
@@ -1022,22 +1022,25 @@ static __used void ai_nvram_process(struct si_info *sii) }static struct si_info *ai_doattach (struct si_info *sii, -void __iomem *regs,struct pci_dev *pbus) +struct bcma_bus *pbus) { +void __iomem *regs = pbus->mmio;struct si_pub *sih = &sii->pub;u32 w, savewin;struct chipcregs __iomem *cc;uint socitype;uint origidx; +/* assume the window is looking at chipcommon */ +WARN_ON (pbus->mapped_core->id.id !=BCMA_CORE_CHIPCOMMON );memset ((unsigned char *) sii,0 ,sizeof (struct si_info )); savewin =0 ; + sii->icbus = pbus; sii->buscoreidx =BADIDX ; - sii->curmap = regs; - sii->pcibus = pbus; + sii->pcibus = pbus->host_pci;/* find Chipcommon address */ pci_read_config_dword (sii->pcibus,PCI_BAR0_WIN , &savewin);
@@ -1160,13 +1163,10 @@ static struct si_info *ai_doattach(struct si_info *sii, }/* -* Allocate a si handle. -* devid - pci device id (used to determine chip#) -* osh - opaque OS handle -* regs - virtual address of initial core registers +* Allocate a si handle and do the attach. */ struct si_pub * -ai_attach (void __iomem *regs,struct pci_dev *sdh) +ai_attach (struct bcma_bus *pbus) {struct si_info *sii;
@@ -1175,7 +1175,7 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh)if (sii ==NULL )return NULL ; -if (ai_doattach (sii, regs, sdh) ==NULL ) { +if (ai_doattach (sii, pbus) ==NULL ) {kfree (sii);return NULL ; }
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +4 -1
@@ -17,6 +17,8 @@#ifndef _BRCM_AIUTILS_H_#define _BRCM_AIUTILS_H_ +#include <linux/bcma/bcma.h> +#include "types.h" /*
@@ -170,6 +172,7 @@ struct gpioh_item {/* misc si info needed by some of the routines */ 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 */ uint dev_coreid;/* the core provides driver functions */ void *intr_arg;/* interrupt callback function arg */
@@ -235,7 +238,7 @@ extern u32 ai_addrspacesize(struct si_pub *sih, uint asidx);extern void ai_write_wrap_reg (struct si_pub *sih,u32 offset,u32 val);/* === exported functions === */ -extern struct si_pub *ai_attach (void __iomem *regs,struct pci_dev *sdh); +extern struct si_pub *ai_attach (struct bcma_bus *pbus);extern void ai_detach (struct si_pub *sih);extern uint ai_coreid (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih);
drivers/net/wireless/brcm80211/brcmsmac/main.c +1 -1
@@ -4469,7 +4469,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,* Do the hardware portion of the attach. Also initialize software * state that depends on the particular hardware we are running. */ - wlc_hw->sih =ai_attach (core->bus->mmio, core->bus->host_pci); + wlc_hw->sih =ai_attach (core->bus);if (wlc_hw->sih ==NULL ) {wiphy_err (wiphy,"wl%d: brcms_b_attach: si_attach failed\n" , unit);
Signature · 1 line
1.7.5.4
PATCH 14/23 brcm80211: smac: remove enumeration rom parsing function
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The core enumeration rom is already parsed by the bcma bus driver and there is no need to repeat the exercise. The ai_scan() function still exists but is targetted for removal as well.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 257 ++------------------- 1 files changed, 19 insertions(+), 238 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +18 -237
@@ -481,247 +481,27 @@ struct aidmp {u32 componentid3;/* 0xffc */ }; -/* EROM parsing */ - -static u32 -get_erom_ent (struct si_pub *sih,u32 __iomem **eromptr,u32 mask,u32 match) -{ -u32 ent; -uint inv =0 , nom =0 ; - -while (true) { - ent =R_REG (*eromptr); - (*eromptr)++; - -if (mask ==0 ) -break ; - -if ((ent &ER_VALID ) ==0 ) { - inv++; -continue ; - } - -if (ent == (ER_END |ER_VALID )) -break ; - -if ((ent & mask) == match) -break ; - - nom++; - } - -return ent; -} - -static u32 -get_asd (struct si_pub *sih,u32 __iomem **eromptr,uint sp,uint ad,uint st, -u32 *addrl,u32 *addrh,u32 *sizel,u32 *sizeh) -{ -u32 asd, sz, szd; - - asd =get_erom_ent (sih, eromptr,ER_VALID ,ER_VALID ); -if (((asd &ER_TAG1 ) !=ER_ADD ) || - (((asd &AD_SP_MASK ) >>AD_SP_SHIFT ) != sp) || - ((asd &AD_ST_MASK ) != st)) { -/* This is not what we want, "push" it back */ - (*eromptr)--; -return 0 ; - } - *addrl = asd &AD_ADDR_MASK ; -if (asd &AD_AG32 ) - *addrh =get_erom_ent (sih, eromptr,0 ,0 ); -else - *addrh =0 ; - *sizeh =0 ; - sz = asd &AD_SZ_MASK ; -if (sz ==AD_SZ_SZD ) { - szd =get_erom_ent (sih, eromptr,0 ,0 ); - *sizel = szd &SD_SZ_MASK ; -if (szd &SD_SG32 ) - *sizeh =get_erom_ent (sih, eromptr,0 ,0 ); - }else - *sizel =AD_SZ_BASE << (sz >>AD_SZ_SHIFT ); - -return asd; -} - -static void ai_hwfixup (struct si_info *sii) -{ -} -/* parse the enumeration rom to identify all cores */ -static void ai_scan (struct si_pub *sih,struct chipcregs __iomem *cc) +static void ai_scan (struct si_pub *sih,struct bcma_bus *bus) {struct si_info *sii = (struct si_info *)sih; +struct bcma_device *core; +uint idx; -u32 erombase; -u32 __iomem *eromptr, *eromlim; -void __iomem *regs = cc; - - erombase =R_REG (&cc->eromptr); - -/* Set wrappers address */ - sii->curwrap = (void *)((unsigned long )cc +SI_CORE_SIZE ); - -/* Now point the window at the erom */ -pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN , erombase); - eromptr = regs; - eromlim = eromptr + (ER_REMAPCONTROL /sizeof (u32)); - -while (eromptr < eromlim) { -u32 cia, cib, cid, mfg, crev, nmw, nsw, nmp, nsp; -u32 mpd, asd, addrl, addrh, sizel, sizeh; -u32 __iomem *base; -uint i, j, idx; -bool br; - - br = false; - -/* Grok a component */ - cia =get_erom_ent (sih, &eromptr,ER_TAG ,ER_CI ); -if (cia == (ER_END |ER_VALID )) { -/* Found END of erom */ -ai_hwfixup (sii); -return ; - } - base = eromptr -1 ; - cib =get_erom_ent (sih, &eromptr,0 ,0 ); - -if ((cib &ER_TAG ) !=ER_CI ) { -/* CIA not followed by CIB */ - goto error; - } - - cid = (cia &CIA_CID_MASK ) >>CIA_CID_SHIFT ; - mfg = (cia &CIA_MFG_MASK ) >>CIA_MFG_SHIFT ; - crev = (cib &CIB_REV_MASK ) >>CIB_REV_SHIFT ; - nmw = (cib &CIB_NMW_MASK ) >>CIB_NMW_SHIFT ; - nsw = (cib &CIB_NSW_MASK ) >>CIB_NSW_SHIFT ; - nmp = (cib &CIB_NMP_MASK ) >>CIB_NMP_SHIFT ; - nsp = (cib &CIB_NSP_MASK ) >>CIB_NSP_SHIFT ; - -if (((mfg ==MFGID_ARM ) && (cid ==DEF_AI_COMP )) || (nsp ==0 )) -continue ; -if ((nmw + nsw ==0 )) { -/* A component which is not a core */ -if (cid ==OOB_ROUTER_CORE_ID ) { - asd =get_asd (sih, &eromptr,0 ,0 ,AD_ST_SLAVE , - &addrl, &addrh, &sizel, &sizeh); -if (asd !=0 ) - sii->oob_router = addrl; - } -continue ; - } - - idx = sii->numcores; -/* sii->eromptr[idx] = base; */ - sii->cia[idx] = cia; - sii->cib[idx] = cib; - sii->coreid[idx] = cid; - -for (i =0 ; i < nmp; i++) { - mpd =get_erom_ent (sih, &eromptr,ER_VALID ,ER_VALID ); -if ((mpd &ER_TAG ) !=ER_MP ) { -/* Not enough MP entries for component */ - goto error; - } - } - -/* First Slave Address Descriptor should be port 0: -* the main register space for the core -*/ - asd = -get_asd (sih, &eromptr,0 ,0 ,AD_ST_SLAVE , &addrl, &addrh, - &sizel, &sizeh); -if (asd ==0 ) { -/* Try again to see if it is a bridge */ - asd = -get_asd (sih, &eromptr,0 ,0 ,AD_ST_BRIDGE , &addrl, - &addrh, &sizel, &sizeh); -if (asd !=0 ) - br = true; -else if ((addrh !=0 ) || (sizeh !=0 ) - || (sizel !=SI_CORE_SIZE )) { -/* First Slave ASD for core malformed */ - goto error; - } - } - sii->coresba[idx] = addrl; - sii->coresba_size[idx] = sizel; -/* Get any more ASDs in port 0 */ - j =1 ; -do { - asd = -get_asd (sih, &eromptr,0 , j,AD_ST_SLAVE , &addrl, - &addrh, &sizel, &sizeh); -if ((asd !=0 ) && (j ==1 ) && (sizel ==SI_CORE_SIZE )) { - sii->coresba2[idx] = addrl; - sii->coresba2_size[idx] = sizel; - } - j++; - }while (asd !=0 ); - -/* Go through the ASDs for other slave ports */ -for (i =1 ; i < nsp; i++) { - j =0 ; -do { - asd = -get_asd (sih, &eromptr, i, j++,AD_ST_SLAVE , - &addrl, &addrh, &sizel, &sizeh); - }while (asd !=0 ); -if (j ==0 ) { -/* SP has no address descriptors */ - goto error; - } - } - -/* Now get master wrappers */ -for (i =0 ; i < nmw; i++) { - asd = -get_asd (sih, &eromptr, i,0 ,AD_ST_MWRAP , &addrl, - &addrh, &sizel, &sizeh); -if (asd ==0 ) { -/* Missing descriptor for MW */ - goto error; - } -if ((sizeh !=0 ) || (sizel !=SI_CORE_SIZE )) { -/* Master wrapper %d is not 4KB */ - goto error; - } -if (i ==0 ) - sii->wrapba[idx] = addrl; - } - -/* And finally slave wrappers */ -for (i =0 ; i < nsw; i++) { -uint fwp = (nsp ==1 ) ?0 :1 ; - asd = -get_asd (sih, &eromptr, fwp + i,0 ,AD_ST_SWRAP , - &addrl, &addrh, &sizel, &sizeh); -if (asd ==0 ) { -/* Missing descriptor for SW */ - goto error; - } -if ((sizeh !=0 ) || (sizel !=SI_CORE_SIZE )) { -/* Slave wrapper is not 4KB */ - goto error; - } -if ((nmw ==0 ) && (i ==0 )) - sii->wrapba[idx] = addrl; - } - -/* Don't record bridges */ -if (br) -continue ; - -/* Done with core */ +list_for_each_entry (core, &bus->cores, list) { + idx = core->core_index; + sii->cia[idx] = core->id.manuf <<CIA_MFG_SHIFT ; + sii->cia[idx] |= core->id.id <<CIA_CID_SHIFT ; + sii->cia[idx] |= core->id.class <<CIA_CCL_SHIFT ; + sii->cib[idx] = core->id.rev <<CIB_REV_SHIFT ; + sii->coreid[idx] = core->id.id; + sii->coresba[idx] = core->addr; + sii->coresba_size[idx] =0x1000 ; + sii->coresba2[idx] =0 ; + sii->coresba2_size[idx] =0 ; + sii->wrapba[idx] = core->wrap; sii->numcores++; } - - error: -/* Reached end of erom without finding END */ - sii->numcores =0 ; -return ; }/*
@@ -1039,8 +819,9 @@ static struct si_info *ai_doattach(struct si_info *sii, sii->icbus = pbus; sii->buscoreidx =BADIDX ; - sii->curmap = regs; sii->pcibus = pbus->host_pci; + sii->curmap = regs; + sii->curwrap = sii->curmap +SI_CORE_SIZE ;/* find Chipcommon address */ pci_read_config_dword (sii->pcibus,PCI_BAR0_WIN , &savewin);
@@ -1073,7 +854,7 @@ static struct si_info *ai_doattach(struct si_info *sii,if (socitype ==SOCI_AI ) {SI_MSG ("Found chip type AI (0x%08x)\n" , w);/* pass chipc address instead of original core base */ -ai_scan (&sii->pub, cc); +ai_scan (&sii->pub, pbus); }else {/* Found chip of unknown type */ return NULL ;
Signature · 1 line
1.7.5.4
PATCH 15/23 brcm80211: smac: use bcma core register access functions for 802.11 core
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The driver now uses the bcma register access functions to read and write the registers on the 802.11 core. The dma and phy code need to be modified next and access to the other cores. That will be done in coming patches.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 48 ++- drivers/net/wireless/brcm80211/brcmsmac/ampdu.c | 7 +- drivers/net/wireless/brcm80211/brcmsmac/d11.h | 3 + drivers/net/wireless/brcm80211/brcmsmac/main.c | 479 ++++++++++----------- drivers/net/wireless/brcm80211/brcmsmac/main.h | 4 +- 5 files changed, 274 insertions(+), 267 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +26 -22
@@ -504,6 +504,17 @@ static void ai_scan(struct si_pub *sih, struct bcma_bus *bus) } } +static struct bcma_device *ai_find_bcma_core (struct si_pub *sih,uint coreidx) +{ +struct si_info *sii = (struct si_info *)sih; +struct bcma_device *core; + +list_for_each_entry (core, &sii->icbus->cores, list) { +if (core->core_index == coreidx) +return core; + } +return NULL ; +}/* * This function changes the logical "focus" to the indicated core. * Return the current core's virtual address. Since each core starts with the
@@ -514,18 +525,16 @@ static void ai_scan(struct si_pub *sih, struct bcma_bus *bus)void __iomem *ai_setcoreidx (struct si_pub *sih,uint coreidx) {struct si_info *sii = (struct si_info *)sih; -u32 addr = sii->coresba[coreidx]; -u32 wrap = sii->wrapba[coreidx]; - -if (coreidx >= sii->numcores) -return NULL ; +struct bcma_device *core; -/* point bar0 window */ -pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN , addr); -/* point bar0 2nd 4KB window */ -pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN2 , wrap); - sii->curidx = coreidx; +if (sii->curidx != coreidx) { + core =ai_find_bcma_core (sih, coreidx); +if (core ==NULL ) +return NULL ; + (void )bcma_aread32 (core,BCMA_IOST ); + sii->curidx = coreidx; + }return sii->curmap; }
@@ -811,8 +820,6 @@ static struct si_info *ai_doattach(struct si_info *sii,uint socitype;uint origidx; -/* assume the window is looking at chipcommon */ -WARN_ON (pbus->mapped_core->id.id !=BCMA_CORE_CHIPCOMMON );memset ((unsigned char *) sii,0 ,sizeof (struct si_info )); savewin =0 ;
@@ -823,13 +830,10 @@ static struct si_info *ai_doattach(struct si_info *sii, sii->curmap = regs; sii->curwrap = sii->curmap +SI_CORE_SIZE ; -/* find Chipcommon address */ -pci_read_config_dword (sii->pcibus,PCI_BAR0_WIN , &savewin); -if (!GOODCOREADDR (savewin,SI_ENUM_BASE )) - savewin =SI_ENUM_BASE ; +/* switch to Chipcommon core */ +bcma_read32 (pbus->drv_cc.core,0 ); + savewin =SI_ENUM_BASE ; -pci_write_config_dword (sii->pcibus,PCI_BAR0_WIN , -SI_ENUM_BASE ); cc = (struct chipcregs __iomem *) regs;/* bus/core/clk setup for register access */
@@ -1036,18 +1040,18 @@ bool ai_backplane64(struct si_pub *sih)/* return index of coreid or BADIDX if not found */ uint ai_findcoreidx (struct si_pub *sih,uint coreid,uint coreunit) { +struct bcma_device *core;struct si_info *sii;uint found; -uint i; sii = (struct si_info *)sih; found =0 ; -for (i =0 ; i < sii->numcores; i++) -if (sii->coreid[i] == coreid) { +list_for_each_entry (core, &sii->icbus->cores, list) +if (core->id.id == coreid) {if (found == coreunit) -return i; +return core->core_index; found++; }
drivers/net/wireless/brcm80211/brcmsmac/ampdu.c +5 -2
@@ -1118,14 +1118,17 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,u8 status_delay =0 ;/* wait till the next 8 bytes of txstatus is available */ -while (((s1 =R_REG (&wlc->regs->frmtxstatus)) &TXS_V ) ==0 ) { + s1 =bcma_read32 (wlc->hw->d11core,D11REGOFFS (frmtxstatus)); +while ((s1 &TXS_V ) ==0 ) {udelay (1 ); status_delay++;if (status_delay >10 )return ;/* error condition */ + s1 =bcma_read32 (wlc->hw->d11core, +D11REGOFFS (frmtxstatus)); } - s2 =R_REG (&wlc->regs->frmtxstatus2); + s2 =bcma_read32 (wlc->hw->d11core,D11REGOFFS (frmtxstatus2)); }if (scb) {
drivers/net/wireless/brcm80211/brcmsmac/d11.h +3 -0
@@ -430,6 +430,9 @@ struct d11regs {u16 PAD [0x380 ];/* 0x800 - 0xEFE */ }; +/* d11 register field offset */ +#define D11REGOFFS (field) offsetof(struct d11regs, field) +#define PIHR_BASE 0x0400/* byte address of packed IHR region */ /* biststatus */
drivers/net/wireless/brcm80211/brcmsmac/main.c +239 -240
1,072 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/main.h +1 -3
@@ -334,7 +334,7 @@ struct brcms_hardware {u32 machwcap_backup;/* backup of machwcap */ struct si_pub *sih;/* SI handle (cookie for siutils calls) */ -struct d11regs __iomem *regs;/* pointer to device registers */ +struct bcma_device *d11core;/* pointer to 802.11 core */ struct phy_shim_info *physhim;/* phy shim layer handler */ struct shared_phy *phy_sh;/* pointer to shared phy state */ struct brcms_hw_band *band;/* pointer to active per-band state */
@@ -400,7 +400,6 @@ struct brcms_txq_info {* * pub: pointer to driver public state. * wl: pointer to specific private state. -* regs: pointer to device registers. * hw: HW related state. * clkreq_override: setting for clkreq for PCIE : Auto, 0, 1. * fastpwrup_dly: time in us needed to bring up d11 fast clock.
@@ -477,7 +476,6 @@ struct brcms_txq_info {struct brcms_c_info {struct brcms_pub *pub;struct brcms_info *wl; -struct d11regs __iomem *regs;struct brcms_hardware *hw;/* clock */
Signature · 1 line
1.7.5.4
PATCH 20/23 brcm80211: smac: replace ai_corereg() function with ai_cc_reg()
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
The ai_corereg() function is only used in the driver to safely access the chipcommon core. The function has been renamed to ai_cc_reg() removing the need to provide a core index parameter.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 36 +++++++------------ drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 5 +-- drivers/net/wireless/brcm80211/brcmsmac/main.c | 16 ++++---- drivers/net/wireless/brcm80211/brcmsmac/nicpci.c | 28 ++++++++-------- .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 36 ++++++++++---------- .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c | 6 ++-- drivers/net/wireless/brcm80211/brcmsmac/pmu.c | 28 ++++++--------- 7 files changed, 68 insertions(+), 87 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +13 -23
@@ -885,8 +885,8 @@ static struct si_info *ai_doattach(struct si_info *sii, w =getintvar (sih,BRCMS_SROM_LEDDC );if (w ==0 ) w =DEFAULT_GPIOTIMERVAL ; -ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , gpiotimerval), - ~0 , w); +ai_cc_reg (sih, offsetof(struct chipcregs , gpiotimerval), + ~0 , w);if (PCIE (sih))pcicore_attach (sii->pch,SI_DOATTACH );
@@ -898,10 +898,9 @@ static struct si_info *ai_doattach(struct si_info *sii,*/ if (ai_get_chiprev (sih) ==0 ) {SI_MSG ("Applying 43224A0 WARs\n" ); -ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol), -CCTRL43224_GPIO_TOGGLE , -CCTRL43224_GPIO_TOGGLE ); +ai_cc_reg (sih, offsetof(struct chipcregs , chipcontrol), +CCTRL43224_GPIO_TOGGLE , +CCTRL43224_GPIO_TOGGLE );si_pmu_chipcontrol (sih,0 ,CCTRL_43224A0_12MA_LED_DRIVE ,CCTRL_43224A0_12MA_LED_DRIVE ); }
@@ -1104,41 +1103,32 @@ void ai_write_wrapperreg(struct si_pub *sih, u32 offset, u32 val)* Also, when using pci/pcie, we can optimize away the core switching for pci * registers and (on newer pci cores) chipcommon registers. */ -uint ai_corereg (struct si_pub *sih,uint coreidx,uint regoff,uint mask, -uint val) +uint ai_cc_reg (struct si_pub *sih,uint regoff,u32 mask,u32 val) { +struct bcma_device *cc;uint origidx =0 ; -u32 __iomem *r =NULL ; -uint w; +u32 w;uint intr_val =0 ;struct si_info *sii; sii = (struct si_info *)sih; - -if (coreidx >=SI_MAXCORES ) -return 0 ; + cc = sii->icbus->drv_cc.core;INTR_OFF (sii, intr_val);/* save current core index */ origidx =ai_coreidx (&sii->pub); -/* switch core */ - r = (u32 __iomem *) ((unsigned char __iomem *) -ai_setcoreidx (&sii->pub, coreidx) + regoff); -/* mask and set */ if (mask || val) { - w = (R_REG (r) & ~mask) | val; -W_REG (r, w); +bcma_maskset32 (cc, regoff, ~mask, val); }/* readback */ - w =R_REG (r); + w =bcma_read32 (cc, regoff);/* restore core index */ -if (origidx != coreidx) -ai_setcoreidx (&sii->pub, origidx); +ai_setcoreidx (&sii->pub, origidx);INTR_RESTORE (sii, intr_val);
@@ -1664,7 +1654,7 @@ u32 ai_gpiocontrol(struct si_pub *sih, u32 mask, u32 val, u8 priority)uint regoff; regoff = offsetof(struct chipcregs , gpiocontrol); -return ai_corereg (sih,SI_CC_IDX , regoff, mask, val); +return ai_cc_reg (sih, regoff, mask, val); }void ai_chipcontrl_epa4331 (struct si_pub *sih,bool on)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +1 -4
@@ -228,8 +228,6 @@ extern bool ai_iscoreup(struct si_pub *sih);extern u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val);extern void ai_core_cflags_wo (struct si_pub *sih,u32 mask,u32 val);extern u32 ai_core_sflags (struct si_pub *sih,u32 mask,u32 val); -extern uint ai_corereg (struct si_pub *sih,uint coreidx,uint regoff,uint mask, -uint val);extern void ai_core_reset (struct si_pub *sih,u32 bits,u32 resetbits);extern void ai_core_disable (struct si_pub *sih,u32 bits);extern int ai_numaddrspaces (struct si_pub *sih);
@@ -242,8 +240,7 @@ extern struct si_pub *ai_attach(struct bcma_bus *pbus);extern void ai_detach (struct si_pub *sih);extern uint ai_coreid (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih); -extern uint ai_corereg (struct si_pub *sih,uint coreidx,uint regoff,uint mask, -uint val); +extern uint ai_cc_reg (struct si_pub *sih,uint regoff,u32 mask,u32 val);extern void ai_write_wrapperreg (struct si_pub *sih,u32 offset,u32 val);extern u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val);extern u32 ai_core_sflags (struct si_pub *sih,u32 mask,u32 val);
drivers/net/wireless/brcm80211/brcmsmac/main.c +8 -8
@@ -1709,17 +1709,17 @@ void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) {BCMMSG (wlc_hw->wlc->wiphy,"wl%d\n" , wlc_hw->unit); -ai_corereg (wlc_hw->sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_addr), ~0 ,0 ); +ai_cc_reg (wlc_hw->sih, offsetof(struct chipcregs , chipcontrol_addr), + ~0 ,0 );udelay (1 ); -ai_corereg (wlc_hw->sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_data),0x4 ,0 ); +ai_cc_reg (wlc_hw->sih, offsetof(struct chipcregs , chipcontrol_data), +0x4 ,0 );udelay (1 ); -ai_corereg (wlc_hw->sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_data),0x4 ,4 ); +ai_cc_reg (wlc_hw->sih, offsetof(struct chipcregs , chipcontrol_data), +0x4 ,4 );udelay (1 ); -ai_corereg (wlc_hw->sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_data),0x4 ,0 ); +ai_cc_reg (wlc_hw->sih, offsetof(struct chipcregs , chipcontrol_data), +0x4 ,0 );udelay (1 ); }
drivers/net/wireless/brcm80211/brcmsmac/nicpci.c +14 -14
@@ -530,12 +530,12 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)case SI_PCIDOWN :/* turn on serdes PLL down */ if (ai_get_buscorerev (sih) ==6 ) { -ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_addr), - ~0 ,0 ); -ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_data), - ~0x40 ,0 ); +ai_cc_reg (sih, + offsetof(struct chipcregs , chipcontrol_addr), + ~0 ,0 ); +ai_cc_reg (sih, + offsetof(struct chipcregs , chipcontrol_data), + ~0x40 ,0 ); }else if (pi->pcie_pr42767) {pcie_clkreq (pi,1 ,1 ); }
@@ -543,12 +543,12 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)case SI_PCIUP :/* turn off serdes PLL down */ if (ai_get_buscorerev (sih) ==6 ) { -ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_addr), - ~0 ,0 ); -ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_data), - ~0x40 ,0x40 ); +ai_cc_reg (sih, + offsetof(struct chipcregs , chipcontrol_addr), + ~0 ,0 ); +ai_cc_reg (sih, + offsetof(struct chipcregs , chipcontrol_data), + ~0x40 ,0x40 ); }else if (PCIE_ASPM (sih)) {/* disable clkreq */ pcie_clkreq (pi,1 ,0 ); }
@@ -666,8 +666,8 @@ static void pcie_war_noplldown(struct pcicore_info *pi)u16 __iomem *reg16;/* turn off serdes PLL down */ -ai_corereg (pi->sih,SI_CC_IDX , offsetof(struct chipcregs , chipcontrol), -CHIPCTRL_4321_PLL_DOWN ,CHIPCTRL_4321_PLL_DOWN ); +ai_cc_reg (pi->sih, offsetof(struct chipcregs , chipcontrol), +CHIPCTRL_4321_PLL_DOWN ,CHIPCTRL_4321_PLL_DOWN );/* clear srom shadow backdoor */ reg16 = &pcieregs->sprom[SRSH_BD_OFFSET ];
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c +18 -18
@@ -2905,29 +2905,29 @@ void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)mod_phy_reg (pi,0x44c , (0x1 <<2 ), (1 ) <<2 ); } -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , gpiocontrol), - ~0x0 ,0x0 ); -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , gpioout),0x40 , -0x40 ); -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , gpioouten),0x40 , -0x40 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , gpiocontrol), + ~0x0 ,0x0 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , gpioout), +0x40 ,0x40 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , gpioouten), +0x40 ,0x40 ); }else {mod_phy_reg (pi,0x44c , (0x1 <<2 ), (0 ) <<2 );mod_phy_reg (pi,0x44d , (0x1 <<2 ), (0 ) <<2 ); -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , gpioout),0x40 , -0x00 ); -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , gpioouten),0x40 , -0x0 ); -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , gpiocontrol), - ~0x0 ,0x40 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , gpioout), +0x40 ,0x00 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , gpioouten), +0x40 ,0x0 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , gpiocontrol), + ~0x0 ,0x40 ); } } }
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c +3 -3
@@ -19461,9 +19461,9 @@ void wlc_phy_init_nphy(struct brcms_phy *pi) (pi->sh->chippkg == BCM4718_PKG_ID))) {if ((pi->sh->boardflags &BFL_EXTLNA ) && (CHSPEC_IS2G (pi->radio_chanspec))) -ai_corereg (pi->sh->sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol), -0x40 ,0x40 ); +ai_cc_reg (pi->sh->sih, + offsetof(struct chipcregs , chipcontrol), +0x40 ,0x40 ); } if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) &&
drivers/net/wireless/brcm80211/brcmsmac/pmu.c +11 -17
@@ -236,38 +236,32 @@ void si_pmu_sprom_enable(struct si_pub *sih, bool enable)/* Read/write a chipcontrol reg */ u32 si_pmu_chipcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val) { -ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , chipcontrol_addr), - ~0 , reg); -return ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , chipcontrol_data), mask, - val); +ai_cc_reg (sih, offsetof(struct chipcregs , chipcontrol_addr), ~0 , reg); +return ai_cc_reg (sih, offsetof(struct chipcregs , chipcontrol_data), + mask, val); }/* Read/write a regcontrol reg */ u32 si_pmu_regcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val) { -ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , regcontrol_addr), - ~0 , reg); -return ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , regcontrol_data), mask, - val); +ai_cc_reg (sih, offsetof(struct chipcregs , regcontrol_addr), ~0 , reg); +return ai_cc_reg (sih, offsetof(struct chipcregs , regcontrol_data), + mask, val); }/* Read/write a pllcontrol reg */ u32 si_pmu_pllcontrol (struct si_pub *sih,uint reg,u32 mask,u32 val) { -ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , pllcontrol_addr), - ~0 , reg); -return ai_corereg (sih,SI_CC_IDX , - offsetof(struct chipcregs , pllcontrol_data), mask, - val); +ai_cc_reg (sih, offsetof(struct chipcregs , pllcontrol_addr), ~0 , reg); +return ai_cc_reg (sih, offsetof(struct chipcregs , pllcontrol_data), + mask, val); }/* PMU PLL update */ void si_pmu_pllupd (struct si_pub *sih) { -ai_corereg (sih,SI_CC_IDX , offsetof(struct chipcregs , pmucontrol), -PCTL_PLL_PLLCTL_UPD ,PCTL_PLL_PLLCTL_UPD ); +ai_cc_reg (sih, offsetof(struct chipcregs , pmucontrol), +PCTL_PLL_PLLCTL_UPD ,PCTL_PLL_PLLCTL_UPD ); }/* query alp/xtal clock frequency */
Signature · 1 line
1.7.5.4
PATCH 22/23 brcm80211: smac: use bcma core control functions
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
BCMA provides functions to control the state of the cores so using that and remove similar implementation from the driver.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 102 -------------------- drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 6 +- drivers/net/wireless/brcm80211/brcmsmac/dma.c | 3 +- drivers/net/wireless/brcm80211/brcmsmac/main.c | 72 ++++++++------ .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 4 +- 5 files changed, 47 insertions(+), 140 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +0 -102
@@ -535,36 +535,6 @@ uint ai_corerev(struct si_pub *sih)return (cib &CIB_REV_MASK ) >>CIB_REV_SHIFT ; } -bool ai_iscoreup (struct si_pub *sih) -{ -struct si_info *sii; -struct aidmp *ai; - - sii = (struct si_info *)sih; - ai = sii->curwrap; - -return (((R_REG (&ai->ioctrl) & (SICF_FGC |SICF_CLOCK_EN )) == -SICF_CLOCK_EN ) - && ((R_REG (&ai->resetctrl) &AIRC_RESET ) ==0 )); -} - -u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val) -{ -struct si_info *sii; -struct aidmp *ai; -u32 w; - - sii = (struct si_info *)sih; - ai = sii->curwrap; - -if (mask || val) { - w = ((R_REG (&ai->ioctrl) & ~mask) | val); -W_REG (&ai->ioctrl, w); - } - -return R_REG (&ai->ioctrl); -} -/* return true if PCIE capability exists in the pci config space */ static bool ai_ispcie (struct si_info *sii) {
@@ -587,23 +557,6 @@ static bool ai_buscore_prep(struct si_info *sii)return true; } -u32 ai_core_sflags (struct si_pub *sih,u32 mask,u32 val) -{ -struct si_info *sii; -struct aidmp *ai; -u32 w; - - sii = (struct si_info *)sih; - ai = sii->curwrap; - -if (mask || val) { - w = ((R_REG (&ai->iostatus) & ~mask) | val); -W_REG (&ai->iostatus, w); - } - -return R_REG (&ai->iostatus); -} -static bool ai_buscore_setup (struct si_info *sii,u32 savewin,uint *origidx) {
@@ -1037,61 +990,6 @@ uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val)return w; } -void ai_core_disable (struct si_pub *sih,u32 bits) -{ -struct si_info *sii; -u32 dummy; -struct aidmp *ai; - - sii = (struct si_info *)sih; - - ai = sii->curwrap; - -/* if core is already in reset, just return */ -if (R_REG (&ai->resetctrl) &AIRC_RESET ) -return ; - -W_REG (&ai->ioctrl, bits); - dummy =R_REG (&ai->ioctrl); -udelay (10 ); - -W_REG (&ai->resetctrl,AIRC_RESET ); -udelay (1 ); -} - -/* reset and re-enable a core -* inputs: -* bits - core specific bits that are set during and after reset sequence -* resetbits - core specific bits that are set only during reset sequence -*/ -void ai_core_reset (struct si_pub *sih,u32 bits,u32 resetbits) -{ -struct si_info *sii; -struct aidmp *ai; -u32 dummy; - - sii = (struct si_info *)sih; - ai = sii->curwrap; - -/* -* Must do the disable sequence first to work -* for arbitrary current core state. -*/ -ai_core_disable (sih, (bits | resetbits)); - -/* -* Now do the initialization sequence. -*/ -W_REG (&ai->ioctrl, (bits |SICF_FGC |SICF_CLOCK_EN )); - dummy =R_REG (&ai->ioctrl); -W_REG (&ai->resetctrl,0 ); -udelay (1 ); - -W_REG (&ai->ioctrl, (bits |SICF_CLOCK_EN )); - dummy =R_REG (&ai->ioctrl); -udelay (1 ); -} -/* return the slow clock source - LPO, XTAL, or PCI */ static uint ai_slowclk_src (struct si_info *sii) {
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +1 -5
@@ -221,11 +221,7 @@ struct si_info {/* AMBA Interconnect exported externs */ extern uint ai_coreidx (struct si_pub *sih);extern uint ai_corerev (struct si_pub *sih); -extern bool ai_iscoreup (struct si_pub *sih); -extern u32 ai_core_cflags (struct si_pub *sih,u32 mask,u32 val); -extern u32 ai_core_sflags (struct si_pub *sih,u32 mask,u32 val); -extern void ai_core_reset (struct si_pub *sih,u32 bits,u32 resetbits); -extern void ai_core_disable (struct si_pub *sih,u32 bits); +extern u32 ai_core_cflags (struct bcma_device *core,u32 mask,u32 val);/* === exported functions === */ extern struct si_pub *ai_attach (struct bcma_bus *pbus);
drivers/net/wireless/brcm80211/brcmsmac/dma.c +2 -1
@@ -581,7 +581,8 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, di->msg_level = msg_level ? msg_level : &dma_msg_level; - di->dma64 = ((ai_core_sflags (sih,0 ,0 ) &SISF_DMA64 ) ==SISF_DMA64 ); + di->dma64 = + ((bcma_aread32 (d11core,BCMA_IOST ) &SISF_DMA64 ) ==SISF_DMA64 );/* init dma reg info */ di->d11core = d11core;
drivers/net/wireless/brcm80211/brcmsmac/main.c +42 -30
190 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c +2 -2
@@ -437,7 +437,7 @@ wlc_phy_attach(struct shared_phy *sh, struct bcma_device *d11core,if (D11REV_IS (sh->corerev,4 )) sflags =SISF_2G_PHY |SISF_5G_PHY ;else - sflags =ai_core_sflags (sh->sih,0 ,0 ); + sflags =bcma_aread32 (d11core,BCMA_IOST );if (bandtype ==BRCM_BAND_5G ) {if ((sflags & (SISF_5G_PHY |SISF_DB_PHY )) ==0 )
@@ -761,7 +761,7 @@ void wlc_phy_init(struct brcms_phy_pub *pih, u16 chanspec)if (!(pi->measure_hold &PHY_HOLD_FOR_SCAN )) pi->measure_hold |=PHY_HOLD_FOR_NOT_ASSOC ; -if (WARN (!(ai_core_sflags (pi->sh->sih,0 ,0 ) &SISF_FCLKA ), +if (WARN (!(bcma_aread32 (pi->d11core,BCMA_IOST ) &SISF_FCLKA ),"HW error SISF_FCLKA\n" ))return ;
Signature · 1 line
1.7.5.4
PATCH 23/23 brcm80211: smac: use bcma core access functions in nicpci.c
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Code in nicpci.c now uses the PCI(E) core as provided by the BCMA bus driver to configure that core.
--- drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 11 +- drivers/net/wireless/brcm80211/brcmsmac/nicpci.c | 179 ++++++++++----------- drivers/net/wireless/brcm80211/brcmsmac/nicpci.h | 11 +- 3 files changed, 90 insertions(+), 111 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +3 -8
@@ -633,8 +633,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)/* fixup necessary chip/core configurations */ if (!sii->pch) { - sii->pch =pcicore_init (&sii->pub, sii->pcibus, - sii->curmap +PCI_16KB0_PCIREGS_OFFSET ); + sii->pch =pcicore_init (&sii->pub, sii->icbus->drv_pci.core);if (sii->pch ==NULL )return false; }
@@ -1385,7 +1384,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask) }if (PCI (sih)) { -pcicore_pci_setup (sii->pch, regs); +pcicore_pci_setup (sii->pch);/* switch back to previous core */ ai_setcoreidx (sih, idx);
@@ -1408,11 +1407,7 @@ int ai_pci_fixcfg(struct si_pub *sih)/* check 'pi' is correct and fix it if not */ regs =ai_setcore (&sii->pub,ai_get_buscoretype (sih),0 ); -if (ai_get_buscoretype (sih) ==PCIE_CORE_ID ) -pcicore_fixcfg_pcie (sii->pch, - (struct sbpcieregs __iomem *)regs); -else if (ai_get_buscoretype (sih) ==PCI_CORE_ID ) -pcicore_fixcfg_pci (sii->pch, (struct sbpciregs __iomem *)regs); +pcicore_fixcfg (sii->pch);/* restore the original index */ ai_setcoreidx (&sii->pub, origidx);
drivers/net/wireless/brcm80211/brcmsmac/nicpci.c +84 -95
397 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/nicpci.h +3 -8
@@ -62,8 +62,7 @@ struct sbpciregs;struct sbpcieregs ;extern struct pcicore_info *pcicore_init (struct si_pub *sih, -struct pci_dev *pdev, -void __iomem *regs); +struct bcma_device *core);extern void pcicore_deinit (struct pcicore_info *pch);extern void pcicore_attach (struct pcicore_info *pch,int state);extern void pcicore_hwup (struct pcicore_info *pch);
@@ -72,11 +71,7 @@ extern void pcicore_sleep(struct pcicore_info *pch);extern void pcicore_down (struct pcicore_info *pch,int state);extern u8 pcicore_find_pci_capability (struct pci_dev *dev,u8 req_cap_id,unsigned char *buf,u32 *buflen); -extern void pcicore_fixcfg_pci (struct pcicore_info *pch, -struct sbpciregs __iomem *pciregs); -extern void pcicore_fixcfg_pcie (struct pcicore_info *pch, -struct sbpcieregs __iomem *pciregs); -extern void pcicore_pci_setup (struct pcicore_info *pch, -struct sbpciregs __iomem *pciregs); +extern void pcicore_fixcfg (struct pcicore_info *pch); +extern void pcicore_pci_setup (struct pcicore_info *pch);#endif /* _BRCM_NICPCI_H_ */
Signature · 1 line
1.7.5.4
PATCH 18/23 brcm80211: smac: use bcma functions for register access in phy code
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
This adds the use of bcma functions to access the registers within the phy source code.
--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 183 +++++++++----------- .../net/wireless/brcm80211/brcmsmac/phy/phy_hal.h | 2 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_int.h | 4 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 69 ++++---- .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c | 75 ++++---- drivers/net/wireless/brcm80211/brcmsmac/types.h | 3 + 7 files changed, 162 insertions(+), 176 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +1 -1
@@ -4626,7 +4626,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,/* Get a phy for this band */ wlc_hw->band->pi = -wlc_phy_attach (wlc_hw->phy_sh, core->bus->mmio, +wlc_phy_attach (wlc_hw->phy_sh, core, wlc_hw->band->bandtype, wlc->wiphy);if (wlc_hw->band->pi ==NULL ) {
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c +83 -100
377 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h +1 -1
@@ -181,7 +181,7 @@ struct shared_phy_params {extern struct shared_phy *wlc_phy_shared_attach (struct shared_phy_params *shp);extern struct brcms_phy_pub *wlc_phy_attach (struct shared_phy *sh, -struct d11regs __iomem *regs, +struct bcma_device *d11core,int bandtype,struct wiphy *wiphy);extern void wlc_phy_detach (struct brcms_phy_pub *ppi);
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h +2 -2
@@ -557,7 +557,7 @@ struct brcms_phy { } u;bool user_txpwr_at_rfport; -struct d11regs __iomem *regs; +struct bcma_device *d11core;struct brcms_phy *next;struct brcms_phy_pub pubpi;
@@ -1088,7 +1088,7 @@ extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32,#define BRCMS_PHY_WAR_PR51571 (pi) \ if (NREV_LT((pi)->pubpi.phy_rev, 3)) \ - (void)R_REG(&(pi)->regs->maccontrol) + (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol))extern void wlc_phy_cal_perical_nphy_run (struct brcms_phy *pi,u8 caltype);extern void wlc_phy_aci_reset_nphy (struct brcms_phy *pi);
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +35 -34
145 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c +37 -38
163 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/types.h +3 -0
@@ -300,8 +300,11 @@ do { \* in the code. Older chips and the newer 5357 family don't require this fix. */ #define W_REG_FLUSH (r, v) ({ W_REG((r), (v)); (void)R_REG(r); }) +#define bcma_wflush16 (c, o, v) \ + ({ bcma_write16(c, o, v); (void)bcma_read16(c, o); })#else #define W_REG_FLUSH (r, v) W_REG((r), (v)) +#define bcma_wflush16 (c, o, v) bcma_write16(c, o, v)#endif /* CONFIG_BCM47XX */ #define AND_REG (r, v) W_REG((r), R_REG(r) & (v))
Signature · 1 line
1.7.5.4
PATCH 16/23 brcm80211: smac: use DMA-API calls for descriptor allocations
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Using BCMA hides the specifics about the host interface. The driver is now using the DMA-API to do dma related calls. BCMA provides the device object to use in the DMA-API calls.
--- drivers/net/wireless/brcm80211/brcmsmac/dma.c | 47 +++++++++++++----------- drivers/net/wireless/brcm80211/brcmsmac/dma.h | 10 +++-- drivers/net/wireless/brcm80211/brcmsmac/main.c | 8 ++-- 3 files changed, 35 insertions(+), 30 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/dma.c +25 -22
@@ -220,7 +220,8 @@ struct dma_info {uint *msg_level;/* message level pointer */ char name[MAXNAMEL ];/* callers name for diag msgs */ -struct pci_dev *pbus;/* bus handle */ +struct bcma_device *d11core; +struct device *dmadev;bool dma64;/* this dma engine is operating in 64-bit mode */ bool addrext;/* this dma engine supports DmaExtendedAddrChanges */
@@ -450,7 +451,7 @@ static bool _dma_descriptor_align(struct dma_info *di)* Descriptor table must start at the DMA hardware dictated alignment, so * allocated memory must be large enough to support this requirement. */ -static void *dma_alloc_consistent (struct pci_dev *pdev,uint size, +static void *dma_alloc_consistent (struct dma_info *di,uint size,u16 align_bits,uint *alloced,dma_addr_t *pap) {
@@ -460,7 +461,7 @@ static void *dma_alloc_consistent(struct pci_dev *pdev, uint size, size += align; *alloced = size; } -return pci_alloc_consistent (pdev, size, pap); +return dma_alloc_coherent (di->dmadev, size, pap,GFP_ATOMIC ); } static
@@ -486,7 +487,7 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,u32 desc_strtaddr;u32 alignbytes =1 << *alignbits; - va =dma_alloc_consistent (di->pbus, size, *alignbits, alloced, descpa); + va =dma_alloc_consistent (di, size, *alignbits, alloced, descpa);if (NULL == va)return NULL ;
@@ -495,8 +496,8 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,if (((desc_strtaddr + size -1 ) & boundary) != (desc_strtaddr & boundary)) { *alignbits =dma_align_sizetobits (size); -pci_free_consistent (di->pbus, size, va, *descpa); - va =dma_alloc_consistent (di->pbus, size, *alignbits, +dma_free_coherent (di->dmadev, size, va, *descpa); + va =dma_alloc_consistent (di, size, *alignbits, alloced, descpa); }return va;
@@ -556,10 +557,11 @@ static bool _dma_alloc(struct dma_info *di, uint direction) }struct dma_pub *dma_attach (char *name,struct si_pub *sih, -void __iomem *dmaregstx,void __iomem *dmaregsrx, -uint ntxd,uint nrxd, -uint rxbufsize,int rxextheadroom, -uint nrxpost,uint rxoffset,uint *msg_level) +struct bcma_device *d11core, +void __iomem *dmaregstx,void __iomem *dmaregsrx, +uint ntxd,uint nrxd, +uint rxbufsize,int rxextheadroom, +uint nrxpost,uint rxoffset,uint *msg_level) {struct dma_info *di;uint size;
@@ -575,6 +577,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, di->dma64 = ((ai_core_sflags (sih,0 ,0 ) &SISF_DMA64 ) ==SISF_DMA64 );/* init dma reg pointer */ + di->d11core = d11core; di->d64txregs = (struct dma64regs __iomem *) dmaregstx; di->d64rxregs = (struct dma64regs __iomem *) dmaregsrx;
@@ -594,7 +597,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,strncpy (di->name, name,MAXNAMEL ); di->name[MAXNAMEL -1 ] ='\0' ; - di->pbus = ((struct si_info *)sih)->pcibus; + di->dmadev = d11core->dma_dev;/* save tunables */ di->ntxd = (u16 ) ntxd;
@@ -749,13 +752,13 @@ void dma_detach(struct dma_pub *pub)/* free dma descriptor rings */ if (di->txd64) -pci_free_consistent (di->pbus, di->txdalloc, - ((s8 *)di->txd64 - di->txdalign), - (di->txdpaorig)); +dma_free_coherent (di->dmadev, di->txdalloc, + ((s8 *)di->txd64 - di->txdalign), + (di->txdpaorig));if (di->rxd64) -pci_free_consistent (di->pbus, di->rxdalloc, - ((s8 *)di->rxd64 - di->rxdalign), - (di->rxdpaorig)); +dma_free_coherent (di->dmadev, di->rxdalloc, + ((s8 *)di->rxd64 - di->rxdalign), + (di->rxdpaorig));/* free packet pointer vectors */ kfree (di->txp);
@@ -882,7 +885,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall) pa =le32_to_cpu (di->rxd64[i].addrlow) - di->dataoffsetlow;/* clear this packet from the descriptor ring */ -pci_unmap_single (di->pbus, pa, di->rxbufsize,PCI_DMA_FROMDEVICE ); +dma_unmap_single (di->dmadev, pa, di->rxbufsize,DMA_FROM_DEVICE ); di->rxd64[i].addrlow =cpu_to_le32 (0xdeadbeef ); di->rxd64[i].addrhigh =cpu_to_le32 (0xdeadbeef );
@@ -1048,8 +1051,8 @@ bool dma_rxfill(struct dma_pub *pub)*/ *(u32 *) (p->data) =0 ; - pa =pci_map_single (di->pbus, p->data, - di->rxbufsize,PCI_DMA_FROMDEVICE ); + pa =dma_map_single (di->dmadev, p->data, di->rxbufsize, +DMA_FROM_DEVICE );/* save the free packet pointer */ di->rxp[rxout] = p;
@@ -1267,7 +1270,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit) goto outoftxd;/* get physical address of buffer start */ - pa =pci_map_single (di->pbus, data, len,PCI_DMA_TODEVICE ); + pa =dma_map_single (di->dmadev, data, len,DMA_TO_DEVICE );/* With a DMA segment list, Descriptor table is filled * using the segment list instead of looping over
@@ -1376,7 +1379,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) txp = di->txp[i]; di->txp[i] =NULL ; -pci_unmap_single (di->pbus, pa, size,PCI_DMA_TODEVICE ); +dma_unmap_single (di->dmadev, pa, size,DMA_TO_DEVICE ); } di->txin = i;
drivers/net/wireless/brcm80211/brcmsmac/dma.h +6 -4
@@ -75,10 +75,12 @@ struct dma_pub { };extern struct dma_pub *dma_attach (char *name,struct si_pub *sih, -void __iomem *dmaregstx,void __iomem *dmaregsrx, -uint ntxd,uint nrxd, -uint rxbufsize,int rxextheadroom, -uint nrxpost,uint rxoffset,uint *msg_level); +struct bcma_device *d11core, +void __iomem *dmaregstx, +void __iomem *dmaregsrx, +uint ntxd,uint nrxd, +uint rxbufsize,int rxextheadroom, +uint nrxpost,uint rxoffset,uint *msg_level);void dma_rxinit (struct dma_pub *pub);int dma_rx (struct dma_pub *pub,struct sk_buff_head *skb_list);
drivers/net/wireless/brcm80211/brcmsmac/main.c +4 -4
@@ -1098,7 +1098,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* TX: TX_AC_BK_FIFO (TX AC Background data packets) * RX: RX_FIFO (RX data packets) */ - wlc_hw->di[0] = dma_attach(name, wlc_hw->sih, + wlc_hw->di[0] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, (wme ? dmareg(wlc_hw, DMA_TX, 0) : NULL), dmareg(wlc_hw, DMA_RX, 0), (wme ? NTXD : 0), NRXD,
@@ -1112,7 +1112,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* (legacy) TX_DATA_FIFO (TX data packets) * RX: UNUSED */ - wlc_hw->di[1 ] =dma_attach (name, wlc_hw->sih, + wlc_hw->di[1 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core,dmareg (wlc_hw,DMA_TX ,1 ),NULL ,NTXD ,0 ,0 ,-1 ,0 ,0 , &brcm_msg_level);
@@ -1123,7 +1123,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* TX: TX_AC_VI_FIFO (TX AC Video data packets) * RX: UNUSED */ - wlc_hw->di[2 ] =dma_attach (name, wlc_hw->sih, + wlc_hw->di[2 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core,dmareg (wlc_hw,DMA_TX ,2 ),NULL ,NTXD ,0 ,0 ,-1 ,0 ,0 , &brcm_msg_level);
@@ -1133,7 +1133,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)* TX: TX_AC_VO_FIFO (TX AC Voice data packets) * (legacy) TX_CTL_FIFO (TX control & mgmt packets) */ - wlc_hw->di[3 ] =dma_attach (name, wlc_hw->sih, + wlc_hw->di[3 ] =dma_attach (name, wlc_hw->sih, wlc_hw->d11core,dmareg (wlc_hw,DMA_TX ,3 ),NULL ,NTXD ,0 ,0 ,-1 ,0 ,0 , &brcm_msg_level);
Signature · 1 line
1.7.5.4
Rafał Miłecki
maintainerRe: [PATCH 05/23] bcma: add set/mask macros for 16-bit register access
In reply to Franky Lin2011/12/9 Franky Lin <[email protected]>:
Quoted 32 lines
From: Arend van Spriel <[email protected]>
The BCMA header only had definitions for 32-bit register access. Used those as a template for the 16-bit flavour. Also changed them to inline functions to be on the safe side. As offset parameter is used twice there would be a problem when used like this:
bcma_set32(core, offset++, val);Reviewed-by Pieter-Paul Giesberts <[email protected]>Reviewed-by Alwin Beukers <[email protected]>Signed-off-by Arend van Spriel <[email protected]>Signed-off-by Franky Lin <[email protected]>---
include/linux/bcma/bcma.h | 32 ++++++++++++++++++++++++++------1 files changed, 26 insertions(+), 6 deletions(-)include/linux/bcma/bcma.h +3
-6@@ -254,12 +254,32 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) core->bus->ops->awrite32(core, offset, value); } -#define bcma_mask32 (cc, offset, mask) \ - bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) -#define bcma_set32 (cc, offset, set) \ - bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) -#define bcma_maskset32 (cc, offset, mask, set) \ - bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) +static inline void bcma_mask32 (struct bcma_device *cc,u16 offset,u32 mask) +{ + bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
include/linux/bcma/bcma.h void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) · line 269
Quoted 10 lines
include/linux/bcma/bcma.h +10
-0+} +static inline void bcma_set32 (struct bcma_device *cc,u16 offset,u32 set) +{ + bcma_write32(cc, offset, bcma_read32(cc, offset) | set); +} +static inline void bcma_maskset32 (struct bcma_device *cc, + u16 offset, u32 mask, u32 set) +{ + bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set); +}
What is an advantage of static inline over define?
Signature · 1 line
Rafał
Re: [PATCH 05/23] bcma: add set/mask macros for 16-bit register access
Quoted 11 lines · Rafał Miłecki
2011/12/9 Franky Lin <[email protected]>:
Quoted 7 lines
From: Arend van Spriel <[email protected]>
The BCMA header only had definitions for 32-bit register access. Used those as a template for the 16-bit flavour. Also changed them to inline functions to be on the safe side. As offset parameter is used twice there would be a problem when used like this:
bcma_set32(core, offset++, val);What is an advantage of static inline over define?
Hi Rafał,
Apart from the example given in the commit message the CodingStyle documentation states a preference for inline functions. One advantage I can come up with is type checking by the compiler.
Gr. AvS
Re: [PATCH 18/23] brcm80211: smac: use bcma functions for register access in phy code
In reply to Franky LinQuoted 23 lines · Franky Lin
From: Arend van Spriel <[email protected]>
This adds the use of bcma functions to access the registers within the phy source code.
Reviewed-by Pieter-Paul Giesberts <[email protected]>Reviewed-by Alwin Beukers <[email protected]>Signed-off-by Arend van Spriel <[email protected]>Signed-off-by Franky Lin <[email protected]>--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 183 +++++++++----------- .../net/wireless/brcm80211/brcmsmac/phy/phy_hal.h | 2 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_int.h | 4 +- .../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 69 ++++---- .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c | 75 ++++---- drivers/net/wireless/brcm80211/brcmsmac/types.h | 3 + 7 files changed, 162 insertions(+), 176 deletions(-)drivers/net/wireless/brcm80211/brcmsmac/main.c +0
-0
....
Quoted 5 lines
void
write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val){drivers/net/wireless/brcm80211/brcmsmac/main.c +0
-2-struct d11regs __iomem *regs; -
drivers/net/wireless/brcm80211/brcmsmac/main.c
Quoted 10 lines
drivers/net/wireless/brcm80211/brcmsmac/main.c +3
-5- regs = pi->regs; -#ifdef CONFIG_BCM47XX -W_REG_FLUSH (®s->phyregaddr, addr); -W_REG (®s->phyregdata, val); +bcma_wflush16 (pi->d11core,D11REGOFFS (phyregaddr), addr); +bcma_write16 (pi->d11core,D11REGOFFS (phyregdata), val);if (addr ==0x72 ) - (void )R_REG (®s->phyregdata); + (void )bcma_read16 (pi->d11core,D11REGOFFS (phyregdata), val);
^^^
This does not compile with CONFIG_BCM47XX set.
drivers/net/wireless/brcm80211/brcmsmac/main.c
Quoted 11 lines
#else
drivers/net/wireless/brcm80211/brcmsmac/main.c +2
-2-W_REG ((u32 __iomem *)(®s->phyregaddr), addr | (val <<16 )); +bcma_write32 (pi->d11core,D11REGOFFS (phyregaddr), addr | (val <<16 ));if (++pi->phy_wreg >= pi->phy_wreg_limit) { pi->phy_wreg =0 ; - (void )R_REG (®s->phyversion); + (void )bcma_read16 (pi->d11core,D11REGOFFS (phyversion)); }#endif }
...
Hauke
Quoted 26 lines · Franky Lin
This train contains patches enable the support for bcm4330 for fullmac and part of the patch series of switching to bcma bus interface for softmac.
Arend van Spriel (19):
bcma: add set/mask macros for 16-bit register access
bcma: use static keyword for inline function declaration inbcma.h
brcm80211: smac: remove unused fields from structsi_pubdefinition
brcm80211: smac: move fields from structsi_pubto structsi_info
brcm80211: smac: use inline access functions for structsi_pubfields
brcm80211: smac: change from pci device driver to bcma device driver
brcm80211: smac: change attach interfaces inmain.cfor bcma support
brcm80211: smac: rename structsi_infofield pbus to pcibus
brcm80211: smac: changeai_attachinterface taking abcma_busobject
brcm80211: smac: remove enumeration rom parsing function
brcm80211: smac: use bcma core register access functions for 802.11
core
brcm80211: smac: use DMA-API calls for descriptor allocations
brcm80211: smac: use bcma function for register access indma.c
brcm80211: smac: use bcma functions for register access in phy code
brcm80211: smac: removeSI_FAST()macro usage
brcm80211: smac: replaceai_corereg()function withai_cc_reg()
brcm80211: smac: remove unused functions and/or prototypes
brcm80211: smac: use bcma core control functions
brcm80211: smac: use bcma core access functions innicpci.c
Quoted 6 lines
Franky Lin (4):
brcm80211: fmac: save bus interface structure in function 2 device
brcm80211: fmac: fix firmware shared structures version
brcm80211: fmac: add bcm4330 support
brcm80211: fmac: remove drive strength code for unsupported chips
Hi,
nice patches for brcmsmac. I tried them on my bcm4716 device (wireless core on the system bus), but brcmsmac does not work there, I am getting a kernel oops. aiutils.c does does not work for SoCs e.g. ai_setcoreidx() does not handle that all cores are mapped on SoCs at the same time, just under different addresses. I hope you are working on removing aiutils.c and moving the parts missing in bcma into it.
Hauke
CPU 0 Unable to handle kernel paging request at virtual address 00000114, epc == 830bcee8, ra == 801660b4
Oops[#1]:
Cpu 0
$ 0 : 00000000 00000063 00000000 00000001
$ 4 : 83877e80 830e0000 000004bf 00000812
$ 8 : fffffffc 8012b940 00000008 ffffff80
$12 : 00000001 8301af90 00000050 00000eb0
$16 : 83877e90 830e0fb0 83877e80 ffffffed
$20 : 830e0fb0 802b0000 00000028 8004fbb8
$24 : 00000018 830bce90
$28 : 83b32000 83b33ce8 00000124 801660b4
Hi : 00000019
Lo : 0000000f
epc : 830bcee8 pcicore_pci_setup+0x168/0x6c0 [brcmsmac]
Tainted: G O
ra : 801660b4 driver_probe_device+0x124/0x254
Status: 11008403 KERNEL EXL IE
Cause : 00800008
BadVA : 00000114
PrId : 00019740 (MIPS 74Kc)
Modules linked in: brcmsmac(O+) brcmutil(O) nls_utf8 nls_koi8_r
nls_iso8859_2 nls_iso8859_15 nls_iso8859_13 nls_iso8859_1 nls_cp866
nls_cp852 nls_cp850 nls_cp775 nls_cp437 nls_cp1251 nls_cp1250
mac80211(O) usbcore usb_common switch_core(O) scsi_mod nls_base crc8
crc16 crc_ccitt cordic cfg80211(O) compat(O) ssb_hcd bcma_hcd arc4
aes_generic crypto_algapi [last unloaded: switch_core]
Process insmod (pid: 385, threadinfo=83b32000, task=83a3e0b8, tls=775472d0)
Stack : fffffff4 8301ae00 83877e90 830e0fb0 00000011 00000000 830e0fb0
83877e90
00000000 83877e98 ffffffed 830e0fb0 802b0000 00000028 83877e90
830e0fb0
80300000 ffffffed 830e0fb0 802b0000 00000028 8004fbb8 00000124
801660b4
00000028 8004fbb8 83863780 80233348 8301ae00 83877e90 830e0fb0
83877ec4
830e0fb0 00000000 802e0000 80166250 830e0fb0 80164d28 11008401
839f6540
...
Call Trace:
[<830bcee8>] pcicore_pci_setup+0x168/0x6c0 [brcmsmac]Code: 3c05830e 8c42000c 00809021 <8c420114> 02002021 24a5f04c 0c05899b afa20018 3c030812 ---[ end trace 1f4714862ccd4ec9 ]---
Re: [PATCH 05/23] bcma: add set/mask macros for 16-bit register access
In reply to Rafał MiłeckiQuoted 1 line · Rafał Miłecki
What is an advantage of static inline over define?
Possible to use proper compiler checks and easier to read. Better to avoid C preprocesor until it's absolutely necessary to use it, makes it a lot easier for everyone.
Signature · 1 line
Kalle Valo
Quoted 9 lines · Hauke Mehrtens
Hi,
nice patches for brcmsmac. I tried them on my bcm4716 device (wireless core on the system bus), but brcmsmac does not work there, I am getting a kernel oops.
aiutils.cdoes does not work for SoCs e.g.ai_setcoreidx()does not handle that all cores are mapped on SoCs at the same time, just under different addresses. I hope you are working on removingaiutils.cand moving the parts missing in bcma into it.
Hi Hauke,
Thanks for the compliment ;-) Let me explain the steps set out to get brcmsmac using bcma,
1) convert to use bcma functions in all brcmsmac source files.
2) cleanup aiutils.c as it is redundant.
3) look for opportunities to move code to bcma (eg. nicpci.c, srom.c)
For steps 1) and 2) we have patches queued up of which the first batch was submitted. Keep an eye on the mailing list for more to come ;-)
Gr. AvS
Rafał Miłecki
maintainerRe: [PATCH 05/23] bcma: add set/mask macros for 16-bit register access
In reply to Arend van SprielW dniu 10 grudnia 2011 21:18 użytkownik Arend van Spriel
Quoted 10 lines · <[email protected]> napisał:
Quoted 9 lines · Rafał Miłecki
2011/12/9 Franky Lin <[email protected]>:
Quoted 7 lines
From: Arend van Spriel <[email protected]>
The BCMA header only had definitions for 32-bit register access. Used those as a template for the 16-bit flavour. Also changed them to inline functions to be on the safe side. As offset parameter is used twice there would be a problem when used like this:
bcma_set32(core, offset++, val);
Quoted 8 lines
Quoted 2 lines
What is an advantage of static inline over define?
Hi Rafał,
Apart from the example given in the commit message the CodingStyle documentation states a preference for inline functions. One advantage I can come up with is type checking by the compiler.
Thanks for explaining, compiler errors should be indeed nicer. Thanks for patch :)
Signature · 1 line
Rafał