* [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup
@ 2011-10-05 13:19 Arend van Spriel
2011-10-05 13:20 ` [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend van Spriel
` (16 more replies)
0 siblings, 17 replies; 21+ messages in thread
From: Arend van Spriel @ 2011-10-05 13:19 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
This series addresses more community feedback items received on mainline
patch (v2) posted August 25, 2011. The driver structures in brcmfmac could
do with some tidying and in the brcmsmac variables loaded from srom were
accessed by string identifiers. This has been replaced by enumerated
identifiers and the entries are stored in kernel standard linked list.
This series applies to staging-next and depends on the patch series posted
on Oct 4, 2011 (see Message-ID below).
Message-ID: <1317763152-17607-1-git-send-email-arend@broadcom.com>
Arend van Spriel (11):
staging: brcm80211: move driver variable functions to srom.c
staging: brcm80211: remove code duplication for driver variable
lookup
staging: brcm80211: change parameter in driver variable lookup
staging: brcm80211: remove locking macro definitions
staging: brcm80211: fix thread blocking issue in
brcmf_sdbrcm_bus_stop()
staging: brcm80211: remove invalid variable lookup from srom
staging: brcm80211: use identifiers instead of string for srom lookup
staging: brcm80211: use enum identifiers in srom variable tables
staging: brcm80211: replace string based variable storage by linked
list
staging: brcm80211: remove parameter 'off' from _initvars_srom_pci()
staging: brcm80211: cleanup driver variable references
Franky Lin (4):
staging: brcm80211: remove threads_only code from fullmac
staging: brcm80211: remove redundant bus register layer from fullmac
staging: brcm80211: clean up struct brcmf_if in fullmac
staging: brcm80211: remove brcmf_op_if from fullmac
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 10 -
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 16 +-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 134 +--
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 133 +--
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 4 -
drivers/staging/brcm80211/brcmsmac/aiutils.c | 32 +-
drivers/staging/brcm80211/brcmsmac/aiutils.h | 6 +-
drivers/staging/brcm80211/brcmsmac/antsel.c | 15 +-
drivers/staging/brcm80211/brcmsmac/channel.c | 2 +-
drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 157 ++--
drivers/staging/brcm80211/brcmsmac/main.c | 144 +---
drivers/staging/brcm80211/brcmsmac/main.h | 5 -
drivers/staging/brcm80211/brcmsmac/nicpci.c | 5 +-
drivers/staging/brcm80211/brcmsmac/nicpci.h | 2 +-
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 42 +-
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 +-
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 7 -
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 64 +-
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 330 ++++--
drivers/staging/brcm80211/brcmsmac/phy_shim.c | 9 +
drivers/staging/brcm80211/brcmsmac/phy_shim.h | 4 +
drivers/staging/brcm80211/brcmsmac/pub.h | 263 +++++-
drivers/staging/brcm80211/brcmsmac/srom.c | 1124 +++++++++++----------
drivers/staging/brcm80211/brcmsmac/srom.h | 4 +-
drivers/staging/brcm80211/brcmsmac/stf.c | 4 +-
25 files changed, 1342 insertions(+), 1178 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 21+ messages in thread* [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-06 14:15 ` Arend Van Spriel 2011-10-05 13:20 ` [PATCH 02/15] staging: brcm80211: remove threads_only code from fullmac Arend van Spriel ` (15 subsequent siblings) 16 siblings, 1 reply; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The driver uses variables which are stored in string format. Using strings as variable identifiers is disliked by the community. The driver has been cleaned up and the only module providing these variables is srom.c. The variable retrieval functions have been moved to srom.c in preparation of a more likable way to store and lookup these driver variables. Reported-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/main.c | 44 ----------------------------- drivers/staging/brcm80211/brcmsmac/srom.c | 44 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c index 9fa8485..100e6ec 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.c +++ b/drivers/staging/brcm80211/brcmsmac/main.c @@ -8881,47 +8881,3 @@ void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc) wlc->mpc = mpc; brcms_c_radio_mpc_upd(wlc); } - -/* - * Search the name=value vars for a specific one and return its value. - * Returns NULL if not found. - */ -char *getvar(char *vars, const char *name) -{ - char *s; - int len; - - if (!name) - return NULL; - - len = strlen(name); - if (len == 0) - return NULL; - - /* first look in vars[] */ - for (s = vars; s && *s;) { - if ((memcmp(s, name, len) == 0) && (s[len] == '=')) - return &s[len + 1]; - - while (*s++) - ; - } - /* nothing found */ - return NULL; -} - -/* - * Search the vars for a specific one and return its value as - * an integer. Returns 0 if not found. - */ -int getintvar(char *vars, const char *name) -{ - char *val; - unsigned long res; - - val = getvar(vars, name); - if (val && !kstrtoul(val, 0, &res)) - return res; - - return 0; -} diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index 13d17eb..02dbd98 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -1242,3 +1242,47 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, return -EINVAL; } + +/* + * Search the name=value vars for a specific one and return its value. + * Returns NULL if not found. + */ +char *getvar(char *vars, const char *name) +{ + char *s; + int len; + + if (!name) + return NULL; + + len = strlen(name); + if (len == 0) + return NULL; + + /* first look in vars[] */ + for (s = vars; s && *s;) { + if ((memcmp(s, name, len) == 0) && (s[len] == '=')) + return &s[len + 1]; + + while (*s++) + ; + } + /* nothing found */ + return NULL; +} + +/* + * Search the vars for a specific one and return its value as + * an integer. Returns 0 if not found. + */ +int getintvar(char *vars, const char *name) +{ + char *val; + unsigned long res; + + val = getvar(vars, name); + if (val && !kstrtoul(val, 0, &res)) + return res; + + return 0; +} -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* RE: [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c 2011-10-05 13:20 ` [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend van Spriel @ 2011-10-06 14:15 ` Arend Van Spriel 0 siblings, 0 replies; 21+ messages in thread From: Arend Van Spriel @ 2011-10-06 14:15 UTC (permalink / raw) To: gregkh@suse.de Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org > From: Arend van Spriel [mailto:arend@broadcom.com] > Sent: woensdag 5 oktober 2011 15:20 > > The driver uses variables which are stored in string format. Using > strings as variable identifiers is disliked by the community. The > driver has been cleaned up and the only module providing these > variables is srom.c. The variable retrieval functions have been > moved to srom.c in preparation of a more likable way to store and > lookup these driver variables. > > Reported-by: Johannes Berg <johannes@sipsolutions.net> > Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> > Reviewed-by: Alwin Beukers <alwin@broadcom.com> > Reviewed-by: Roland Vossen <rvossen@broadcom.com> > Signed-off-by: Arend van Spriel <arend@broadcom.com> Well, Greg And there is the original patch coming out of some hole. Please discard this one. Gr. AvS ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 02/15] staging: brcm80211: remove threads_only code from fullmac 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel 2011-10-05 13:20 ` [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 03/15] staging: brcm80211: remove redundant bus register layer " Arend van Spriel ` (14 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel From: Franky Lin <frankyl@broadcom.com> threads_only is always true as we never use the tasklet implementation. So related code is removed. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 100 ++++++++----------------- 1 files changed, 30 insertions(+), 70 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index f3e6249..0ae8dc0 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -651,11 +651,9 @@ struct brcmf_bus { bool wd_timer_valid; uint save_ms; - struct tasklet_struct tasklet; struct task_struct *dpc_tsk; struct completion dpc_wait; - bool threads_only; struct semaphore sdsem; const char *fw_name; @@ -2704,29 +2702,6 @@ static int brcmf_sdbrcm_dpc_thread(void *data) return 0; } -static void brcmf_sdbrcm_dpc_tasklet(unsigned long data) -{ - struct brcmf_bus *bus = (struct brcmf_bus *) data; - - /* Call bus dpc unless it indicated down (then clean stop) */ - if (bus->drvr->busstate != BRCMF_BUS_DOWN) { - if (brcmf_sdbrcm_dpc(bus)) - tasklet_schedule(&bus->tasklet); - } else { - brcmf_sdbrcm_bus_stop(bus); - } -} - -static void brcmf_sdbrcm_sched_dpc(struct brcmf_bus *bus) -{ - if (bus->dpc_tsk) { - complete(&bus->dpc_wait); - return; - } - - tasklet_schedule(&bus->tasklet); -} - int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt) { int ret = -EBADE; @@ -2770,7 +2745,8 @@ int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt) /* Schedule DPC if needed to send queued packet(s) */ if (!bus->dpc_sched) { bus->dpc_sched = true; - brcmf_sdbrcm_sched_dpc(bus); + if (bus->dpc_tsk) + complete(&bus->dpc_wait); } return ret; @@ -3642,8 +3618,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus) send_sig(SIGTERM, bus->dpc_tsk, 1); kthread_stop(bus->dpc_tsk); bus->dpc_tsk = NULL; - } else - tasklet_kill(&bus->tasklet); + } /* Disable and clear interrupts at the chip level also */ w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask), &retries); @@ -3831,7 +3806,8 @@ void brcmf_sdbrcm_isr(void *arg) brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); bus->dpc_sched = true; - brcmf_sdbrcm_sched_dpc(bus); + if (bus->dpc_tsk) + complete(&bus->dpc_wait); } static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr) @@ -3875,8 +3851,8 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr) bus->ipend = true; bus->dpc_sched = true; - brcmf_sdbrcm_sched_dpc(bus); - + if (bus->dpc_tsk) + complete(&bus->dpc_wait); } } @@ -4366,21 +4342,13 @@ brcmf_sdbrcm_watchdog(unsigned long data) { struct brcmf_bus *bus = (struct brcmf_bus *)data; - if (bus->threads_only) { - if (bus->watchdog_tsk) - complete(&bus->watchdog_wait); - else - return; - } else { - brcmf_sdbrcm_bus_watchdog(bus->drvr); - - /* Count the tick for reference */ - bus->drvr->tickcnt++; + if (bus->watchdog_tsk) { + complete(&bus->watchdog_wait); + /* Reschedule the watchdog */ + if (bus->wd_timer_valid) + mod_timer(&bus->timer, + jiffies + BRCMF_WD_POLL_MS * HZ / 1000); } - - /* Reschedule the watchdog */ - if (bus->wd_timer_valid) - mod_timer(&bus->timer, jiffies + BRCMF_WD_POLL_MS * HZ / 1000); } static void @@ -4465,7 +4433,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1; bus->usebufpool = false; /* Use bufpool if allocated, else use locally malloced rxbuf */ - bus->threads_only = true; /* attempt to attach to the dongle */ if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) { @@ -4483,32 +4450,25 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, bus->timer.function = brcmf_sdbrcm_watchdog; /* Initialize thread based operation and lock */ - if (bus->threads_only) { - sema_init(&bus->sdsem, 1); - - /* Initialize watchdog thread */ - init_completion(&bus->watchdog_wait); - bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread, - bus, "brcmf_watchdog"); - if (IS_ERR(bus->watchdog_tsk)) { - printk(KERN_WARNING - "brcmf_watchdog thread failed to start\n"); - bus->watchdog_tsk = NULL; - } - /* Initialize DPC thread */ - init_completion(&bus->dpc_wait); - bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, - bus, "brcmf_dpc"); - if (IS_ERR(bus->dpc_tsk)) { - printk(KERN_WARNING - "brcmf_dpc thread failed to start\n"); - bus->dpc_tsk = NULL; - } - } else { + sema_init(&bus->sdsem, 1); + + /* Initialize watchdog thread */ + init_completion(&bus->watchdog_wait); + bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread, + bus, "brcmf_watchdog"); + if (IS_ERR(bus->watchdog_tsk)) { + printk(KERN_WARNING + "brcmf_watchdog thread failed to start\n"); bus->watchdog_tsk = NULL; + } + /* Initialize DPC thread */ + init_completion(&bus->dpc_wait); + bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, + bus, "brcmf_dpc"); + if (IS_ERR(bus->dpc_tsk)) { + printk(KERN_WARNING + "brcmf_dpc thread failed to start\n"); bus->dpc_tsk = NULL; - tasklet_init(&bus->tasklet, brcmf_sdbrcm_dpc_tasklet, - (unsigned long)bus); } /* Attach to the brcmf/OS/network interface */ -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/15] staging: brcm80211: remove redundant bus register layer from fullmac 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel 2011-10-05 13:20 ` [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend van Spriel 2011-10-05 13:20 ` [PATCH 02/15] staging: brcm80211: remove threads_only code from fullmac Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 04/15] staging: brcm80211: remove code duplication for driver variable lookup Arend van Spriel ` (13 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel From: Franky Lin <frankyl@broadcom.com> Remove some single line functions for bus register/unregister interface Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 10 ---------- drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 16 ++++------------ drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 14 -------------- drivers/staging/brcm80211/brcmfmac/sdio_host.h | 4 ---- 4 files changed, 4 insertions(+), 40 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c index 5906337..bff9dcd 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c @@ -362,16 +362,6 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev) } EXPORT_SYMBOL(brcmf_sdio_remove); -int brcmf_sdio_register(void) -{ - return brcmf_sdio_function_init(); -} - -void brcmf_sdio_unregister(void) -{ - brcmf_sdio_function_cleanup(); -} - void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, bool enable) { if (enable) diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c index fc95bb2..e919de2 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c @@ -609,23 +609,15 @@ static struct sdio_driver brcmf_sdmmc_driver = { #endif /* CONFIG_PM_SLEEP */ }; -/* - * module init -*/ -int brcmf_sdio_function_init(void) +/* bus register interface */ +int brcmf_bus_register(void) { - int error = 0; brcmf_dbg(TRACE, "Enter\n"); - error = sdio_register_driver(&brcmf_sdmmc_driver); - - return error; + return sdio_register_driver(&brcmf_sdmmc_driver); } -/* - * module cleanup -*/ -void brcmf_sdio_function_cleanup(void) +void brcmf_bus_unregister(void) { brcmf_dbg(TRACE, "Enter\n"); diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index 0ae8dc0..0f7b80d 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -4533,20 +4533,6 @@ void brcmf_sdbrcm_disconnect(void *ptr) brcmf_dbg(TRACE, "Disconnected\n"); } -int brcmf_bus_register(void) -{ - brcmf_dbg(TRACE, "Enter\n"); - - return brcmf_sdio_register(); -} - -void brcmf_bus_unregister(void) -{ - brcmf_dbg(TRACE, "Enter\n"); - - brcmf_sdio_unregister(); -} - struct device *brcmf_bus_get_device(struct brcmf_bus *bus) { return &bus->sdiodev->func[2]->dev; diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h index 397ad48..726fa89 100644 --- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h +++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h @@ -211,10 +211,6 @@ extern int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, extern int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn); /* platform specific/high level functions */ -extern int brcmf_sdio_function_init(void); -extern int brcmf_sdio_register(void); -extern void brcmf_sdio_unregister(void); -extern void brcmf_sdio_function_cleanup(void); extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev); extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/15] staging: brcm80211: remove code duplication for driver variable lookup 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (2 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 03/15] staging: brcm80211: remove redundant bus register layer " Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 05/15] staging: brcm80211: change parameter in " Arend van Spriel ` (12 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The phy code used its own driver variable lookup functions which were duplicates of those in the brcmsmac driver (in srom.c). The phy code now uses the functions in srom.c through the phy_shim interface. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 36 --- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 6 - drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 56 +++--- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 247 ++++++++++++---------- drivers/staging/brcm80211/brcmsmac/phy_shim.c | 9 + drivers/staging/brcm80211/brcmsmac/phy_shim.h | 3 + 6 files changed, 180 insertions(+), 177 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c index 0d3c9d8..59767e3 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c @@ -126,42 +126,6 @@ const u8 ofdm_rate_lookup[] = { #define PHY_WREG_LIMIT 24 -char *phy_getvar(struct brcms_phy *pi, const char *name) -{ - char *vars = pi->vars; - char *s; - int len; - - if (!name) - return NULL; - - len = strlen(name); - if (len == 0) - return NULL; - - for (s = vars; s && *s;) { - if ((memcmp(s, name, len) == 0) && (s[len] == '=')) - return &s[len + 1]; - - while (*s++) - ; - } - - return NULL; -} - -int phy_getintvar(struct brcms_phy *pi, const char *name) -{ - char *val; - unsigned long res; - - val = PHY_GETVAR(pi, name); - if (val && !kstrtoul(val, 0, &res)) - return res; - - return 0; -} - void wlc_phyreg_enter(struct brcms_phy_pub *pih) { struct brcms_phy *pi = (struct brcms_phy *) pih; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h index 4468090..4330e38 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h @@ -919,12 +919,6 @@ struct lcnphy_radio_regs { u8 do_init_g; }; -extern char *phy_getvar(struct brcms_phy *pi, const char *name); -extern int phy_getintvar(struct brcms_phy *pi, const char *name); - -#define PHY_GETVAR(pi, name) phy_getvar(pi, name) -#define PHY_GETINTVAR(pi, name) phy_getintvar(pi, name) - extern u16 read_phy_reg(struct brcms_phy *pi, u16 addr); extern void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); extern void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c index a87e392..dbeeeba 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c @@ -4823,18 +4823,21 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) u32 offset_ofdm, offset_mcs; pi_lcn->lcnphy_tr_isolation_mid = - (u8) PHY_GETINTVAR(pi, "triso2g"); + (u8) wlapi_getintvar(pi->vars, "triso2g"); pi_lcn->lcnphy_rx_power_offset = - (u8) PHY_GETINTVAR(pi, "rxpo2g"); + (u8) wlapi_getintvar(pi->vars, "rxpo2g"); - pi->txpa_2g[0] = (s16) PHY_GETINTVAR(pi, "pa0b0"); - pi->txpa_2g[1] = (s16) PHY_GETINTVAR(pi, "pa0b1"); - pi->txpa_2g[2] = (s16) PHY_GETINTVAR(pi, "pa0b2"); + pi->txpa_2g[0] = (s16) wlapi_getintvar(pi->vars, "pa0b0"); + pi->txpa_2g[1] = (s16) wlapi_getintvar(pi->vars, "pa0b1"); + pi->txpa_2g[2] = (s16) wlapi_getintvar(pi->vars, "pa0b2"); - pi_lcn->lcnphy_rssi_vf = (u8) PHY_GETINTVAR(pi, "rssismf2g"); - pi_lcn->lcnphy_rssi_vc = (u8) PHY_GETINTVAR(pi, "rssismc2g"); - pi_lcn->lcnphy_rssi_gs = (u8) PHY_GETINTVAR(pi, "rssisav2g"); + pi_lcn->lcnphy_rssi_vf = + (u8) wlapi_getintvar(pi->vars, "rssismf2g"); + pi_lcn->lcnphy_rssi_vc = + (u8) wlapi_getintvar(pi->vars, "rssismc2g"); + pi_lcn->lcnphy_rssi_gs = + (u8) wlapi_getintvar(pi->vars, "rssisav2g"); pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf; pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc; @@ -4844,7 +4847,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc; pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs; - txpwr = (s8) PHY_GETINTVAR(pi, "maxp2ga0"); + txpwr = (s8) wlapi_getintvar(pi->vars, "maxp2ga0"); pi->tx_srom_max_2g = txpwr; for (i = 0; i < PWRTBL_NUM_COEFF; i++) { @@ -4852,7 +4855,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) pi->txpa_2g_high_temp[i] = pi->txpa_2g[i]; } - cckpo = (u16) PHY_GETINTVAR(pi, "cck2gpo"); + cckpo = (u16) wlapi_getintvar(pi->vars, "cck2gpo"); if (cckpo) { uint max_pwr_chan = txpwr; @@ -4862,7 +4865,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) cckpo >>= 4; } - offset_ofdm = (u32) PHY_GETINTVAR(pi, "ofdm2gpo"); + offset_ofdm = + (u32) wlapi_getintvar(pi->vars, "ofdm2gpo"); for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { pi->tx_srom_max_rate_2g[i] = max_pwr_chan - @@ -4872,12 +4876,13 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) } else { u8 opo = 0; - opo = (u8) PHY_GETINTVAR(pi, "opo"); + opo = (u8) wlapi_getintvar(pi->vars, "opo"); for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) pi->tx_srom_max_rate_2g[i] = txpwr; - offset_ofdm = (u32) PHY_GETINTVAR(pi, "ofdm2gpo"); + offset_ofdm = + (u32) wlapi_getintvar(pi->vars, "ofdm2gpo"); for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { pi->tx_srom_max_rate_2g[i] = txpwr - @@ -4885,8 +4890,9 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) offset_ofdm >>= 4; } offset_mcs = - ((u16) PHY_GETINTVAR(pi, "mcs2gpo1") << 16) | - (u16) PHY_GETINTVAR(pi, "mcs2gpo0"); + wlapi_getintvar(pi->vars, "mcs2gpo1") << 16; + offset_mcs |= + (u16) wlapi_getintvar(pi->vars, "mcs2gpo0"); pi_lcn->lcnphy_mcs20_po = offset_mcs; for (i = TXP_FIRST_SISO_MCS_20; i <= TXP_LAST_SISO_MCS_20; i++) { @@ -4897,30 +4903,30 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) } pi_lcn->lcnphy_rawtempsense = - (u16) PHY_GETINTVAR(pi, "rawtempsense"); + (u16) wlapi_getintvar(pi->vars, "rawtempsense"); pi_lcn->lcnphy_measPower = - (u8) PHY_GETINTVAR(pi, "measpower"); + (u8) wlapi_getintvar(pi->vars, "measpower"); pi_lcn->lcnphy_tempsense_slope = - (u8) PHY_GETINTVAR(pi, "tempsense_slope"); + (u8) wlapi_getintvar(pi->vars, "tempsense_slope"); pi_lcn->lcnphy_hw_iqcal_en = - (bool) PHY_GETINTVAR(pi, "hw_iqcal_en"); + (bool) wlapi_getintvar(pi->vars, "hw_iqcal_en"); pi_lcn->lcnphy_iqcal_swp_dis = - (bool) PHY_GETINTVAR(pi, "iqcal_swp_dis"); + (bool) wlapi_getintvar(pi->vars, "iqcal_swp_dis"); pi_lcn->lcnphy_tempcorrx = - (u8) PHY_GETINTVAR(pi, "tempcorrx"); + (u8) wlapi_getintvar(pi->vars, "tempcorrx"); pi_lcn->lcnphy_tempsense_option = - (u8) PHY_GETINTVAR(pi, "tempsense_option"); + (u8) wlapi_getintvar(pi->vars, "tempsense_option"); pi_lcn->lcnphy_freqoffset_corr = - (u8) PHY_GETINTVAR(pi, "freqoffset_corr"); + (u8) wlapi_getintvar(pi->vars, "freqoffset_corr"); if ((u8) getintvar(pi->vars, "aa2g") > 1) wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi, (u8) getintvar(pi->vars, "aa2g")); } pi_lcn->lcnphy_cck_dig_filt_type = -1; - if (PHY_GETVAR(pi, "cckdigfilttype")) { + if (wlapi_getvar(pi->vars, "cckdigfilttype")) { s16 temp; - temp = (s16) PHY_GETINTVAR(pi, "cckdigfilttype"); + temp = (s16) wlapi_getintvar(pi->vars, "cckdigfilttype"); if (temp >= 0) pi_lcn->lcnphy_cck_dig_filt_type = temp; } diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c index 67cfcdd..c410bf0 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c @@ -14387,25 +14387,25 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) if (pi->sh->sromrev >= 9) return; - bw40po = (u16) PHY_GETINTVAR(pi, "bw40po"); + bw40po = (u16) wlapi_getintvar(pi->vars, "bw40po"); pi->bw402gpo = bw40po & 0xf; pi->bw405gpo = (bw40po & 0xf0) >> 4; pi->bw405glpo = (bw40po & 0xf00) >> 8; pi->bw405ghpo = (bw40po & 0xf000) >> 12; - cddpo = (u16) PHY_GETINTVAR(pi, "cddpo"); + cddpo = (u16) wlapi_getintvar(pi->vars, "cddpo"); pi->cdd2gpo = cddpo & 0xf; pi->cdd5gpo = (cddpo & 0xf0) >> 4; pi->cdd5glpo = (cddpo & 0xf00) >> 8; pi->cdd5ghpo = (cddpo & 0xf000) >> 12; - stbcpo = (u16) PHY_GETINTVAR(pi, "stbcpo"); + stbcpo = (u16) wlapi_getintvar(pi->vars, "stbcpo"); pi->stbc2gpo = stbcpo & 0xf; pi->stbc5gpo = (stbcpo & 0xf0) >> 4; pi->stbc5glpo = (stbcpo & 0xf00) >> 8; pi->stbc5ghpo = (stbcpo & 0xf000) >> 12; - bwduppo = (u16) PHY_GETINTVAR(pi, "bwduppo"); + bwduppo = (u16) wlapi_getintvar(pi->vars, "bwduppo"); pi->bwdup2gpo = bwduppo & 0xf; pi->bwdup5gpo = (bwduppo & 0xf0) >> 4; pi->bwdup5glpo = (bwduppo & 0xf00) >> 8; @@ -14417,168 +14417,188 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) case 0: pi->nphy_txpid2g[PHY_CORE_0] = - (u8) PHY_GETINTVAR(pi, "txpid2ga0"); + (u8) wlapi_getintvar(pi->vars, "txpid2ga0"); pi->nphy_txpid2g[PHY_CORE_1] = - (u8) PHY_GETINTVAR(pi, "txpid2ga1"); + (u8) wlapi_getintvar(pi->vars, "txpid2ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g = - (s8) PHY_GETINTVAR(pi, "maxp2ga0"); + (s8) wlapi_getintvar(pi->vars, "maxp2ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g = - (s8) PHY_GETINTVAR(pi, "maxp2ga1"); + (s8) wlapi_getintvar(pi->vars, "maxp2ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 = - (s16) PHY_GETINTVAR(pi, "pa2gw0a0"); + (s16) wlapi_getintvar(pi->vars, "pa2gw0a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 = - (s16) PHY_GETINTVAR(pi, "pa2gw0a1"); + (s16) wlapi_getintvar(pi->vars, "pa2gw0a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 = - (s16) PHY_GETINTVAR(pi, "pa2gw1a0"); + (s16) wlapi_getintvar(pi->vars, "pa2gw1a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 = - (s16) PHY_GETINTVAR(pi, "pa2gw1a1"); + (s16) wlapi_getintvar(pi->vars, "pa2gw1a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 = - (s16) PHY_GETINTVAR(pi, "pa2gw2a0"); + (s16) wlapi_getintvar(pi->vars, "pa2gw2a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 = - (s16) PHY_GETINTVAR(pi, "pa2gw2a1"); + (s16) wlapi_getintvar(pi->vars, "pa2gw2a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g = - (s8) PHY_GETINTVAR(pi, "itt2ga0"); + (s8) wlapi_getintvar(pi->vars, "itt2ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g = - (s8) PHY_GETINTVAR(pi, "itt2ga1"); - - pi->cck2gpo = (u16) PHY_GETINTVAR(pi, "cck2gpo"); - - pi->ofdm2gpo = (u32) PHY_GETINTVAR(pi, "ofdm2gpo"); - - pi->mcs2gpo[0] = (u16) PHY_GETINTVAR(pi, "mcs2gpo0"); - pi->mcs2gpo[1] = (u16) PHY_GETINTVAR(pi, "mcs2gpo1"); - pi->mcs2gpo[2] = (u16) PHY_GETINTVAR(pi, "mcs2gpo2"); - pi->mcs2gpo[3] = (u16) PHY_GETINTVAR(pi, "mcs2gpo3"); - pi->mcs2gpo[4] = (u16) PHY_GETINTVAR(pi, "mcs2gpo4"); - pi->mcs2gpo[5] = (u16) PHY_GETINTVAR(pi, "mcs2gpo5"); - pi->mcs2gpo[6] = (u16) PHY_GETINTVAR(pi, "mcs2gpo6"); - pi->mcs2gpo[7] = (u16) PHY_GETINTVAR(pi, "mcs2gpo7"); + (s8) wlapi_getintvar(pi->vars, "itt2ga1"); + + pi->cck2gpo = + (u16) wlapi_getintvar(pi->vars, "cck2gpo"); + pi->ofdm2gpo = + (u32) wlapi_getintvar(pi->vars, "ofdm2gpo"); + + pi->mcs2gpo[0] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo0"); + pi->mcs2gpo[1] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo1"); + pi->mcs2gpo[2] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo2"); + pi->mcs2gpo[3] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo3"); + pi->mcs2gpo[4] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo4"); + pi->mcs2gpo[5] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo5"); + pi->mcs2gpo[6] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo6"); + pi->mcs2gpo[7] = + (u16) wlapi_getintvar(pi->vars, "mcs2gpo7"); break; case 1: pi->nphy_txpid5g[PHY_CORE_0] = - (u8) PHY_GETINTVAR(pi, "txpid5ga0"); + (u8) wlapi_getintvar(pi->vars, "txpid5ga0"); pi->nphy_txpid5g[PHY_CORE_1] = - (u8) PHY_GETINTVAR(pi, "txpid5ga1"); + (u8) wlapi_getintvar(pi->vars, "txpid5ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm = - (s8) PHY_GETINTVAR(pi, "maxp5ga0"); + (s8) wlapi_getintvar(pi->vars, "maxp5ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm = - (s8) PHY_GETINTVAR(pi, "maxp5ga1"); + (s8) wlapi_getintvar(pi->vars, "maxp5ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 = - (s16) PHY_GETINTVAR(pi, "pa5gw0a0"); + (s16) wlapi_getintvar(pi->vars, "pa5gw0a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 = - (s16) PHY_GETINTVAR(pi, "pa5gw0a1"); + (s16) wlapi_getintvar(pi->vars, "pa5gw0a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 = - (s16) PHY_GETINTVAR(pi, "pa5gw1a0"); + (s16) wlapi_getintvar(pi->vars, "pa5gw1a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 = - (s16) PHY_GETINTVAR(pi, "pa5gw1a1"); + (s16) wlapi_getintvar(pi->vars, "pa5gw1a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 = - (s16) PHY_GETINTVAR(pi, "pa5gw2a0"); + (s16) wlapi_getintvar(pi->vars, "pa5gw2a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 = - (s16) PHY_GETINTVAR(pi, "pa5gw2a1"); + (s16) wlapi_getintvar(pi->vars, "pa5gw2a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm = - (s8) PHY_GETINTVAR(pi, "itt5ga0"); + (s8) wlapi_getintvar(pi->vars, "itt5ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm = - (s8) PHY_GETINTVAR(pi, "itt5ga1"); - - pi->ofdm5gpo = (u32) PHY_GETINTVAR(pi, "ofdm5gpo"); - - pi->mcs5gpo[0] = (u16) PHY_GETINTVAR(pi, "mcs5gpo0"); - pi->mcs5gpo[1] = (u16) PHY_GETINTVAR(pi, "mcs5gpo1"); - pi->mcs5gpo[2] = (u16) PHY_GETINTVAR(pi, "mcs5gpo2"); - pi->mcs5gpo[3] = (u16) PHY_GETINTVAR(pi, "mcs5gpo3"); - pi->mcs5gpo[4] = (u16) PHY_GETINTVAR(pi, "mcs5gpo4"); - pi->mcs5gpo[5] = (u16) PHY_GETINTVAR(pi, "mcs5gpo5"); - pi->mcs5gpo[6] = (u16) PHY_GETINTVAR(pi, "mcs5gpo6"); - pi->mcs5gpo[7] = (u16) PHY_GETINTVAR(pi, "mcs5gpo7"); + (s8) wlapi_getintvar(pi->vars, "itt5ga1"); + + pi->ofdm5gpo = + (u32) wlapi_getintvar(pi->vars, "ofdm5gpo"); + + pi->mcs5gpo[0] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo0"); + pi->mcs5gpo[1] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo1"); + pi->mcs5gpo[2] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo2"); + pi->mcs5gpo[3] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo3"); + pi->mcs5gpo[4] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo4"); + pi->mcs5gpo[5] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo5"); + pi->mcs5gpo[6] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo6"); + pi->mcs5gpo[7] = + (u16) wlapi_getintvar(pi->vars, "mcs5gpo7"); break; case 2: pi->nphy_txpid5gl[0] = - (u8) PHY_GETINTVAR(pi, "txpid5gla0"); + (u8) wlapi_getintvar(pi->vars, "txpid5gla0"); pi->nphy_txpid5gl[1] = - (u8) PHY_GETINTVAR(pi, "txpid5gla1"); + (u8) wlapi_getintvar(pi->vars, "txpid5gla1"); pi->nphy_pwrctrl_info[0].max_pwr_5gl = - (s8) PHY_GETINTVAR(pi, "maxp5gla0"); + (s8) wlapi_getintvar(pi->vars, "maxp5gla0"); pi->nphy_pwrctrl_info[1].max_pwr_5gl = - (s8) PHY_GETINTVAR(pi, "maxp5gla1"); + (s8) wlapi_getintvar(pi->vars, "maxp5gla1"); pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 = - (s16) PHY_GETINTVAR(pi, "pa5glw0a0"); + (s16) wlapi_getintvar(pi->vars, "pa5glw0a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 = - (s16) PHY_GETINTVAR(pi, "pa5glw0a1"); + (s16) wlapi_getintvar(pi->vars, "pa5glw0a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 = - (s16) PHY_GETINTVAR(pi, "pa5glw1a0"); + (s16) wlapi_getintvar(pi->vars, "pa5glw1a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 = - (s16) PHY_GETINTVAR(pi, "pa5glw1a1"); + (s16) wlapi_getintvar(pi->vars, "pa5glw1a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 = - (s16) PHY_GETINTVAR(pi, "pa5glw2a0"); + (s16) wlapi_getintvar(pi->vars, "pa5glw2a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 = - (s16) PHY_GETINTVAR(pi, "pa5glw2a1"); + (s16) wlapi_getintvar(pi->vars, "pa5glw2a1"); pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0; pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0; - pi->ofdm5glpo = (u32) PHY_GETINTVAR(pi, "ofdm5glpo"); + pi->ofdm5glpo = + (u32) wlapi_getintvar(pi->vars, "ofdm5glpo"); pi->mcs5glpo[0] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo0"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo0"); pi->mcs5glpo[1] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo1"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo1"); pi->mcs5glpo[2] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo2"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo2"); pi->mcs5glpo[3] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo3"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo3"); pi->mcs5glpo[4] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo4"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo4"); pi->mcs5glpo[5] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo5"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo5"); pi->mcs5glpo[6] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo6"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo6"); pi->mcs5glpo[7] = - (u16) PHY_GETINTVAR(pi, "mcs5glpo7"); + (u16) wlapi_getintvar(pi->vars, "mcs5glpo7"); break; case 3: pi->nphy_txpid5gh[0] = - (u8) PHY_GETINTVAR(pi, "txpid5gha0"); + (u8) wlapi_getintvar(pi->vars, "txpid5gha0"); pi->nphy_txpid5gh[1] = - (u8) PHY_GETINTVAR(pi, "txpid5gha1"); + (u8) wlapi_getintvar(pi->vars, "txpid5gha1"); pi->nphy_pwrctrl_info[0].max_pwr_5gh = - (s8) PHY_GETINTVAR(pi, "maxp5gha0"); + (s8) wlapi_getintvar(pi->vars, "maxp5gha0"); pi->nphy_pwrctrl_info[1].max_pwr_5gh = - (s8) PHY_GETINTVAR(pi, "maxp5gha1"); + (s8) wlapi_getintvar(pi->vars, "maxp5gha1"); pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 = - (s16) PHY_GETINTVAR(pi, "pa5ghw0a0"); + (s16) wlapi_getintvar(pi->vars, "pa5ghw0a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 = - (s16) PHY_GETINTVAR(pi, "pa5ghw0a1"); + (s16) wlapi_getintvar(pi->vars, "pa5ghw0a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 = - (s16) PHY_GETINTVAR(pi, "pa5ghw1a0"); + (s16) wlapi_getintvar(pi->vars, "pa5ghw1a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 = - (s16) PHY_GETINTVAR(pi, "pa5ghw1a1"); + (s16) wlapi_getintvar(pi->vars, "pa5ghw1a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 = - (s16) PHY_GETINTVAR(pi, "pa5ghw2a0"); + (s16) wlapi_getintvar(pi->vars, "pa5ghw2a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 = - (s16) PHY_GETINTVAR(pi, "pa5ghw2a1"); + (s16) wlapi_getintvar(pi->vars, "pa5ghw2a1"); pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0; pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0; - pi->ofdm5ghpo = (u32) PHY_GETINTVAR(pi, "ofdm5ghpo"); + pi->ofdm5ghpo = + (u32) wlapi_getintvar(pi->vars, "ofdm5ghpo"); pi->mcs5ghpo[0] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo0"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo0"); pi->mcs5ghpo[1] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo1"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo1"); pi->mcs5ghpo[2] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo2"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo2"); pi->mcs5ghpo[3] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo3"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo3"); pi->mcs5ghpo[4] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo4"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo4"); pi->mcs5ghpo[5] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo5"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo5"); pi->mcs5ghpo[6] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo6"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo6"); pi->mcs5ghpo[7] = - (u16) PHY_GETINTVAR(pi, "mcs5ghpo7"); + (u16) wlapi_getintvar(pi->vars, "mcs5ghpo7"); break; } } @@ -14589,34 +14609,40 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) { - pi->antswitch = (u8) PHY_GETINTVAR(pi, "antswitch"); - pi->aa2g = (u8) PHY_GETINTVAR(pi, "aa2g"); - pi->aa5g = (u8) PHY_GETINTVAR(pi, "aa5g"); - - pi->srom_fem2g.tssipos = (u8) PHY_GETINTVAR(pi, "tssipos2g"); - pi->srom_fem2g.extpagain = (u8) PHY_GETINTVAR(pi, "extpagain2g"); - pi->srom_fem2g.pdetrange = (u8) PHY_GETINTVAR(pi, "pdetrange2g"); - pi->srom_fem2g.triso = (u8) PHY_GETINTVAR(pi, "triso2g"); - pi->srom_fem2g.antswctrllut = (u8) PHY_GETINTVAR(pi, "antswctl2g"); - - pi->srom_fem5g.tssipos = (u8) PHY_GETINTVAR(pi, "tssipos5g"); - pi->srom_fem5g.extpagain = (u8) PHY_GETINTVAR(pi, "extpagain5g"); - pi->srom_fem5g.pdetrange = (u8) PHY_GETINTVAR(pi, "pdetrange5g"); - pi->srom_fem5g.triso = (u8) PHY_GETINTVAR(pi, "triso5g"); - if (PHY_GETVAR(pi, "antswctl5g")) + pi->antswitch = (u8) wlapi_getintvar(pi->vars, "antswitch"); + pi->aa2g = (u8) wlapi_getintvar(pi->vars, "aa2g"); + pi->aa5g = (u8) wlapi_getintvar(pi->vars, "aa5g"); + + pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos2g"); + pi->srom_fem2g.extpagain = + (u8) wlapi_getintvar(pi->vars, "extpagain2g"); + pi->srom_fem2g.pdetrange = + (u8) wlapi_getintvar(pi->vars, "pdetrange2g"); + pi->srom_fem2g.triso = (u8) wlapi_getintvar(pi->vars, "triso2g"); + pi->srom_fem2g.antswctrllut = + (u8) wlapi_getintvar(pi->vars, "antswctl2g"); + + pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos5g"); + pi->srom_fem5g.extpagain = + (u8) wlapi_getintvar(pi->vars, "extpagain5g"); + pi->srom_fem5g.pdetrange = + (u8) wlapi_getintvar(pi->vars, "pdetrange5g"); + pi->srom_fem5g.triso = (u8) wlapi_getintvar(pi->vars, "triso5g"); + if (wlapi_getvar(pi->vars, "antswctl5g")) pi->srom_fem5g.antswctrllut = - (u8) PHY_GETINTVAR(pi, "antswctl5g"); + (u8) wlapi_getintvar(pi->vars, "antswctl5g"); else pi->srom_fem5g.antswctrllut = - (u8) PHY_GETINTVAR(pi, "antswctl2g"); + (u8) wlapi_getintvar(pi->vars, "antswctl2g"); wlc_phy_txpower_ipa_upd(pi); - pi->phy_txcore_disable_temp = (s16) PHY_GETINTVAR(pi, "tempthresh"); + pi->phy_txcore_disable_temp = + (s16) wlapi_getintvar(pi->vars, "tempthresh"); if (pi->phy_txcore_disable_temp == 0) pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP; - pi->phy_tempsense_offset = (s8) PHY_GETINTVAR(pi, "tempoffset"); + pi->phy_tempsense_offset = (s8) wlapi_getintvar(pi->vars, "tempoffset"); if (pi->phy_tempsense_offset != 0) { if (pi->phy_tempsense_offset > (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET)) @@ -14631,7 +14657,8 @@ static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) pi->phy_txcore_enable_temp = pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP; - pi->phycal_tempdelta = (u8) PHY_GETINTVAR(pi, "phycal_tempdelta"); + pi->phycal_tempdelta = + (u8) wlapi_getintvar(pi->vars, "phycal_tempdelta"); if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA) pi->phycal_tempdelta = 0; diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c index e0c19b6..0be07ed 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c +++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c @@ -215,3 +215,12 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf, { brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel); } + +char *wlapi_getvar(char *vars, const char *name) +{ + return getvar(vars, name); +} +int wlapi_getintvar(char *vars, const char *name) +{ + return getintvar(vars, name); +} diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h index d88c820..35fe993 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h +++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h @@ -178,4 +178,7 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, u32 phy_mode); extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); +extern char *wlapi_getvar(char *vars, const char *name); +extern int wlapi_getintvar(char *vars, const char *name); + #endif /* _BRCM_PHY_SHIM_H_ */ -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/15] staging: brcm80211: change parameter in driver variable lookup 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (3 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 04/15] staging: brcm80211: remove code duplication for driver variable lookup Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 06/15] staging: brcm80211: remove locking macro definitions Arend van Spriel ` (11 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The functions getvar() and getintvar() had to pass the buffer containing the driver variables. Now they pass the structure containing this buffer hiding what type of buffer/container is used for storing the driver variables. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/aiutils.c | 18 +- drivers/staging/brcm80211/brcmsmac/antsel.c | 15 +- drivers/staging/brcm80211/brcmsmac/channel.c | 2 +- drivers/staging/brcm80211/brcmsmac/main.c | 29 ++-- drivers/staging/brcm80211/brcmsmac/nicpci.c | 4 +- drivers/staging/brcm80211/brcmsmac/nicpci.h | 2 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 62 +++---- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 223 +++++++++++----------- drivers/staging/brcm80211/brcmsmac/phy_shim.c | 8 +- drivers/staging/brcm80211/brcmsmac/phy_shim.h | 4 +- drivers/staging/brcm80211/brcmsmac/pub.h | 4 +- drivers/staging/brcm80211/brcmsmac/srom.c | 11 +- drivers/staging/brcm80211/brcmsmac/stf.c | 4 +- 13 files changed, 190 insertions(+), 196 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c index 8d4024e..d44f619 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.c +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c @@ -1012,7 +1012,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx) /* * get boardtype and boardrev */ -static __used void ai_nvram_process(struct si_info *sii, char *pvars) +static __used void ai_nvram_process(struct si_info *sii) { uint w = 0; @@ -1021,7 +1021,7 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars) sii->pub.boardvendor = w & 0xffff; sii->pub.boardtype = (w >> 16) & 0xffff; - sii->pub.boardflags = getintvar(pvars, "boardflags"); + sii->pub.boardflags = getintvar(&sii->pub, "boardflags"); } static struct si_info *ai_doattach(struct si_info *sii, @@ -1031,7 +1031,6 @@ static struct si_info *ai_doattach(struct si_info *sii, struct si_pub *sih = &sii->pub; u32 w, savewin; struct chipcregs __iomem *cc; - char *pvars = NULL; uint socitype; uint origidx; @@ -1095,8 +1094,9 @@ static struct si_info *ai_doattach(struct si_info *sii, if (srom_var_init(&sii->pub, cc, vars, varsz)) goto exit; - pvars = vars ? *vars : NULL; - ai_nvram_process(sii, pvars); + sii->vars = vars ? *vars : NULL; + sii->varsz = varsz ? *varsz : 0; + ai_nvram_process(sii); /* === NVRAM, clock is ready === */ cc = (struct chipcregs __iomem *) ai_setcore(sih, CC_CORE_ID, 0); @@ -1109,7 +1109,7 @@ static struct si_info *ai_doattach(struct si_info *sii, u32 xtalfreq; si_pmu_init(sih); si_pmu_chip_init(sih); - xtalfreq = getintvar(pvars, "xtalfreq"); + xtalfreq = getintvar(sih, "xtalfreq"); /* If xtalfreq var not available, try to measure it */ if (xtalfreq == 0) xtalfreq = si_pmu_measure_alpclk(sih); @@ -1119,14 +1119,14 @@ static struct si_info *ai_doattach(struct si_info *sii, } /* setup the GPIO based LED powersave register */ - w = getintvar(pvars, "leddc"); + w = getintvar(sih, "leddc"); if (w == 0) w = DEFAULT_GPIOTIMERVAL; ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval), ~0, w); if (PCIE(sii)) - pcicore_attach(sii->pch, pvars, SI_DOATTACH); + pcicore_attach(sii->pch, SI_DOATTACH); if (sih->chip == BCM43224_CHIP_ID) { /* @@ -1191,8 +1191,6 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz) kfree(sii); return NULL; } - sii->vars = vars ? *vars : NULL; - sii->varsz = varsz ? *varsz : 0; return (struct si_pub *) sii; } diff --git a/drivers/staging/brcm80211/brcmsmac/antsel.c b/drivers/staging/brcm80211/brcmsmac/antsel.c index c2aa47b..eedcdb6 100644 --- a/drivers/staging/brcm80211/brcmsmac/antsel.c +++ b/drivers/staging/brcm80211/brcmsmac/antsel.c @@ -108,6 +108,7 @@ brcms_c_antsel_init_cfg(struct antsel_info *asi, struct brcms_antselcfg *antsel, struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) { struct antsel_info *asi; + struct si_pub *sih = wlc->hw->sih; asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC); if (!asi) @@ -117,7 +118,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) asi->pub = wlc->pub; asi->antsel_type = ANTSEL_NA; asi->antsel_avail = false; - asi->antsel_antswitch = (u8) getintvar(asi->pub->vars, "antswitch"); + asi->antsel_antswitch = (u8) getintvar(sih, "antswitch"); if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) { switch (asi->antsel_antswitch) { @@ -127,12 +128,12 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) /* 4321/2 board with 2x3 switch logic */ asi->antsel_type = ANTSEL_2x3; /* Antenna selection availability */ - if (((u16) getintvar(asi->pub->vars, "aa2g") == 7) || - ((u16) getintvar(asi->pub->vars, "aa5g") == 7)) { + if (((u16) getintvar(sih, "aa2g") == 7) || + ((u16) getintvar(sih, "aa5g") == 7)) { asi->antsel_avail = true; } else if ( - (u16) getintvar(asi->pub->vars, "aa2g") == 3 || - (u16) getintvar(asi->pub->vars, "aa5g") == 3) { + (u16) getintvar(sih, "aa2g") == 3 || + (u16) getintvar(sih, "aa5g") == 3) { asi->antsel_avail = false; } else { asi->antsel_avail = false; @@ -145,8 +146,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) break; } } else if ((asi->pub->sromrev == 4) && - ((u16) getintvar(asi->pub->vars, "aa2g") == 7) && - ((u16) getintvar(asi->pub->vars, "aa5g") == 0)) { + ((u16) getintvar(sih, "aa2g") == 7) && + ((u16) getintvar(sih, "aa5g") == 0)) { /* hack to match old 4321CB2 cards with 2of3 antenna switch */ asi->antsel_type = ANTSEL_2x3; asi->antsel_avail = true; diff --git a/drivers/staging/brcm80211/brcmsmac/channel.c b/drivers/staging/brcm80211/brcmsmac/channel.c index 2127c27..53066fb 100644 --- a/drivers/staging/brcm80211/brcmsmac/channel.c +++ b/drivers/staging/brcm80211/brcmsmac/channel.c @@ -1088,7 +1088,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) wlc->cmi = wlc_cm; /* store the country code for passing up as a regulatory hint */ - ccode = getvar(wlc->pub->vars, "ccode"); + ccode = getvar(wlc->hw->sih, "ccode"); if (ccode) strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1); diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c index 100e6ec..f2339a5 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.c +++ b/drivers/staging/brcm80211/brcmsmac/main.c @@ -1990,7 +1990,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw) char *macaddr; /* If macaddr exists, use it (Sromrev4, CIS, ...). */ - macaddr = getvar(wlc_hw->vars, varname); + macaddr = getvar(wlc_hw->sih, varname); if (macaddr != NULL) return macaddr; @@ -1999,7 +1999,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw) else varname = "il0macaddr"; - macaddr = getvar(wlc_hw->vars, varname); + macaddr = getvar(wlc_hw->sih, varname); if (macaddr == NULL) wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr " "getvar(%s) not found\n", wlc_hw->unit, varname); @@ -4593,13 +4593,13 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, * than those the BIOS recognizes for devices on PCMCIA_BUS, * SDIO_BUS, and SROMless devices on PCI_BUS. */ - var = getvar(vars, "vendid"); + var = getvar(wlc_hw->sih, "vendid"); if (var && !kstrtoul(var, 0, &res)) { vendor = (u16)res; wiphy_err(wiphy, "Overriding vendor id = 0x%x\n", vendor); } - var = getvar(vars, "devid"); + var = getvar(wlc_hw->sih, "devid"); if (var && !kstrtoul(var, 0, &res)) { u16 devid = (u16)res; if (devid != 0xffff) { @@ -4656,7 +4656,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, } /* get the board rev, used just below */ - j = getintvar(vars, "boardrev"); + j = getintvar(wlc_hw->sih, "boardrev"); /* promote srom boardrev of 0xFF to 1 */ if (j == BOARDREV_PROMOTABLE) j = BOARDREV_PROMOTED; @@ -4668,9 +4668,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, err = 15; goto fail; } - wlc_hw->sromrev = (u8) getintvar(vars, "sromrev"); - wlc_hw->boardflags = (u32) getintvar(vars, "boardflags"); - wlc_hw->boardflags2 = (u32) getintvar(vars, "boardflags2"); + wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, "sromrev"); + wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih, "boardflags"); + wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih, "boardflags2"); if (wlc_hw->boardflags & BFL_NOPLLDOWN) brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); @@ -4920,15 +4920,16 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) uint unit; char *vars; int bandtype; + struct si_pub *sih = wlc->hw->sih; unit = wlc->pub->unit; vars = wlc->pub->vars; bandtype = wlc->band->bandtype; /* get antennas available */ - aa = (s8) getintvar(vars, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g"); + aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g"); if (aa == 0) - aa = (s8) getintvar(vars, + aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa1" : "aa0"); if ((aa < 1) || (aa > 15)) { wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in" @@ -4947,8 +4948,8 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) } /* Compute Antenna Gain */ - wlc->band->antgain = - (s8) getintvar(vars, bandtype == BRCM_BAND_5G ? "ag1" : "ag0"); + wlc->band->antgain = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? + "ag1" : "ag0"); brcms_c_attach_antgain_init(wlc); return true; @@ -5114,9 +5115,9 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, /* set maximum allowed duty cycle */ wlc->tx_duty_cycle_ofdm = - (u16) getintvar(pub->vars, "tx_duty_cycle_ofdm"); + (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_ofdm"); wlc->tx_duty_cycle_cck = - (u16) getintvar(pub->vars, "tx_duty_cycle_cck"); + (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_cck"); brcms_c_stf_phy_chain_calc(wlc); diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c index 460b105..57721a0 100644 --- a/drivers/staging/brcm80211/brcmsmac/nicpci.c +++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c @@ -719,13 +719,13 @@ static void pcie_war_pci_setup(struct pcicore_info *pi) } /* ***** Functions called during driver state changes ***** */ -void pcicore_attach(struct pcicore_info *pi, char *pvars, int state) +void pcicore_attach(struct pcicore_info *pi, int state) { struct si_pub *sih = pi->sih; /* Determine if this board needs override */ if (PCIE_ASPM(sih)) { - if ((u32)getintvar(pvars, "boardflags2") & BFL2_PCIEWAR_OVR) + if ((u32)getintvar(sih, "boardflags2") & BFL2_PCIEWAR_OVR) pi->pcie_war_aspm_ovr = PCIE_ASPM_DISAB; else pi->pcie_war_aspm_ovr = PCIE_ASPM_ENAB; diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.h b/drivers/staging/brcm80211/brcmsmac/nicpci.h index 2d41aab..58aa80d 100644 --- a/drivers/staging/brcm80211/brcmsmac/nicpci.h +++ b/drivers/staging/brcm80211/brcmsmac/nicpci.h @@ -65,7 +65,7 @@ extern struct pcicore_info *pcicore_init(struct si_pub *sih, struct pci_dev *pdev, void __iomem *regs); extern void pcicore_deinit(struct pcicore_info *pch); -extern void pcicore_attach(struct pcicore_info *pch, char *pvars, int state); +extern void pcicore_attach(struct pcicore_info *pch, int state); extern void pcicore_hwup(struct pcicore_info *pch); extern void pcicore_up(struct pcicore_info *pch, int state); extern void pcicore_sleep(struct pcicore_info *pch); diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c index dbeeeba..d84e1cf 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c @@ -4817,27 +4817,25 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) s8 txpwr = 0; int i; struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; + struct phy_shim_info *shim = pi->sh->physhim; if (CHSPEC_IS2G(pi->radio_chanspec)) { u16 cckpo = 0; u32 offset_ofdm, offset_mcs; pi_lcn->lcnphy_tr_isolation_mid = - (u8) wlapi_getintvar(pi->vars, "triso2g"); + (u8)wlapi_getintvar(shim, "triso2g"); pi_lcn->lcnphy_rx_power_offset = - (u8) wlapi_getintvar(pi->vars, "rxpo2g"); + (u8)wlapi_getintvar(shim, "rxpo2g"); - pi->txpa_2g[0] = (s16) wlapi_getintvar(pi->vars, "pa0b0"); - pi->txpa_2g[1] = (s16) wlapi_getintvar(pi->vars, "pa0b1"); - pi->txpa_2g[2] = (s16) wlapi_getintvar(pi->vars, "pa0b2"); + pi->txpa_2g[0] = (s16)wlapi_getintvar(shim, "pa0b0"); + pi->txpa_2g[1] = (s16)wlapi_getintvar(shim, "pa0b1"); + pi->txpa_2g[2] = (s16)wlapi_getintvar(shim, "pa0b2"); - pi_lcn->lcnphy_rssi_vf = - (u8) wlapi_getintvar(pi->vars, "rssismf2g"); - pi_lcn->lcnphy_rssi_vc = - (u8) wlapi_getintvar(pi->vars, "rssismc2g"); - pi_lcn->lcnphy_rssi_gs = - (u8) wlapi_getintvar(pi->vars, "rssisav2g"); + pi_lcn->lcnphy_rssi_vf = (u8)wlapi_getintvar(shim, "rssismf2g"); + pi_lcn->lcnphy_rssi_vc = (u8)wlapi_getintvar(shim, "rssismc2g"); + pi_lcn->lcnphy_rssi_gs = (u8)wlapi_getintvar(shim, "rssisav2g"); pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf; pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc; @@ -4847,7 +4845,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc; pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs; - txpwr = (s8) wlapi_getintvar(pi->vars, "maxp2ga0"); + txpwr = (s8)wlapi_getintvar(shim, "maxp2ga0"); pi->tx_srom_max_2g = txpwr; for (i = 0; i < PWRTBL_NUM_COEFF; i++) { @@ -4855,7 +4853,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) pi->txpa_2g_high_temp[i] = pi->txpa_2g[i]; } - cckpo = (u16) wlapi_getintvar(pi->vars, "cck2gpo"); + cckpo = (u16)wlapi_getintvar(shim, "cck2gpo"); if (cckpo) { uint max_pwr_chan = txpwr; @@ -4865,8 +4863,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) cckpo >>= 4; } - offset_ofdm = - (u32) wlapi_getintvar(pi->vars, "ofdm2gpo"); + offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo"); for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { pi->tx_srom_max_rate_2g[i] = max_pwr_chan - @@ -4876,13 +4873,12 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) } else { u8 opo = 0; - opo = (u8) wlapi_getintvar(pi->vars, "opo"); + opo = (u8)wlapi_getintvar(shim, "opo"); for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) pi->tx_srom_max_rate_2g[i] = txpwr; - offset_ofdm = - (u32) wlapi_getintvar(pi->vars, "ofdm2gpo"); + offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo"); for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { pi->tx_srom_max_rate_2g[i] = txpwr - @@ -4890,9 +4886,9 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) offset_ofdm >>= 4; } offset_mcs = - wlapi_getintvar(pi->vars, "mcs2gpo1") << 16; + wlapi_getintvar(shim, "mcs2gpo1") << 16; offset_mcs |= - (u16) wlapi_getintvar(pi->vars, "mcs2gpo0"); + (u16) wlapi_getintvar(shim, "mcs2gpo0"); pi_lcn->lcnphy_mcs20_po = offset_mcs; for (i = TXP_FIRST_SISO_MCS_20; i <= TXP_LAST_SISO_MCS_20; i++) { @@ -4903,30 +4899,30 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) } pi_lcn->lcnphy_rawtempsense = - (u16) wlapi_getintvar(pi->vars, "rawtempsense"); + (u16)wlapi_getintvar(shim, "rawtempsense"); pi_lcn->lcnphy_measPower = - (u8) wlapi_getintvar(pi->vars, "measpower"); + (u8)wlapi_getintvar(shim, "measpower"); pi_lcn->lcnphy_tempsense_slope = - (u8) wlapi_getintvar(pi->vars, "tempsense_slope"); + (u8)wlapi_getintvar(shim, "tempsense_slope"); pi_lcn->lcnphy_hw_iqcal_en = - (bool) wlapi_getintvar(pi->vars, "hw_iqcal_en"); + (bool)wlapi_getintvar(shim, "hw_iqcal_en"); pi_lcn->lcnphy_iqcal_swp_dis = - (bool) wlapi_getintvar(pi->vars, "iqcal_swp_dis"); + (bool)wlapi_getintvar(shim, "iqcal_swp_dis"); pi_lcn->lcnphy_tempcorrx = - (u8) wlapi_getintvar(pi->vars, "tempcorrx"); + (u8)wlapi_getintvar(shim, "tempcorrx"); pi_lcn->lcnphy_tempsense_option = - (u8) wlapi_getintvar(pi->vars, "tempsense_option"); + (u8)wlapi_getintvar(shim, "tempsense_option"); pi_lcn->lcnphy_freqoffset_corr = - (u8) wlapi_getintvar(pi->vars, "freqoffset_corr"); - if ((u8) getintvar(pi->vars, "aa2g") > 1) + (u8)wlapi_getintvar(shim, "freqoffset_corr"); + if ((u8)wlapi_getintvar(shim, "aa2g") > 1) wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi, - (u8) getintvar(pi->vars, - "aa2g")); + (u8) wlapi_getintvar(shim, + "aa2g")); } pi_lcn->lcnphy_cck_dig_filt_type = -1; - if (wlapi_getvar(pi->vars, "cckdigfilttype")) { + if (wlapi_getvar(shim, "cckdigfilttype")) { s16 temp; - temp = (s16) wlapi_getintvar(pi->vars, "cckdigfilttype"); + temp = (s16)wlapi_getintvar(shim, "cckdigfilttype"); if (temp >= 0) pi_lcn->lcnphy_cck_dig_filt_type = temp; } diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c index c410bf0..a4417e9 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c @@ -14383,29 +14383,30 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) { u16 bw40po, cddpo, stbcpo, bwduppo; uint band_num; + struct phy_shim_info *shim = pi->sh->physhim; if (pi->sh->sromrev >= 9) return; - bw40po = (u16) wlapi_getintvar(pi->vars, "bw40po"); + bw40po = (u16) wlapi_getintvar(shim, "bw40po"); pi->bw402gpo = bw40po & 0xf; pi->bw405gpo = (bw40po & 0xf0) >> 4; pi->bw405glpo = (bw40po & 0xf00) >> 8; pi->bw405ghpo = (bw40po & 0xf000) >> 12; - cddpo = (u16) wlapi_getintvar(pi->vars, "cddpo"); + cddpo = (u16) wlapi_getintvar(shim, "cddpo"); pi->cdd2gpo = cddpo & 0xf; pi->cdd5gpo = (cddpo & 0xf0) >> 4; pi->cdd5glpo = (cddpo & 0xf00) >> 8; pi->cdd5ghpo = (cddpo & 0xf000) >> 12; - stbcpo = (u16) wlapi_getintvar(pi->vars, "stbcpo"); + stbcpo = (u16) wlapi_getintvar(shim, "stbcpo"); pi->stbc2gpo = stbcpo & 0xf; pi->stbc5gpo = (stbcpo & 0xf0) >> 4; pi->stbc5glpo = (stbcpo & 0xf00) >> 8; pi->stbc5ghpo = (stbcpo & 0xf000) >> 12; - bwduppo = (u16) wlapi_getintvar(pi->vars, "bwduppo"); + bwduppo = (u16) wlapi_getintvar(shim, "bwduppo"); pi->bwdup2gpo = bwduppo & 0xf; pi->bwdup5gpo = (bwduppo & 0xf0) >> 4; pi->bwdup5glpo = (bwduppo & 0xf00) >> 8; @@ -14417,188 +14418,186 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) case 0: pi->nphy_txpid2g[PHY_CORE_0] = - (u8) wlapi_getintvar(pi->vars, "txpid2ga0"); + (u8) wlapi_getintvar(shim, "txpid2ga0"); pi->nphy_txpid2g[PHY_CORE_1] = - (u8) wlapi_getintvar(pi->vars, "txpid2ga1"); + (u8) wlapi_getintvar(shim, "txpid2ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g = - (s8) wlapi_getintvar(pi->vars, "maxp2ga0"); + (s8) wlapi_getintvar(shim, "maxp2ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g = - (s8) wlapi_getintvar(pi->vars, "maxp2ga1"); + (s8) wlapi_getintvar(shim, "maxp2ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 = - (s16) wlapi_getintvar(pi->vars, "pa2gw0a0"); + (s16) wlapi_getintvar(shim, "pa2gw0a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 = - (s16) wlapi_getintvar(pi->vars, "pa2gw0a1"); + (s16) wlapi_getintvar(shim, "pa2gw0a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 = - (s16) wlapi_getintvar(pi->vars, "pa2gw1a0"); + (s16) wlapi_getintvar(shim, "pa2gw1a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 = - (s16) wlapi_getintvar(pi->vars, "pa2gw1a1"); + (s16) wlapi_getintvar(shim, "pa2gw1a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 = - (s16) wlapi_getintvar(pi->vars, "pa2gw2a0"); + (s16) wlapi_getintvar(shim, "pa2gw2a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 = - (s16) wlapi_getintvar(pi->vars, "pa2gw2a1"); + (s16) wlapi_getintvar(shim, "pa2gw2a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g = - (s8) wlapi_getintvar(pi->vars, "itt2ga0"); + (s8) wlapi_getintvar(shim, "itt2ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g = - (s8) wlapi_getintvar(pi->vars, "itt2ga1"); + (s8) wlapi_getintvar(shim, "itt2ga1"); - pi->cck2gpo = - (u16) wlapi_getintvar(pi->vars, "cck2gpo"); - pi->ofdm2gpo = - (u32) wlapi_getintvar(pi->vars, "ofdm2gpo"); + pi->cck2gpo = (u16) wlapi_getintvar(shim, "cck2gpo"); + + pi->ofdm2gpo = (u32) wlapi_getintvar(shim, "ofdm2gpo"); pi->mcs2gpo[0] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo0"); + (u16) wlapi_getintvar(shim, "mcs2gpo0"); pi->mcs2gpo[1] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo1"); + (u16) wlapi_getintvar(shim, "mcs2gpo1"); pi->mcs2gpo[2] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo2"); + (u16) wlapi_getintvar(shim, "mcs2gpo2"); pi->mcs2gpo[3] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo3"); + (u16) wlapi_getintvar(shim, "mcs2gpo3"); pi->mcs2gpo[4] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo4"); + (u16) wlapi_getintvar(shim, "mcs2gpo4"); pi->mcs2gpo[5] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo5"); + (u16) wlapi_getintvar(shim, "mcs2gpo5"); pi->mcs2gpo[6] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo6"); + (u16) wlapi_getintvar(shim, "mcs2gpo6"); pi->mcs2gpo[7] = - (u16) wlapi_getintvar(pi->vars, "mcs2gpo7"); + (u16) wlapi_getintvar(shim, "mcs2gpo7"); break; case 1: pi->nphy_txpid5g[PHY_CORE_0] = - (u8) wlapi_getintvar(pi->vars, "txpid5ga0"); + (u8) wlapi_getintvar(shim, "txpid5ga0"); pi->nphy_txpid5g[PHY_CORE_1] = - (u8) wlapi_getintvar(pi->vars, "txpid5ga1"); + (u8) wlapi_getintvar(shim, "txpid5ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm = - (s8) wlapi_getintvar(pi->vars, "maxp5ga0"); + (s8) wlapi_getintvar(shim, "maxp5ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm = - (s8) wlapi_getintvar(pi->vars, "maxp5ga1"); + (s8) wlapi_getintvar(shim, "maxp5ga1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 = - (s16) wlapi_getintvar(pi->vars, "pa5gw0a0"); + (s16) wlapi_getintvar(shim, "pa5gw0a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 = - (s16) wlapi_getintvar(pi->vars, "pa5gw0a1"); + (s16) wlapi_getintvar(shim, "pa5gw0a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 = - (s16) wlapi_getintvar(pi->vars, "pa5gw1a0"); + (s16) wlapi_getintvar(shim, "pa5gw1a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 = - (s16) wlapi_getintvar(pi->vars, "pa5gw1a1"); + (s16) wlapi_getintvar(shim, "pa5gw1a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 = - (s16) wlapi_getintvar(pi->vars, "pa5gw2a0"); + (s16) wlapi_getintvar(shim, "pa5gw2a0"); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 = - (s16) wlapi_getintvar(pi->vars, "pa5gw2a1"); + (s16) wlapi_getintvar(shim, "pa5gw2a1"); pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm = - (s8) wlapi_getintvar(pi->vars, "itt5ga0"); + (s8) wlapi_getintvar(shim, "itt5ga0"); pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm = - (s8) wlapi_getintvar(pi->vars, "itt5ga1"); + (s8) wlapi_getintvar(shim, "itt5ga1"); - pi->ofdm5gpo = - (u32) wlapi_getintvar(pi->vars, "ofdm5gpo"); + pi->ofdm5gpo = (u32) wlapi_getintvar(shim, "ofdm5gpo"); pi->mcs5gpo[0] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo0"); + (u16) wlapi_getintvar(shim, "mcs5gpo0"); pi->mcs5gpo[1] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo1"); + (u16) wlapi_getintvar(shim, "mcs5gpo1"); pi->mcs5gpo[2] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo2"); + (u16) wlapi_getintvar(shim, "mcs5gpo2"); pi->mcs5gpo[3] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo3"); + (u16) wlapi_getintvar(shim, "mcs5gpo3"); pi->mcs5gpo[4] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo4"); + (u16) wlapi_getintvar(shim, "mcs5gpo4"); pi->mcs5gpo[5] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo5"); + (u16) wlapi_getintvar(shim, "mcs5gpo5"); pi->mcs5gpo[6] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo6"); + (u16) wlapi_getintvar(shim, "mcs5gpo6"); pi->mcs5gpo[7] = - (u16) wlapi_getintvar(pi->vars, "mcs5gpo7"); + (u16) wlapi_getintvar(shim, "mcs5gpo7"); break; case 2: pi->nphy_txpid5gl[0] = - (u8) wlapi_getintvar(pi->vars, "txpid5gla0"); + (u8) wlapi_getintvar(shim, "txpid5gla0"); pi->nphy_txpid5gl[1] = - (u8) wlapi_getintvar(pi->vars, "txpid5gla1"); + (u8) wlapi_getintvar(shim, "txpid5gla1"); pi->nphy_pwrctrl_info[0].max_pwr_5gl = - (s8) wlapi_getintvar(pi->vars, "maxp5gla0"); + (s8) wlapi_getintvar(shim, "maxp5gla0"); pi->nphy_pwrctrl_info[1].max_pwr_5gl = - (s8) wlapi_getintvar(pi->vars, "maxp5gla1"); + (s8) wlapi_getintvar(shim, "maxp5gla1"); pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 = - (s16) wlapi_getintvar(pi->vars, "pa5glw0a0"); + (s16) wlapi_getintvar(shim, "pa5glw0a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 = - (s16) wlapi_getintvar(pi->vars, "pa5glw0a1"); + (s16) wlapi_getintvar(shim, "pa5glw0a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 = - (s16) wlapi_getintvar(pi->vars, "pa5glw1a0"); + (s16) wlapi_getintvar(shim, "pa5glw1a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 = - (s16) wlapi_getintvar(pi->vars, "pa5glw1a1"); + (s16) wlapi_getintvar(shim, "pa5glw1a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 = - (s16) wlapi_getintvar(pi->vars, "pa5glw2a0"); + (s16) wlapi_getintvar(shim, "pa5glw2a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 = - (s16) wlapi_getintvar(pi->vars, "pa5glw2a1"); + (s16) wlapi_getintvar(shim, "pa5glw2a1"); pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0; pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0; pi->ofdm5glpo = - (u32) wlapi_getintvar(pi->vars, "ofdm5glpo"); + (u32) wlapi_getintvar(shim, "ofdm5glpo"); pi->mcs5glpo[0] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo0"); + (u16) wlapi_getintvar(shim, "mcs5glpo0"); pi->mcs5glpo[1] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo1"); + (u16) wlapi_getintvar(shim, "mcs5glpo1"); pi->mcs5glpo[2] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo2"); + (u16) wlapi_getintvar(shim, "mcs5glpo2"); pi->mcs5glpo[3] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo3"); + (u16) wlapi_getintvar(shim, "mcs5glpo3"); pi->mcs5glpo[4] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo4"); + (u16) wlapi_getintvar(shim, "mcs5glpo4"); pi->mcs5glpo[5] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo5"); + (u16) wlapi_getintvar(shim, "mcs5glpo5"); pi->mcs5glpo[6] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo6"); + (u16) wlapi_getintvar(shim, "mcs5glpo6"); pi->mcs5glpo[7] = - (u16) wlapi_getintvar(pi->vars, "mcs5glpo7"); + (u16) wlapi_getintvar(shim, "mcs5glpo7"); break; case 3: pi->nphy_txpid5gh[0] = - (u8) wlapi_getintvar(pi->vars, "txpid5gha0"); + (u8) wlapi_getintvar(shim, "txpid5gha0"); pi->nphy_txpid5gh[1] = - (u8) wlapi_getintvar(pi->vars, "txpid5gha1"); + (u8) wlapi_getintvar(shim, "txpid5gha1"); pi->nphy_pwrctrl_info[0].max_pwr_5gh = - (s8) wlapi_getintvar(pi->vars, "maxp5gha0"); + (s8) wlapi_getintvar(shim, "maxp5gha0"); pi->nphy_pwrctrl_info[1].max_pwr_5gh = - (s8) wlapi_getintvar(pi->vars, "maxp5gha1"); + (s8) wlapi_getintvar(shim, "maxp5gha1"); pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 = - (s16) wlapi_getintvar(pi->vars, "pa5ghw0a0"); + (s16) wlapi_getintvar(shim, "pa5ghw0a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 = - (s16) wlapi_getintvar(pi->vars, "pa5ghw0a1"); + (s16) wlapi_getintvar(shim, "pa5ghw0a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 = - (s16) wlapi_getintvar(pi->vars, "pa5ghw1a0"); + (s16) wlapi_getintvar(shim, "pa5ghw1a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 = - (s16) wlapi_getintvar(pi->vars, "pa5ghw1a1"); + (s16) wlapi_getintvar(shim, "pa5ghw1a1"); pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 = - (s16) wlapi_getintvar(pi->vars, "pa5ghw2a0"); + (s16) wlapi_getintvar(shim, "pa5ghw2a0"); pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 = - (s16) wlapi_getintvar(pi->vars, "pa5ghw2a1"); + (s16) wlapi_getintvar(shim, "pa5ghw2a1"); pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0; pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0; pi->ofdm5ghpo = - (u32) wlapi_getintvar(pi->vars, "ofdm5ghpo"); + (u32) wlapi_getintvar(shim, "ofdm5ghpo"); pi->mcs5ghpo[0] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo0"); + (u16) wlapi_getintvar(shim, "mcs5ghpo0"); pi->mcs5ghpo[1] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo1"); + (u16) wlapi_getintvar(shim, "mcs5ghpo1"); pi->mcs5ghpo[2] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo2"); + (u16) wlapi_getintvar(shim, "mcs5ghpo2"); pi->mcs5ghpo[3] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo3"); + (u16) wlapi_getintvar(shim, "mcs5ghpo3"); pi->mcs5ghpo[4] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo4"); + (u16) wlapi_getintvar(shim, "mcs5ghpo4"); pi->mcs5ghpo[5] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo5"); + (u16) wlapi_getintvar(shim, "mcs5ghpo5"); pi->mcs5ghpo[6] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo6"); + (u16) wlapi_getintvar(shim, "mcs5ghpo6"); pi->mcs5ghpo[7] = - (u16) wlapi_getintvar(pi->vars, "mcs5ghpo7"); + (u16) wlapi_getintvar(shim, "mcs5ghpo7"); break; } } @@ -14608,41 +14607,37 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) { - - pi->antswitch = (u8) wlapi_getintvar(pi->vars, "antswitch"); - pi->aa2g = (u8) wlapi_getintvar(pi->vars, "aa2g"); - pi->aa5g = (u8) wlapi_getintvar(pi->vars, "aa5g"); - - pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos2g"); - pi->srom_fem2g.extpagain = - (u8) wlapi_getintvar(pi->vars, "extpagain2g"); - pi->srom_fem2g.pdetrange = - (u8) wlapi_getintvar(pi->vars, "pdetrange2g"); - pi->srom_fem2g.triso = (u8) wlapi_getintvar(pi->vars, "triso2g"); - pi->srom_fem2g.antswctrllut = - (u8) wlapi_getintvar(pi->vars, "antswctl2g"); - - pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos5g"); - pi->srom_fem5g.extpagain = - (u8) wlapi_getintvar(pi->vars, "extpagain5g"); - pi->srom_fem5g.pdetrange = - (u8) wlapi_getintvar(pi->vars, "pdetrange5g"); - pi->srom_fem5g.triso = (u8) wlapi_getintvar(pi->vars, "triso5g"); - if (wlapi_getvar(pi->vars, "antswctl5g")) + struct phy_shim_info *shim = pi->sh->physhim; + + pi->antswitch = (u8) wlapi_getintvar(shim, "antswitch"); + pi->aa2g = (u8) wlapi_getintvar(shim, "aa2g"); + pi->aa5g = (u8) wlapi_getintvar(shim, "aa5g"); + + pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(shim, "tssipos2g"); + pi->srom_fem2g.extpagain = (u8) wlapi_getintvar(shim, "extpagain2g"); + pi->srom_fem2g.pdetrange = (u8) wlapi_getintvar(shim, "pdetrange2g"); + pi->srom_fem2g.triso = (u8) wlapi_getintvar(shim, "triso2g"); + pi->srom_fem2g.antswctrllut = (u8) wlapi_getintvar(shim, "antswctl2g"); + + pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(shim, "tssipos5g"); + pi->srom_fem5g.extpagain = (u8) wlapi_getintvar(shim, "extpagain5g"); + pi->srom_fem5g.pdetrange = (u8) wlapi_getintvar(shim, "pdetrange5g"); + pi->srom_fem5g.triso = (u8) wlapi_getintvar(shim, "triso5g"); + if (wlapi_getvar(shim, "antswctl5g")) pi->srom_fem5g.antswctrllut = - (u8) wlapi_getintvar(pi->vars, "antswctl5g"); + (u8) wlapi_getintvar(shim, "antswctl5g"); else pi->srom_fem5g.antswctrllut = - (u8) wlapi_getintvar(pi->vars, "antswctl2g"); + (u8) wlapi_getintvar(shim, "antswctl2g"); wlc_phy_txpower_ipa_upd(pi); pi->phy_txcore_disable_temp = - (s16) wlapi_getintvar(pi->vars, "tempthresh"); + (s16) wlapi_getintvar(shim, "tempthresh"); if (pi->phy_txcore_disable_temp == 0) pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP; - pi->phy_tempsense_offset = (s8) wlapi_getintvar(pi->vars, "tempoffset"); + pi->phy_tempsense_offset = (s8) wlapi_getintvar(shim, "tempoffset"); if (pi->phy_tempsense_offset != 0) { if (pi->phy_tempsense_offset > (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET)) @@ -14658,7 +14653,7 @@ static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP; pi->phycal_tempdelta = - (u8) wlapi_getintvar(pi->vars, "phycal_tempdelta"); + (u8) wlapi_getintvar(shim, "phycal_tempdelta"); if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA) pi->phycal_tempdelta = 0; diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c index 0be07ed..57122fc 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c +++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c @@ -216,11 +216,11 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf, brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel); } -char *wlapi_getvar(char *vars, const char *name) +char *wlapi_getvar(struct phy_shim_info *physhim, const char *name) { - return getvar(vars, name); + return getvar(physhim->wlc_hw->sih, name); } -int wlapi_getintvar(char *vars, const char *name) +int wlapi_getintvar(struct phy_shim_info *physhim, const char *name) { - return getintvar(vars, name); + return getintvar(physhim->wlc_hw->sih, name); } diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h index 35fe993..ca76153 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h +++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h @@ -178,7 +178,7 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, u32 phy_mode); extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); -extern char *wlapi_getvar(char *vars, const char *name); -extern int wlapi_getintvar(char *vars, const char *name); +extern char *wlapi_getvar(struct phy_shim_info *physhim, const char *name); +extern int wlapi_getintvar(struct phy_shim_info *physhim, const char *name); #endif /* _BRCM_PHY_SHIM_H_ */ diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h index b69833e..d1639b4 100644 --- a/drivers/staging/brcm80211/brcmsmac/pub.h +++ b/drivers/staging/brcm80211/brcmsmac/pub.h @@ -356,8 +356,8 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, struct ieee80211_sta *sta, u16 tid); extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, u8 ba_wsize, uint max_rx_ampdu_bytes); -extern char *getvar(char *vars, const char *name); -extern int getintvar(char *vars, const char *name); +extern char *getvar(struct si_pub *sih, const char *name); +extern int getintvar(struct si_pub *sih, const char *name); /* wlc_phy.c helper functions */ extern void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc); diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index 02dbd98..524f1cc 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -1247,10 +1247,13 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, * Search the name=value vars for a specific one and return its value. * Returns NULL if not found. */ -char *getvar(char *vars, const char *name) +char *getvar(struct si_pub *sih, const char *name) { char *s; int len; + struct si_info *sii; + + sii = (struct si_info *)sih; if (!name) return NULL; @@ -1260,7 +1263,7 @@ char *getvar(char *vars, const char *name) return NULL; /* first look in vars[] */ - for (s = vars; s && *s;) { + for (s = sii->vars; s && *s;) { if ((memcmp(s, name, len) == 0) && (s[len] == '=')) return &s[len + 1]; @@ -1275,12 +1278,12 @@ char *getvar(char *vars, const char *name) * Search the vars for a specific one and return its value as * an integer. Returns 0 if not found. */ -int getintvar(char *vars, const char *name) +int getintvar(struct si_pub *sih, const char *name) { char *val; unsigned long res; - val = getvar(vars, name); + val = getvar(sih, name); if (val && !kstrtoul(val, 0, &res)) return res; diff --git a/drivers/staging/brcm80211/brcmsmac/stf.c b/drivers/staging/brcm80211/brcmsmac/stf.c index 9460cd1..3ce9049 100644 --- a/drivers/staging/brcm80211/brcmsmac/stf.c +++ b/drivers/staging/brcm80211/brcmsmac/stf.c @@ -373,8 +373,8 @@ void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc) { /* get available rx/tx chains */ - wlc->stf->hw_txchain = (u8) getintvar(wlc->pub->vars, "txchain"); - wlc->stf->hw_rxchain = (u8) getintvar(wlc->pub->vars, "rxchain"); + wlc->stf->hw_txchain = (u8) getintvar(wlc->hw->sih, "txchain"); + wlc->stf->hw_rxchain = (u8) getintvar(wlc->hw->sih, "rxchain"); /* these parameter are intended to be used for all PHY types */ if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/15] staging: brcm80211: remove locking macro definitions 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (4 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 05/15] staging: brcm80211: change parameter in " Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 07/15] staging: brcm80211: fix thread blocking issue in brcmf_sdbrcm_bus_stop() Arend van Spriel ` (10 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The driver contained locking macros which map directly to the lock function provided by the kernel. It does not provide any additional value so these have been removed. Reported-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 157 ++++++++++------------ 1 files changed, 68 insertions(+), 89 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c index ac78052..185a098 100644 --- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c @@ -35,26 +35,6 @@ #define N_TX_QUEUES 4 /* #tx queues on mac80211<->driver interface */ -#define LOCK(wl) spin_lock_bh(&(wl)->lock) -#define UNLOCK(wl) spin_unlock_bh(&(wl)->lock) - -/* locking from inside brcms_isr */ -#define ISR_LOCK(wl, flags)\ - do {\ - spin_lock(&(wl)->isr_lock);\ - (void)(flags); } \ - while (0) - -#define ISR_UNLOCK(wl, flags)\ - do {\ - spin_unlock(&(wl)->isr_lock);\ - (void)(flags); } \ - while (0) - -/* locking under LOCK() to synchronize with brcms_isr */ -#define INT_LOCK(wl, flags) spin_lock_irqsave(&(wl)->isr_lock, flags) -#define INT_UNLOCK(wl, flags) spin_unlock_irqrestore(&(wl)->isr_lock, flags) - /* Flags we support */ #define MAC_FILTERS (FIF_PROMISC_IN_BSS | \ FIF_ALLMULTI | \ @@ -291,7 +271,7 @@ static void brcms_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { struct brcms_info *wl = hw->priv; - LOCK(wl); + spin_lock_bh(&wl->lock); if (!wl->pub->up) { wiphy_err(wl->wiphy, "ops->tx called while down\n"); kfree_skb(skb); @@ -299,7 +279,7 @@ static void brcms_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) } brcms_c_sendpkt_mac80211(wl->wlc, skb, hw); done: - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } static int brcms_ops_start(struct ieee80211_hw *hw) @@ -308,9 +288,9 @@ static int brcms_ops_start(struct ieee80211_hw *hw) bool blocked; ieee80211_wake_queues(hw); - LOCK(wl); + spin_lock_bh(&wl->lock); blocked = brcms_rfkill_set_hw_state(wl); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); if (!blocked) wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); @@ -340,12 +320,12 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) } wl = hw->priv; - LOCK(wl); + spin_lock_bh(&wl->lock); if (!wl->pub->up) err = brcms_up(wl); else err = -ENODEV; - UNLOCK(wl); + spin_unlock_bh(&wl->lock); if (err != 0) wiphy_err(hw->wiphy, "%s: brcms_up() returned %d\n", __func__, @@ -362,9 +342,9 @@ brcms_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wl = hw->priv; /* put driver in down state */ - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_down(wl); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) @@ -375,7 +355,7 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) int new_int; struct wiphy *wiphy = hw->wiphy; - LOCK(wl); + spin_lock_bh(&wl->lock); if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { brcms_c_set_beacon_listen_interval(wl->wlc, conf->listen_interval); @@ -416,7 +396,7 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) conf->long_frame_max_tx_count); config_out: - UNLOCK(wl); + spin_unlock_bh(&wl->lock); return err; } @@ -434,9 +414,9 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, */ wiphy_err(wiphy, "%s: %s: %sassociated\n", KBUILD_MODNAME, __func__, info->assoc ? "" : "dis"); - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_associate_upd(wl->wlc, info->assoc); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } if (changed & BSS_CHANGED_ERP_SLOT) { s8 val; @@ -446,23 +426,23 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, val = 1; else val = 0; - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_set_shortslot_override(wl->wlc, val); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } if (changed & BSS_CHANGED_HT) { /* 802.11n parameters changed */ u16 mode = info->ht_operation_mode; - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_CFG, mode & IEEE80211_HT_OP_MODE_PROTECTION); brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_NONGF, mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_OBSS, mode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } if (changed & BSS_CHANGED_BASIC_RATES) { struct ieee80211_supported_band *bi; @@ -472,9 +452,9 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, int error; /* retrieve the current rates */ - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_get_current_rateset(wl->wlc, &rs); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); br_mask = info->basic_rates; bi = hw->wiphy->bands[brcms_c_get_curband(wl->wlc)]; @@ -488,24 +468,24 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, } /* update the rate set */ - LOCK(wl); + spin_lock_bh(&wl->lock); error = brcms_c_set_rateset(wl->wlc, &rs); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); if (error) wiphy_err(wiphy, "changing basic rates failed: %d\n", error); } if (changed & BSS_CHANGED_BEACON_INT) { /* Beacon interval changed */ - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_set_beacon_period(wl->wlc, info->beacon_int); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } if (changed & BSS_CHANGED_BSSID) { /* BSSID changed, for whatever reason (IBSS and managed mode) */ - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_set_addrmatch(wl->wlc, RCM_BSSID_OFFSET, info->bssid); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } if (changed & BSS_CHANGED_BEACON) /* Beacon data changed, retrieve new beacon (beaconing modes) */ @@ -571,7 +551,7 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw, if (changed_flags & FIF_OTHER_BSS) wiphy_err(wiphy, "FIF_OTHER_BSS\n"); if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { - LOCK(wl); + spin_lock_bh(&wl->lock); if (*total_flags & FIF_BCN_PRBRESP_PROMISC) { wl->pub->mac80211_state |= MAC80211_PROMISC_BCNS; brcms_c_mac_bcn_promisc_change(wl->wlc, 1); @@ -579,7 +559,7 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw, brcms_c_mac_bcn_promisc_change(wl->wlc, 0); wl->pub->mac80211_state &= ~MAC80211_PROMISC_BCNS; } - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } return; } @@ -587,18 +567,18 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw, static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw) { struct brcms_info *wl = hw->priv; - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_scan_start(wl->wlc); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); return; } static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw) { struct brcms_info *wl = hw->priv; - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_scan_stop(wl->wlc); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); return; } @@ -608,9 +588,9 @@ brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue, { struct brcms_info *wl = hw->priv; - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_wme_setparams(wl->wlc, queue, params, true); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); return 0; } @@ -661,9 +641,9 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, case IEEE80211_AMPDU_RX_STOP: break; case IEEE80211_AMPDU_TX_START: - LOCK(wl); + spin_lock_bh(&wl->lock); status = brcms_c_aggregatable(wl->wlc, tid); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); if (!status) { wiphy_err(wl->wiphy, "START: tid %d is not agg\'able\n", tid); @@ -673,9 +653,9 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, break; case IEEE80211_AMPDU_TX_STOP: - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_ampdu_flush(wl->wlc, sta, tid); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); break; case IEEE80211_AMPDU_TX_OPERATIONAL: @@ -685,11 +665,11 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, * recipient and traffic class. 'ampdu_factor' gives maximum * AMPDU size. */ - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_ampdu_tx_operational(wl->wlc, tid, buf_size, (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + sta->ht_cap.ampdu_factor)) - 1); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); /* Power save wakeup */ break; default: @@ -705,9 +685,9 @@ static void brcms_ops_rfkill_poll(struct ieee80211_hw *hw) struct brcms_info *wl = hw->priv; bool blocked; - LOCK(wl); + spin_lock_bh(&wl->lock); blocked = brcms_c_check_radio_disabled(wl->wlc); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, blocked); } @@ -719,9 +699,9 @@ static void brcms_ops_flush(struct ieee80211_hw *hw, bool drop) no_printk("%s: drop = %s\n", __func__, drop ? "true" : "false"); /* wait for packet queue and dma fifos to run empty */ - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_c_wait_for_tx_completion(wl->wlc, drop); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } static const struct ieee80211_ops brcms_ops = { @@ -756,16 +736,16 @@ void brcms_dpc(unsigned long data) wl = (struct brcms_info *) data; - LOCK(wl); + spin_lock_bh(&wl->lock); /* call the common second level interrupt handler */ if (wl->pub->up) { if (wl->resched) { unsigned long flags; - INT_LOCK(wl, flags); + spin_lock_irqsave(&wl->isr_lock, flags); brcms_c_intrsupd(wl->wlc); - INT_UNLOCK(wl, flags); + spin_unlock_irqrestore(&wl->isr_lock, flags); } wl->resched = brcms_c_dpc(wl->wlc, true); @@ -783,7 +763,7 @@ void brcms_dpc(unsigned long data) brcms_intrson(wl); done: - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } /* @@ -912,9 +892,9 @@ static void brcms_remove(struct pci_dev *pdev) return; } - LOCK(wl); + spin_lock_bh(&wl->lock); status = brcms_c_chipmatch(pdev->vendor, pdev->device); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); if (!status) { wiphy_err(wl->wiphy, "wl: brcms_remove: chipmatch " "failed\n"); @@ -924,9 +904,9 @@ static void brcms_remove(struct pci_dev *pdev) wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); ieee80211_unregister_hw(hw); - LOCK(wl); + spin_lock_bh(&wl->lock); brcms_down(wl); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); } pci_disable_device(pdev); @@ -940,11 +920,10 @@ static irqreturn_t brcms_isr(int irq, void *dev_id) { struct brcms_info *wl; bool ours, wantdpc; - unsigned long flags; wl = (struct brcms_info *) dev_id; - ISR_LOCK(wl, flags); + spin_lock(&wl->isr_lock); /* call common first level interrupt handler */ ours = brcms_c_isr(wl->wlc, &wantdpc); @@ -958,7 +937,7 @@ static irqreturn_t brcms_isr(int irq, void *dev_id) } } - ISR_UNLOCK(wl, flags); + spin_unlock(&wl->isr_lock); return IRQ_RETVAL(ours); } @@ -1226,9 +1205,9 @@ static int brcms_suspend(struct pci_dev *pdev, pm_message_t state) } /* only need to flag hw is down for proper resume */ - LOCK(wl); + spin_lock_bh(&wl->lock); wl->pub->hw_up = false; - UNLOCK(wl); + spin_unlock_bh(&wl->lock); pci_save_state(pdev); pci_disable_device(pdev); @@ -1365,9 +1344,9 @@ void brcms_intrson(struct brcms_info *wl) { unsigned long flags; - INT_LOCK(wl, flags); + spin_lock_irqsave(&wl->isr_lock, flags); brcms_c_intrson(wl->wlc); - INT_UNLOCK(wl, flags); + spin_unlock_irqrestore(&wl->isr_lock, flags); } u32 brcms_intrsoff(struct brcms_info *wl) @@ -1375,9 +1354,9 @@ u32 brcms_intrsoff(struct brcms_info *wl) unsigned long flags; u32 status; - INT_LOCK(wl, flags); + spin_lock_irqsave(&wl->isr_lock, flags); status = brcms_c_intrsoff(wl->wlc); - INT_UNLOCK(wl, flags); + spin_unlock_irqrestore(&wl->isr_lock, flags); return status; } @@ -1385,9 +1364,9 @@ void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask) { unsigned long flags; - INT_LOCK(wl, flags); + spin_lock_irqsave(&wl->isr_lock, flags); brcms_c_intrsrestore(wl->wlc, macintmask); - INT_UNLOCK(wl, flags); + spin_unlock_irqrestore(&wl->isr_lock, flags); } /* @@ -1417,14 +1396,14 @@ void brcms_down(struct brcms_info *wl) callbacks = atomic_read(&wl->callbacks) - ret_val; /* wait for down callbacks to complete */ - UNLOCK(wl); + spin_unlock_bh(&wl->lock); /* For HIGH_only driver, it's important to actually schedule other work, * not just spin wait since everything runs at schedule level */ SPINWAIT((atomic_read(&wl->callbacks) > callbacks), 100 * 1000); - LOCK(wl); + spin_lock_bh(&wl->lock); } /* @@ -1432,7 +1411,7 @@ void brcms_down(struct brcms_info *wl) */ void brcms_timer(struct brcms_timer *t) { - LOCK(t->wl); + spin_lock_bh(&t->wl->lock); if (t->set) { if (t->periodic) { @@ -1448,7 +1427,7 @@ void brcms_timer(struct brcms_timer *t) atomic_dec(&t->wl->callbacks); - UNLOCK(t->wl); + spin_unlock_bh(&t->wl->lock); } /* @@ -1703,11 +1682,11 @@ bool brcms_rfkill_set_hw_state(struct brcms_info *wl) { bool blocked = brcms_c_check_radio_disabled(wl->wlc); - UNLOCK(wl); + spin_unlock_bh(&wl->lock); wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, blocked); if (blocked) wiphy_rfkill_start_polling(wl->pub->ieee_hw->wiphy); - LOCK(wl); + spin_lock_bh(&wl->lock); return blocked; } @@ -1716,7 +1695,7 @@ bool brcms_rfkill_set_hw_state(struct brcms_info *wl) */ void brcms_msleep(struct brcms_info *wl, uint ms) { - UNLOCK(wl); + spin_unlock_bh(&wl->lock); msleep(ms); - LOCK(wl); + spin_lock_bh(&wl->lock); } -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/15] staging: brcm80211: fix thread blocking issue in brcmf_sdbrcm_bus_stop() 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (5 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 06/15] staging: brcm80211: remove locking macro definitions Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 08/15] staging: brcm80211: remove invalid variable lookup from srom Arend van Spriel ` (9 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The function brcmf_sdbrcm_bus_stop() terminates the watchdog and dpc thread, but this function can be called from the dpc thread itself. Stopping the dpc thread is only done when it is not the 'current' thread. Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index 0f7b80d..6885755 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -2694,7 +2694,10 @@ static int brcmf_sdbrcm_dpc_thread(void *data) if (brcmf_sdbrcm_dpc(bus)) complete(&bus->dpc_wait); } else { + /* after stopping the bus, exit thread */ brcmf_sdbrcm_bus_stop(bus); + bus->dpc_tsk = NULL; + break; } } else break; @@ -3601,25 +3604,25 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus) brcmf_dbg(TRACE, "Enter\n"); - down(&bus->sdsem); - - bus_wake(bus); - - /* Enable clock for device interrupts */ - brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); - if (bus->watchdog_tsk) { send_sig(SIGTERM, bus->watchdog_tsk, 1); kthread_stop(bus->watchdog_tsk); bus->watchdog_tsk = NULL; } - if (bus->dpc_tsk) { + if (bus->dpc_tsk && bus->dpc_tsk != current) { send_sig(SIGTERM, bus->dpc_tsk, 1); kthread_stop(bus->dpc_tsk); bus->dpc_tsk = NULL; } + down(&bus->sdsem); + + bus_wake(bus); + + /* Enable clock for device interrupts */ + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); + /* Disable and clear interrupts at the chip level also */ w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask), &retries); local_hostintmask = bus->hostintmask; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/15] staging: brcm80211: remove invalid variable lookup from srom 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (6 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 07/15] staging: brcm80211: fix thread blocking issue in brcmf_sdbrcm_bus_stop() Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 09/15] staging: brcm80211: use identifiers instead of string for srom lookup Arend van Spriel ` (8 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel In the driver several driver variables were looked up that are not supported by the srom code. These have been removed. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Brett Rudley <brudley@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/aiutils.c | 6 +-- drivers/staging/brcm80211/brcmsmac/main.c | 34 ++-------------------- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 6 ---- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c index d44f619..2bc4bb3 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.c +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c @@ -1109,10 +1109,8 @@ static struct si_info *ai_doattach(struct si_info *sii, u32 xtalfreq; si_pmu_init(sih); si_pmu_chip_init(sih); - xtalfreq = getintvar(sih, "xtalfreq"); - /* If xtalfreq var not available, try to measure it */ - if (xtalfreq == 0) - xtalfreq = si_pmu_measure_alpclk(sih); + + xtalfreq = si_pmu_measure_alpclk(sih); si_pmu_pll_init(sih, xtalfreq); si_pmu_res_init(sih); si_pmu_swreg_init(sih); diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c index f2339a5..cfa918d 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.c +++ b/drivers/staging/brcm80211/brcmsmac/main.c @@ -4557,8 +4557,6 @@ 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; - char *var; - unsigned long res; BCMMSG(wlc->wiphy, "wl%d: vendor 0x%x device 0x%x\n", unit, vendor, device); @@ -4588,27 +4586,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, } vars = wlc_hw->vars; - /* - * Get vendid/devid nvram overwrites, which could be different - * than those the BIOS recognizes for devices on PCMCIA_BUS, - * SDIO_BUS, and SROMless devices on PCI_BUS. - */ - var = getvar(wlc_hw->sih, "vendid"); - if (var && !kstrtoul(var, 0, &res)) { - vendor = (u16)res; - wiphy_err(wiphy, "Overriding vendor id = 0x%x\n", - vendor); - } - var = getvar(wlc_hw->sih, "devid"); - if (var && !kstrtoul(var, 0, &res)) { - u16 devid = (u16)res; - if (devid != 0xffff) { - device = devid; - wiphy_err(wiphy, "Overriding device id = 0x%x" - "\n", device); - } - } - /* verify again the device is supported */ if (!brcms_c_chipmatch(vendor, device)) { wiphy_err(wiphy, "wl%d: brcms_b_attach: Unsupported " @@ -4928,9 +4905,6 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) /* get antennas available */ aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g"); - if (aa == 0) - aa = (s8) getintvar(sih, - bandtype == BRCM_BAND_5G ? "aa1" : "aa0"); if ((aa < 1) || (aa > 15)) { wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in" " srom (0x%x), using 3\n", unit, __func__, aa); @@ -5113,11 +5087,9 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, brcms_b_copyfrom_vars(wlc->hw, &pub->vars, &wlc->vars_size); - /* set maximum allowed duty cycle */ - wlc->tx_duty_cycle_ofdm = - (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_ofdm"); - wlc->tx_duty_cycle_cck = - (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_cck"); + /* disable allowed duty cycle */ + wlc->tx_duty_cycle_ofdm = 0; + wlc->tx_duty_cycle_cck = 0; brcms_c_stf_phy_chain_calc(wlc); diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c index d84e1cf..4bcf305 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c @@ -4920,12 +4920,6 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) "aa2g")); } pi_lcn->lcnphy_cck_dig_filt_type = -1; - if (wlapi_getvar(shim, "cckdigfilttype")) { - s16 temp; - temp = (s16)wlapi_getintvar(shim, "cckdigfilttype"); - if (temp >= 0) - pi_lcn->lcnphy_cck_dig_filt_type = temp; - } return true; } -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/15] staging: brcm80211: use identifiers instead of string for srom lookup 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (7 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 08/15] staging: brcm80211: remove invalid variable lookup from srom Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 10/15] staging: brcm80211: use enum identifiers in srom variable tables Arend van Spriel ` (7 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The driver variables from srom are stored in memory with string identifiers and the caller needed to use this string identifier to retrieve a driver variable. The commit changes the calling code replacing strings with enumerated identifiers. Reported-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/aiutils.c | 4 +- drivers/staging/brcm80211/brcmsmac/antsel.c | 14 +- drivers/staging/brcm80211/brcmsmac/channel.c | 2 +- drivers/staging/brcm80211/brcmsmac/main.c | 35 ++- drivers/staging/brcm80211/brcmsmac/nicpci.c | 3 +- drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 56 ++-- drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 296 ++++++++++++++-------- drivers/staging/brcm80211/brcmsmac/phy_shim.c | 8 +- drivers/staging/brcm80211/brcmsmac/phy_shim.h | 5 +- drivers/staging/brcm80211/brcmsmac/pub.h | 262 +++++++++++++++++++- drivers/staging/brcm80211/brcmsmac/srom.c | 284 ++++++++++++++++++++- drivers/staging/brcm80211/brcmsmac/stf.c | 4 +- 12 files changed, 802 insertions(+), 171 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c index 2bc4bb3..6086c26 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.c +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c @@ -1021,7 +1021,7 @@ 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, "boardflags"); + sii->pub.boardflags = getintvar(&sii->pub, BRCMS_SROM_BOARDFLAGS); } static struct si_info *ai_doattach(struct si_info *sii, @@ -1117,7 +1117,7 @@ static struct si_info *ai_doattach(struct si_info *sii, } /* setup the GPIO based LED powersave register */ - w = getintvar(sih, "leddc"); + w = getintvar(sih, BRCMS_SROM_LEDDC); if (w == 0) w = DEFAULT_GPIOTIMERVAL; ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval), diff --git a/drivers/staging/brcm80211/brcmsmac/antsel.c b/drivers/staging/brcm80211/brcmsmac/antsel.c index eedcdb6..edc4016 100644 --- a/drivers/staging/brcm80211/brcmsmac/antsel.c +++ b/drivers/staging/brcm80211/brcmsmac/antsel.c @@ -118,7 +118,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) asi->pub = wlc->pub; asi->antsel_type = ANTSEL_NA; asi->antsel_avail = false; - asi->antsel_antswitch = (u8) getintvar(sih, "antswitch"); + asi->antsel_antswitch = (u8) getintvar(sih, BRCMS_SROM_ANTSWITCH); if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) { switch (asi->antsel_antswitch) { @@ -128,12 +128,12 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) /* 4321/2 board with 2x3 switch logic */ asi->antsel_type = ANTSEL_2x3; /* Antenna selection availability */ - if (((u16) getintvar(sih, "aa2g") == 7) || - ((u16) getintvar(sih, "aa5g") == 7)) { + if (((u16) getintvar(sih, BRCMS_SROM_AA2G) == 7) || + ((u16) getintvar(sih, BRCMS_SROM_AA5G) == 7)) { asi->antsel_avail = true; } else if ( - (u16) getintvar(sih, "aa2g") == 3 || - (u16) getintvar(sih, "aa5g") == 3) { + (u16) getintvar(sih, BRCMS_SROM_AA2G) == 3 || + (u16) getintvar(sih, BRCMS_SROM_AA5G) == 3) { asi->antsel_avail = false; } else { asi->antsel_avail = false; @@ -146,8 +146,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) break; } } else if ((asi->pub->sromrev == 4) && - ((u16) getintvar(sih, "aa2g") == 7) && - ((u16) getintvar(sih, "aa5g") == 0)) { + ((u16) getintvar(sih, BRCMS_SROM_AA2G) == 7) && + ((u16) getintvar(sih, BRCMS_SROM_AA5G) == 0)) { /* hack to match old 4321CB2 cards with 2of3 antenna switch */ asi->antsel_type = ANTSEL_2x3; asi->antsel_avail = true; diff --git a/drivers/staging/brcm80211/brcmsmac/channel.c b/drivers/staging/brcm80211/brcmsmac/channel.c index 53066fb..a1b415d 100644 --- a/drivers/staging/brcm80211/brcmsmac/channel.c +++ b/drivers/staging/brcm80211/brcmsmac/channel.c @@ -1088,7 +1088,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) wlc->cmi = wlc_cm; /* store the country code for passing up as a regulatory hint */ - ccode = getvar(wlc->hw->sih, "ccode"); + ccode = getvar(wlc->hw->sih, BRCMS_SROM_CCODE); if (ccode) strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1); diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c index cfa918d..5ec25e8 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.c +++ b/drivers/staging/brcm80211/brcmsmac/main.c @@ -1986,23 +1986,23 @@ static bool brcms_c_validboardtype(struct brcms_hardware *wlc_hw) static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw) { - const char *varname = "macaddr"; + enum brcms_srom_id var_id = BRCMS_SROM_MACADDR; char *macaddr; /* If macaddr exists, use it (Sromrev4, CIS, ...). */ - macaddr = getvar(wlc_hw->sih, varname); + macaddr = getvar(wlc_hw->sih, var_id); if (macaddr != NULL) return macaddr; if (wlc_hw->_nbands > 1) - varname = "et1macaddr"; + var_id = BRCMS_SROM_ET1MACADDR; else - varname = "il0macaddr"; + var_id = BRCMS_SROM_IL0MACADDR; - macaddr = getvar(wlc_hw->sih, varname); + macaddr = getvar(wlc_hw->sih, var_id); if (macaddr == NULL) wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr " - "getvar(%s) not found\n", wlc_hw->unit, varname); + "getvar(%d) not found\n", wlc_hw->unit, var_id); return macaddr; } @@ -4633,7 +4633,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, } /* get the board rev, used just below */ - j = getintvar(wlc_hw->sih, "boardrev"); + j = getintvar(wlc_hw->sih, BRCMS_SROM_BOARDREV); /* promote srom boardrev of 0xFF to 1 */ if (j == BOARDREV_PROMOTABLE) j = BOARDREV_PROMOTED; @@ -4645,9 +4645,11 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, err = 15; goto fail; } - wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, "sromrev"); - wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih, "boardflags"); - wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih, "boardflags2"); + wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, BRCMS_SROM_REV); + wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih, + BRCMS_SROM_BOARDFLAGS); + wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih, + BRCMS_SROM_BOARDFLAGS2); if (wlc_hw->boardflags & BFL_NOPLLDOWN) brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); @@ -4904,7 +4906,11 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) bandtype = wlc->band->bandtype; /* get antennas available */ - aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g"); + if (bandtype == BRCM_BAND_5G) + aa = (s8) getintvar(sih, BRCMS_SROM_AA5G); + else + aa = (s8) getintvar(sih, BRCMS_SROM_AA2G); + if ((aa < 1) || (aa > 15)) { wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in" " srom (0x%x), using 3\n", unit, __func__, aa); @@ -4922,8 +4928,11 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) } /* Compute Antenna Gain */ - wlc->band->antgain = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? - "ag1" : "ag0"); + if (bandtype == BRCM_BAND_5G) + wlc->band->antgain = (s8) getintvar(sih, BRCMS_SROM_AG1); + else + wlc->band->antgain = (s8) getintvar(sih, BRCMS_SROM_AG0); + brcms_c_attach_antgain_init(wlc); return true; diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c index 57721a0..0bcb267 100644 --- a/drivers/staging/brcm80211/brcmsmac/nicpci.c +++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c @@ -722,10 +722,11 @@ static void pcie_war_pci_setup(struct pcicore_info *pi) void pcicore_attach(struct pcicore_info *pi, int state) { struct si_pub *sih = pi->sih; + u32 bfl2 = (u32)getintvar(sih, BRCMS_SROM_BOARDFLAGS2); /* Determine if this board needs override */ if (PCIE_ASPM(sih)) { - if ((u32)getintvar(sih, "boardflags2") & BFL2_PCIEWAR_OVR) + if (bfl2 & BFL2_PCIEWAR_OVR) pi->pcie_war_aspm_ovr = PCIE_ASPM_DISAB; else pi->pcie_war_aspm_ovr = PCIE_ASPM_ENAB; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c index 4bcf305..a63aa99 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c @@ -4824,18 +4824,21 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) u32 offset_ofdm, offset_mcs; pi_lcn->lcnphy_tr_isolation_mid = - (u8)wlapi_getintvar(shim, "triso2g"); + (u8)wlapi_getintvar(shim, BRCMS_SROM_TRISO2G); pi_lcn->lcnphy_rx_power_offset = - (u8)wlapi_getintvar(shim, "rxpo2g"); + (u8)wlapi_getintvar(shim, BRCMS_SROM_RXPO2G); - pi->txpa_2g[0] = (s16)wlapi_getintvar(shim, "pa0b0"); - pi->txpa_2g[1] = (s16)wlapi_getintvar(shim, "pa0b1"); - pi->txpa_2g[2] = (s16)wlapi_getintvar(shim, "pa0b2"); + pi->txpa_2g[0] = (s16)wlapi_getintvar(shim, BRCMS_SROM_PA0B0); + pi->txpa_2g[1] = (s16)wlapi_getintvar(shim, BRCMS_SROM_PA0B1); + pi->txpa_2g[2] = (s16)wlapi_getintvar(shim, BRCMS_SROM_PA0B2); - pi_lcn->lcnphy_rssi_vf = (u8)wlapi_getintvar(shim, "rssismf2g"); - pi_lcn->lcnphy_rssi_vc = (u8)wlapi_getintvar(shim, "rssismc2g"); - pi_lcn->lcnphy_rssi_gs = (u8)wlapi_getintvar(shim, "rssisav2g"); + pi_lcn->lcnphy_rssi_vf = + (u8)wlapi_getintvar(shim, BRCMS_SROM_RSSISMF2G); + pi_lcn->lcnphy_rssi_vc = + (u8)wlapi_getintvar(shim, BRCMS_SROM_RSSISMC2G); + pi_lcn->lcnphy_rssi_gs = + (u8)wlapi_getintvar(shim, BRCMS_SROM_RSSISAV2G); pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf; pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc; @@ -4845,7 +4848,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc; pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs; - txpwr = (s8)wlapi_getintvar(shim, "maxp2ga0"); + txpwr = (s8)wlapi_getintvar(shim, BRCMS_SROM_MAXP2GA0); pi->tx_srom_max_2g = txpwr; for (i = 0; i < PWRTBL_NUM_COEFF; i++) { @@ -4853,7 +4856,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) pi->txpa_2g_high_temp[i] = pi->txpa_2g[i]; } - cckpo = (u16)wlapi_getintvar(shim, "cck2gpo"); + cckpo = (u16)wlapi_getintvar(shim, BRCMS_SROM_CCK2GPO); + offset_ofdm = (u32)wlapi_getintvar(shim, BRCMS_SROM_OFDM2GPO); if (cckpo) { uint max_pwr_chan = txpwr; @@ -4863,7 +4867,6 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) cckpo >>= 4; } - offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo"); for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { pi->tx_srom_max_rate_2g[i] = max_pwr_chan - @@ -4873,22 +4876,22 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) } else { u8 opo = 0; - opo = (u8)wlapi_getintvar(shim, "opo"); + opo = (u8)wlapi_getintvar(shim, BRCMS_SROM_OPO); for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) pi->tx_srom_max_rate_2g[i] = txpwr; - offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo"); - for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { pi->tx_srom_max_rate_2g[i] = txpwr - ((offset_ofdm & 0xf) * 2); offset_ofdm >>= 4; } offset_mcs = - wlapi_getintvar(shim, "mcs2gpo1") << 16; + wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO1) << 16; offset_mcs |= - (u16) wlapi_getintvar(shim, "mcs2gpo0"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO0); pi_lcn->lcnphy_mcs20_po = offset_mcs; for (i = TXP_FIRST_SISO_MCS_20; i <= TXP_LAST_SISO_MCS_20; i++) { @@ -4899,25 +4902,24 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) } pi_lcn->lcnphy_rawtempsense = - (u16)wlapi_getintvar(shim, "rawtempsense"); + (u16)wlapi_getintvar(shim, BRCMS_SROM_RAWTEMPSENSE); pi_lcn->lcnphy_measPower = - (u8)wlapi_getintvar(shim, "measpower"); + (u8)wlapi_getintvar(shim, BRCMS_SROM_MEASPOWER); pi_lcn->lcnphy_tempsense_slope = - (u8)wlapi_getintvar(shim, "tempsense_slope"); + (u8)wlapi_getintvar(shim, BRCMS_SROM_TEMPSENSE_SLOPE); pi_lcn->lcnphy_hw_iqcal_en = - (bool)wlapi_getintvar(shim, "hw_iqcal_en"); + (bool)wlapi_getintvar(shim, BRCMS_SROM_HW_IQCAL_EN); pi_lcn->lcnphy_iqcal_swp_dis = - (bool)wlapi_getintvar(shim, "iqcal_swp_dis"); + (bool)wlapi_getintvar(shim, BRCMS_SROM_IQCAL_SWP_DIS); pi_lcn->lcnphy_tempcorrx = - (u8)wlapi_getintvar(shim, "tempcorrx"); + (u8)wlapi_getintvar(shim, BRCMS_SROM_TEMPCORRX); pi_lcn->lcnphy_tempsense_option = - (u8)wlapi_getintvar(shim, "tempsense_option"); + (u8)wlapi_getintvar(shim, BRCMS_SROM_TEMPSENSE_OPTION); pi_lcn->lcnphy_freqoffset_corr = - (u8)wlapi_getintvar(shim, "freqoffset_corr"); - if ((u8)wlapi_getintvar(shim, "aa2g") > 1) + (u8)wlapi_getintvar(shim, BRCMS_SROM_FREQOFFSET_CORR); + if ((u8)wlapi_getintvar(shim, BRCMS_SROM_AA2G) > 1) wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi, - (u8) wlapi_getintvar(shim, - "aa2g")); + (u8) wlapi_getintvar(shim, BRCMS_SROM_AA2G)); } pi_lcn->lcnphy_cck_dig_filt_type = -1; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c index a4417e9..cd19c2f 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c @@ -14388,25 +14388,25 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) if (pi->sh->sromrev >= 9) return; - bw40po = (u16) wlapi_getintvar(shim, "bw40po"); + bw40po = (u16) wlapi_getintvar(shim, BRCMS_SROM_BW40PO); pi->bw402gpo = bw40po & 0xf; pi->bw405gpo = (bw40po & 0xf0) >> 4; pi->bw405glpo = (bw40po & 0xf00) >> 8; pi->bw405ghpo = (bw40po & 0xf000) >> 12; - cddpo = (u16) wlapi_getintvar(shim, "cddpo"); + cddpo = (u16) wlapi_getintvar(shim, BRCMS_SROM_CDDPO); pi->cdd2gpo = cddpo & 0xf; pi->cdd5gpo = (cddpo & 0xf0) >> 4; pi->cdd5glpo = (cddpo & 0xf00) >> 8; pi->cdd5ghpo = (cddpo & 0xf000) >> 12; - stbcpo = (u16) wlapi_getintvar(shim, "stbcpo"); + stbcpo = (u16) wlapi_getintvar(shim, BRCMS_SROM_STBCPO); pi->stbc2gpo = stbcpo & 0xf; pi->stbc5gpo = (stbcpo & 0xf0) >> 4; pi->stbc5glpo = (stbcpo & 0xf00) >> 8; pi->stbc5ghpo = (stbcpo & 0xf000) >> 12; - bwduppo = (u16) wlapi_getintvar(shim, "bwduppo"); + bwduppo = (u16) wlapi_getintvar(shim, BRCMS_SROM_BWDUPPO); pi->bwdup2gpo = bwduppo & 0xf; pi->bwdup5gpo = (bwduppo & 0xf0) >> 4; pi->bwdup5glpo = (bwduppo & 0xf00) >> 8; @@ -14418,186 +14418,264 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) case 0: pi->nphy_txpid2g[PHY_CORE_0] = - (u8) wlapi_getintvar(shim, "txpid2ga0"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID2GA0); pi->nphy_txpid2g[PHY_CORE_1] = - (u8) wlapi_getintvar(shim, "txpid2ga1"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID2GA1); pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g = - (s8) wlapi_getintvar(shim, "maxp2ga0"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP2GA0); pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g = - (s8) wlapi_getintvar(shim, "maxp2ga1"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP2GA1); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 = - (s16) wlapi_getintvar(shim, "pa2gw0a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA2GW0A0); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 = - (s16) wlapi_getintvar(shim, "pa2gw0a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA2GW0A1); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 = - (s16) wlapi_getintvar(shim, "pa2gw1a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA2GW1A0); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 = - (s16) wlapi_getintvar(shim, "pa2gw1a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA2GW1A1); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 = - (s16) wlapi_getintvar(shim, "pa2gw2a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA2GW2A0); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 = - (s16) wlapi_getintvar(shim, "pa2gw2a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA2GW2A1); pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g = - (s8) wlapi_getintvar(shim, "itt2ga0"); + (s8) wlapi_getintvar(shim, BRCMS_SROM_ITT2GA0); pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g = - (s8) wlapi_getintvar(shim, "itt2ga1"); + (s8) wlapi_getintvar(shim, BRCMS_SROM_ITT2GA1); - pi->cck2gpo = (u16) wlapi_getintvar(shim, "cck2gpo"); + pi->cck2gpo = (u16) wlapi_getintvar(shim, + BRCMS_SROM_CCK2GPO); - pi->ofdm2gpo = (u32) wlapi_getintvar(shim, "ofdm2gpo"); + pi->ofdm2gpo = + (u32) wlapi_getintvar(shim, + BRCMS_SROM_OFDM2GPO); pi->mcs2gpo[0] = - (u16) wlapi_getintvar(shim, "mcs2gpo0"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO0); pi->mcs2gpo[1] = - (u16) wlapi_getintvar(shim, "mcs2gpo1"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO1); pi->mcs2gpo[2] = - (u16) wlapi_getintvar(shim, "mcs2gpo2"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO2); pi->mcs2gpo[3] = - (u16) wlapi_getintvar(shim, "mcs2gpo3"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO3); pi->mcs2gpo[4] = - (u16) wlapi_getintvar(shim, "mcs2gpo4"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO4); pi->mcs2gpo[5] = - (u16) wlapi_getintvar(shim, "mcs2gpo5"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO5); pi->mcs2gpo[6] = - (u16) wlapi_getintvar(shim, "mcs2gpo6"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO6); pi->mcs2gpo[7] = - (u16) wlapi_getintvar(shim, "mcs2gpo7"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS2GPO7); break; case 1: pi->nphy_txpid5g[PHY_CORE_0] = - (u8) wlapi_getintvar(shim, "txpid5ga0"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID5GA0); pi->nphy_txpid5g[PHY_CORE_1] = - (u8) wlapi_getintvar(shim, "txpid5ga1"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID5GA1); pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm = - (s8) wlapi_getintvar(shim, "maxp5ga0"); + (s8) wlapi_getintvar(shim, BRCMS_SROM_MAXP5GA0); pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm = - (s8) wlapi_getintvar(shim, "maxp5ga1"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP5GA1); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 = - (s16) wlapi_getintvar(shim, "pa5gw0a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GW0A0); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 = - (s16) wlapi_getintvar(shim, "pa5gw0a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GW0A1); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 = - (s16) wlapi_getintvar(shim, "pa5gw1a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GW1A0); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 = - (s16) wlapi_getintvar(shim, "pa5gw1a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GW1A1); pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 = - (s16) wlapi_getintvar(shim, "pa5gw2a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GW2A0); pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 = - (s16) wlapi_getintvar(shim, "pa5gw2a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GW2A1); pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm = - (s8) wlapi_getintvar(shim, "itt5ga0"); + (s8) wlapi_getintvar(shim, BRCMS_SROM_ITT5GA0); pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm = - (s8) wlapi_getintvar(shim, "itt5ga1"); + (s8) wlapi_getintvar(shim, BRCMS_SROM_ITT5GA1); - pi->ofdm5gpo = (u32) wlapi_getintvar(shim, "ofdm5gpo"); + pi->ofdm5gpo = + (u32) wlapi_getintvar(shim, + BRCMS_SROM_OFDM5GPO); pi->mcs5gpo[0] = - (u16) wlapi_getintvar(shim, "mcs5gpo0"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO0); pi->mcs5gpo[1] = - (u16) wlapi_getintvar(shim, "mcs5gpo1"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO1); pi->mcs5gpo[2] = - (u16) wlapi_getintvar(shim, "mcs5gpo2"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO2); pi->mcs5gpo[3] = - (u16) wlapi_getintvar(shim, "mcs5gpo3"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO3); pi->mcs5gpo[4] = - (u16) wlapi_getintvar(shim, "mcs5gpo4"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO4); pi->mcs5gpo[5] = - (u16) wlapi_getintvar(shim, "mcs5gpo5"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO5); pi->mcs5gpo[6] = - (u16) wlapi_getintvar(shim, "mcs5gpo6"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO6); pi->mcs5gpo[7] = - (u16) wlapi_getintvar(shim, "mcs5gpo7"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GPO7); break; case 2: pi->nphy_txpid5gl[0] = - (u8) wlapi_getintvar(shim, "txpid5gla0"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID5GLA0); pi->nphy_txpid5gl[1] = - (u8) wlapi_getintvar(shim, "txpid5gla1"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID5GLA1); pi->nphy_pwrctrl_info[0].max_pwr_5gl = - (s8) wlapi_getintvar(shim, "maxp5gla0"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP5GLA0); pi->nphy_pwrctrl_info[1].max_pwr_5gl = - (s8) wlapi_getintvar(shim, "maxp5gla1"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP5GLA1); pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 = - (s16) wlapi_getintvar(shim, "pa5glw0a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GLW0A0); pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 = - (s16) wlapi_getintvar(shim, "pa5glw0a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GLW0A1); pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 = - (s16) wlapi_getintvar(shim, "pa5glw1a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GLW1A0); pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 = - (s16) wlapi_getintvar(shim, "pa5glw1a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GLW1A1); pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 = - (s16) wlapi_getintvar(shim, "pa5glw2a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GLW2A0); pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 = - (s16) wlapi_getintvar(shim, "pa5glw2a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GLW2A1); pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0; pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0; pi->ofdm5glpo = - (u32) wlapi_getintvar(shim, "ofdm5glpo"); + (u32) wlapi_getintvar(shim, + BRCMS_SROM_OFDM5GLPO); pi->mcs5glpo[0] = - (u16) wlapi_getintvar(shim, "mcs5glpo0"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO0); pi->mcs5glpo[1] = - (u16) wlapi_getintvar(shim, "mcs5glpo1"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO1); pi->mcs5glpo[2] = - (u16) wlapi_getintvar(shim, "mcs5glpo2"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO2); pi->mcs5glpo[3] = - (u16) wlapi_getintvar(shim, "mcs5glpo3"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO3); pi->mcs5glpo[4] = - (u16) wlapi_getintvar(shim, "mcs5glpo4"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO4); pi->mcs5glpo[5] = - (u16) wlapi_getintvar(shim, "mcs5glpo5"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO5); pi->mcs5glpo[6] = - (u16) wlapi_getintvar(shim, "mcs5glpo6"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO6); pi->mcs5glpo[7] = - (u16) wlapi_getintvar(shim, "mcs5glpo7"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GLPO7); break; case 3: pi->nphy_txpid5gh[0] = - (u8) wlapi_getintvar(shim, "txpid5gha0"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID5GHA0); pi->nphy_txpid5gh[1] = - (u8) wlapi_getintvar(shim, "txpid5gha1"); + (u8) wlapi_getintvar(shim, + BRCMS_SROM_TXPID5GHA1); pi->nphy_pwrctrl_info[0].max_pwr_5gh = - (s8) wlapi_getintvar(shim, "maxp5gha0"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP5GHA0); pi->nphy_pwrctrl_info[1].max_pwr_5gh = - (s8) wlapi_getintvar(shim, "maxp5gha1"); + (s8) wlapi_getintvar(shim, + BRCMS_SROM_MAXP5GHA1); pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 = - (s16) wlapi_getintvar(shim, "pa5ghw0a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GHW0A0); pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 = - (s16) wlapi_getintvar(shim, "pa5ghw0a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GHW0A1); pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 = - (s16) wlapi_getintvar(shim, "pa5ghw1a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GHW1A0); pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 = - (s16) wlapi_getintvar(shim, "pa5ghw1a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GHW1A1); pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 = - (s16) wlapi_getintvar(shim, "pa5ghw2a0"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GHW2A0); pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 = - (s16) wlapi_getintvar(shim, "pa5ghw2a1"); + (s16) wlapi_getintvar(shim, + BRCMS_SROM_PA5GHW2A1); pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0; pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0; pi->ofdm5ghpo = - (u32) wlapi_getintvar(shim, "ofdm5ghpo"); + (u32) wlapi_getintvar(shim, + BRCMS_SROM_OFDM5GHPO); pi->mcs5ghpo[0] = - (u16) wlapi_getintvar(shim, "mcs5ghpo0"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO0); pi->mcs5ghpo[1] = - (u16) wlapi_getintvar(shim, "mcs5ghpo1"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO1); pi->mcs5ghpo[2] = - (u16) wlapi_getintvar(shim, "mcs5ghpo2"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO2); pi->mcs5ghpo[3] = - (u16) wlapi_getintvar(shim, "mcs5ghpo3"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO3); pi->mcs5ghpo[4] = - (u16) wlapi_getintvar(shim, "mcs5ghpo4"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO4); pi->mcs5ghpo[5] = - (u16) wlapi_getintvar(shim, "mcs5ghpo5"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO5); pi->mcs5ghpo[6] = - (u16) wlapi_getintvar(shim, "mcs5ghpo6"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO6); pi->mcs5ghpo[7] = - (u16) wlapi_getintvar(shim, "mcs5ghpo7"); + (u16) wlapi_getintvar(shim, + BRCMS_SROM_MCS5GHPO7); break; } } @@ -14609,35 +14687,43 @@ static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) { struct phy_shim_info *shim = pi->sh->physhim; - pi->antswitch = (u8) wlapi_getintvar(shim, "antswitch"); - pi->aa2g = (u8) wlapi_getintvar(shim, "aa2g"); - pi->aa5g = (u8) wlapi_getintvar(shim, "aa5g"); - - pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(shim, "tssipos2g"); - pi->srom_fem2g.extpagain = (u8) wlapi_getintvar(shim, "extpagain2g"); - pi->srom_fem2g.pdetrange = (u8) wlapi_getintvar(shim, "pdetrange2g"); - pi->srom_fem2g.triso = (u8) wlapi_getintvar(shim, "triso2g"); - pi->srom_fem2g.antswctrllut = (u8) wlapi_getintvar(shim, "antswctl2g"); - - pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(shim, "tssipos5g"); - pi->srom_fem5g.extpagain = (u8) wlapi_getintvar(shim, "extpagain5g"); - pi->srom_fem5g.pdetrange = (u8) wlapi_getintvar(shim, "pdetrange5g"); - pi->srom_fem5g.triso = (u8) wlapi_getintvar(shim, "triso5g"); - if (wlapi_getvar(shim, "antswctl5g")) + pi->antswitch = (u8) wlapi_getintvar(shim, BRCMS_SROM_ANTSWITCH); + pi->aa2g = (u8) wlapi_getintvar(shim, BRCMS_SROM_AA2G); + pi->aa5g = (u8) wlapi_getintvar(shim, BRCMS_SROM_AA5G); + + pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(shim, + BRCMS_SROM_TSSIPOS2G); + pi->srom_fem2g.extpagain = (u8) wlapi_getintvar(shim, + BRCMS_SROM_EXTPAGAIN2G); + pi->srom_fem2g.pdetrange = (u8) wlapi_getintvar(shim, + BRCMS_SROM_PDETRANGE2G); + pi->srom_fem2g.triso = (u8) wlapi_getintvar(shim, BRCMS_SROM_TRISO2G); + pi->srom_fem2g.antswctrllut = + (u8) wlapi_getintvar(shim, BRCMS_SROM_ANTSWCTL2G); + + pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(shim, + BRCMS_SROM_TSSIPOS5G); + pi->srom_fem5g.extpagain = (u8) wlapi_getintvar(shim, + BRCMS_SROM_EXTPAGAIN5G); + pi->srom_fem5g.pdetrange = (u8) wlapi_getintvar(shim, + BRCMS_SROM_PDETRANGE5G); + pi->srom_fem5g.triso = (u8) wlapi_getintvar(shim, BRCMS_SROM_TRISO5G); + if (wlapi_getvar(shim, BRCMS_SROM_ANTSWCTL5G)) pi->srom_fem5g.antswctrllut = - (u8) wlapi_getintvar(shim, "antswctl5g"); + (u8) wlapi_getintvar(shim, BRCMS_SROM_ANTSWCTL5G); else pi->srom_fem5g.antswctrllut = - (u8) wlapi_getintvar(shim, "antswctl2g"); + (u8) wlapi_getintvar(shim, BRCMS_SROM_ANTSWCTL2G); wlc_phy_txpower_ipa_upd(pi); pi->phy_txcore_disable_temp = - (s16) wlapi_getintvar(shim, "tempthresh"); + (s16) wlapi_getintvar(shim, BRCMS_SROM_TEMPTHRESH); if (pi->phy_txcore_disable_temp == 0) pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP; - pi->phy_tempsense_offset = (s8) wlapi_getintvar(shim, "tempoffset"); + pi->phy_tempsense_offset = (s8) wlapi_getintvar(shim, + BRCMS_SROM_TEMPOFFSET); if (pi->phy_tempsense_offset != 0) { if (pi->phy_tempsense_offset > (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET)) @@ -14653,7 +14739,7 @@ static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP; pi->phycal_tempdelta = - (u8) wlapi_getintvar(shim, "phycal_tempdelta"); + (u8) wlapi_getintvar(shim, BRCMS_SROM_PHYCAL_TEMPDELTA); if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA) pi->phycal_tempdelta = 0; diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c index 57122fc..676222e 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c +++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c @@ -216,11 +216,11 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf, brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel); } -char *wlapi_getvar(struct phy_shim_info *physhim, const char *name) +char *wlapi_getvar(struct phy_shim_info *physhim, enum brcms_srom_id id) { - return getvar(physhim->wlc_hw->sih, name); + return getvar(physhim->wlc_hw->sih, id); } -int wlapi_getintvar(struct phy_shim_info *physhim, const char *name) +int wlapi_getintvar(struct phy_shim_info *physhim, enum brcms_srom_id id) { - return getintvar(physhim->wlc_hw->sih, name); + return getintvar(physhim->wlc_hw->sih, id); } diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h index ca76153..8de549d 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h +++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h @@ -178,7 +178,8 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, u32 phy_mode); extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); -extern char *wlapi_getvar(struct phy_shim_info *physhim, const char *name); -extern int wlapi_getintvar(struct phy_shim_info *physhim, const char *name); +extern char *wlapi_getvar(struct phy_shim_info *physhim, enum brcms_srom_id id); +extern int wlapi_getintvar(struct phy_shim_info *physhim, + enum brcms_srom_id id); #endif /* _BRCM_PHY_SHIM_H_ */ diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h index d1639b4..8c9ac8f 100644 --- a/drivers/staging/brcm80211/brcmsmac/pub.h +++ b/drivers/staging/brcm80211/brcmsmac/pub.h @@ -21,6 +21,264 @@ #include "types.h" #include "defs.h" +enum brcms_srom_id { + BRCMS_SROM_NULL, + BRCMS_SROM_CONT, + BRCMS_SROM_AA2G, + BRCMS_SROM_AA5G, + BRCMS_SROM_AG0, + BRCMS_SROM_AG1, + BRCMS_SROM_AG2, + BRCMS_SROM_AG3, + BRCMS_SROM_ANTSWCTL2G, + BRCMS_SROM_ANTSWCTL5G, + BRCMS_SROM_ANTSWITCH, + BRCMS_SROM_BOARDFLAGS2, + BRCMS_SROM_BOARDFLAGS, + BRCMS_SROM_BOARDNUM, + BRCMS_SROM_BOARDREV, + BRCMS_SROM_BOARDTYPE, + BRCMS_SROM_BW40PO, + BRCMS_SROM_BWDUPPO, + BRCMS_SROM_BXA2G, + BRCMS_SROM_BXA5G, + BRCMS_SROM_CC, + BRCMS_SROM_CCK2GPO, + BRCMS_SROM_CCKBW202GPO, + BRCMS_SROM_CCKBW20UL2GPO, + BRCMS_SROM_CCODE, + BRCMS_SROM_CDDPO, + BRCMS_SROM_DEVID, + BRCMS_SROM_ET1MACADDR, + BRCMS_SROM_EXTPAGAIN2G, + BRCMS_SROM_EXTPAGAIN5G, + BRCMS_SROM_FREQOFFSET_CORR, + BRCMS_SROM_HW_IQCAL_EN, + BRCMS_SROM_IL0MACADDR, + BRCMS_SROM_IQCAL_SWP_DIS, + BRCMS_SROM_LEDBH0, + BRCMS_SROM_LEDBH1, + BRCMS_SROM_LEDBH2, + BRCMS_SROM_LEDBH3, + BRCMS_SROM_LEDDC, + BRCMS_SROM_LEGOFDM40DUPPO, + BRCMS_SROM_LEGOFDMBW202GPO, + BRCMS_SROM_LEGOFDMBW205GHPO, + BRCMS_SROM_LEGOFDMBW205GLPO, + BRCMS_SROM_LEGOFDMBW205GMPO, + BRCMS_SROM_LEGOFDMBW20UL2GPO, + BRCMS_SROM_LEGOFDMBW20UL5GHPO, + BRCMS_SROM_LEGOFDMBW20UL5GLPO, + BRCMS_SROM_LEGOFDMBW20UL5GMPO, + BRCMS_SROM_MACADDR, + BRCMS_SROM_MCS2GPO0, + BRCMS_SROM_MCS2GPO1, + BRCMS_SROM_MCS2GPO2, + BRCMS_SROM_MCS2GPO3, + BRCMS_SROM_MCS2GPO4, + BRCMS_SROM_MCS2GPO5, + BRCMS_SROM_MCS2GPO6, + BRCMS_SROM_MCS2GPO7, + BRCMS_SROM_MCS32PO, + BRCMS_SROM_MCS5GHPO0, + BRCMS_SROM_MCS5GHPO1, + BRCMS_SROM_MCS5GHPO2, + BRCMS_SROM_MCS5GHPO3, + BRCMS_SROM_MCS5GHPO4, + BRCMS_SROM_MCS5GHPO5, + BRCMS_SROM_MCS5GHPO6, + BRCMS_SROM_MCS5GHPO7, + BRCMS_SROM_MCS5GLPO0, + BRCMS_SROM_MCS5GLPO1, + BRCMS_SROM_MCS5GLPO2, + BRCMS_SROM_MCS5GLPO3, + BRCMS_SROM_MCS5GLPO4, + BRCMS_SROM_MCS5GLPO5, + BRCMS_SROM_MCS5GLPO6, + BRCMS_SROM_MCS5GLPO7, + BRCMS_SROM_MCS5GPO0, + BRCMS_SROM_MCS5GPO1, + BRCMS_SROM_MCS5GPO2, + BRCMS_SROM_MCS5GPO3, + BRCMS_SROM_MCS5GPO4, + BRCMS_SROM_MCS5GPO5, + BRCMS_SROM_MCS5GPO6, + BRCMS_SROM_MCS5GPO7, + BRCMS_SROM_MCSBW202GPO, + BRCMS_SROM_MCSBW205GHPO, + BRCMS_SROM_MCSBW205GLPO, + BRCMS_SROM_MCSBW205GMPO, + BRCMS_SROM_MCSBW20UL2GPO, + BRCMS_SROM_MCSBW20UL5GHPO, + BRCMS_SROM_MCSBW20UL5GLPO, + BRCMS_SROM_MCSBW20UL5GMPO, + BRCMS_SROM_MCSBW402GPO, + BRCMS_SROM_MCSBW405GHPO, + BRCMS_SROM_MCSBW405GLPO, + BRCMS_SROM_MCSBW405GMPO, + BRCMS_SROM_MEASPOWER, + BRCMS_SROM_OFDM2GPO, + BRCMS_SROM_OFDM5GHPO, + BRCMS_SROM_OFDM5GLPO, + BRCMS_SROM_OFDM5GPO, + BRCMS_SROM_OPO, + BRCMS_SROM_PA0B0, + BRCMS_SROM_PA0B1, + BRCMS_SROM_PA0B2, + BRCMS_SROM_PA0ITSSIT, + BRCMS_SROM_PA0MAXPWR, + BRCMS_SROM_PA1B0, + BRCMS_SROM_PA1B1, + BRCMS_SROM_PA1B2, + BRCMS_SROM_PA1HIB0, + BRCMS_SROM_PA1HIB1, + BRCMS_SROM_PA1HIB2, + BRCMS_SROM_PA1HIMAXPWR, + BRCMS_SROM_PA1ITSSIT, + BRCMS_SROM_PA1LOB0, + BRCMS_SROM_PA1LOB1, + BRCMS_SROM_PA1LOB2, + BRCMS_SROM_PA1LOMAXPWR, + BRCMS_SROM_PA1MAXPWR, + BRCMS_SROM_PDETRANGE2G, + BRCMS_SROM_PDETRANGE5G, + BRCMS_SROM_PHYCAL_TEMPDELTA, + BRCMS_SROM_RAWTEMPSENSE, + BRCMS_SROM_REGREV, + BRCMS_SROM_REV, + BRCMS_SROM_RSSISAV2G, + BRCMS_SROM_RSSISAV5G, + BRCMS_SROM_RSSISMC2G, + BRCMS_SROM_RSSISMC5G, + BRCMS_SROM_RSSISMF2G, + BRCMS_SROM_RSSISMF5G, + BRCMS_SROM_RXCHAIN, + BRCMS_SROM_RXPO2G, + BRCMS_SROM_RXPO5G, + BRCMS_SROM_STBCPO, + BRCMS_SROM_TEMPCORRX, + BRCMS_SROM_TEMPOFFSET, + BRCMS_SROM_TEMPSENSE_OPTION, + BRCMS_SROM_TEMPSENSE_SLOPE, + BRCMS_SROM_TEMPTHRESH, + BRCMS_SROM_TRI2G, + BRCMS_SROM_TRI5GH, + BRCMS_SROM_TRI5GL, + BRCMS_SROM_TRI5G, + BRCMS_SROM_TRISO2G, + BRCMS_SROM_TRISO5G, + BRCMS_SROM_TSSIPOS2G, + BRCMS_SROM_TSSIPOS5G, + BRCMS_SROM_TXCHAIN, + BRCMS_SROM_TXPID2GA0, + BRCMS_SROM_TXPID2GA1, + BRCMS_SROM_TXPID2GA2, + BRCMS_SROM_TXPID2GA3, + BRCMS_SROM_TXPID5GA0, + BRCMS_SROM_TXPID5GA1, + BRCMS_SROM_TXPID5GA2, + BRCMS_SROM_TXPID5GA3, + BRCMS_SROM_TXPID5GHA0, + BRCMS_SROM_TXPID5GHA1, + BRCMS_SROM_TXPID5GHA2, + BRCMS_SROM_TXPID5GHA3, + BRCMS_SROM_TXPID5GLA0, + BRCMS_SROM_TXPID5GLA1, + BRCMS_SROM_TXPID5GLA2, + BRCMS_SROM_TXPID5GLA3, + /* + * per-path identifiers (see srom.c) + */ + BRCMS_SROM_ITT2GA0, + BRCMS_SROM_ITT2GA1, + BRCMS_SROM_ITT2GA2, + BRCMS_SROM_ITT2GA3, + BRCMS_SROM_ITT5GA0, + BRCMS_SROM_ITT5GA1, + BRCMS_SROM_ITT5GA2, + BRCMS_SROM_ITT5GA3, + BRCMS_SROM_MAXP2GA0, + BRCMS_SROM_MAXP2GA1, + BRCMS_SROM_MAXP2GA2, + BRCMS_SROM_MAXP2GA3, + BRCMS_SROM_MAXP5GA0, + BRCMS_SROM_MAXP5GA1, + BRCMS_SROM_MAXP5GA2, + BRCMS_SROM_MAXP5GA3, + BRCMS_SROM_MAXP5GHA0, + BRCMS_SROM_MAXP5GHA1, + BRCMS_SROM_MAXP5GHA2, + BRCMS_SROM_MAXP5GHA3, + BRCMS_SROM_MAXP5GLA0, + BRCMS_SROM_MAXP5GLA1, + BRCMS_SROM_MAXP5GLA2, + BRCMS_SROM_MAXP5GLA3, + BRCMS_SROM_PA2GW0A0, + BRCMS_SROM_PA2GW0A1, + BRCMS_SROM_PA2GW0A2, + BRCMS_SROM_PA2GW0A3, + BRCMS_SROM_PA2GW1A0, + BRCMS_SROM_PA2GW1A1, + BRCMS_SROM_PA2GW1A2, + BRCMS_SROM_PA2GW1A3, + BRCMS_SROM_PA2GW2A0, + BRCMS_SROM_PA2GW2A1, + BRCMS_SROM_PA2GW2A2, + BRCMS_SROM_PA2GW2A3, + BRCMS_SROM_PA2GW3A0, + BRCMS_SROM_PA2GW3A1, + BRCMS_SROM_PA2GW3A2, + BRCMS_SROM_PA2GW3A3, + BRCMS_SROM_PA5GHW0A0, + BRCMS_SROM_PA5GHW0A1, + BRCMS_SROM_PA5GHW0A2, + BRCMS_SROM_PA5GHW0A3, + BRCMS_SROM_PA5GHW1A0, + BRCMS_SROM_PA5GHW1A1, + BRCMS_SROM_PA5GHW1A2, + BRCMS_SROM_PA5GHW1A3, + BRCMS_SROM_PA5GHW2A0, + BRCMS_SROM_PA5GHW2A1, + BRCMS_SROM_PA5GHW2A2, + BRCMS_SROM_PA5GHW2A3, + BRCMS_SROM_PA5GHW3A0, + BRCMS_SROM_PA5GHW3A1, + BRCMS_SROM_PA5GHW3A2, + BRCMS_SROM_PA5GHW3A3, + BRCMS_SROM_PA5GLW0A0, + BRCMS_SROM_PA5GLW0A1, + BRCMS_SROM_PA5GLW0A2, + BRCMS_SROM_PA5GLW0A3, + BRCMS_SROM_PA5GLW1A0, + BRCMS_SROM_PA5GLW1A1, + BRCMS_SROM_PA5GLW1A2, + BRCMS_SROM_PA5GLW1A3, + BRCMS_SROM_PA5GLW2A0, + BRCMS_SROM_PA5GLW2A1, + BRCMS_SROM_PA5GLW2A2, + BRCMS_SROM_PA5GLW2A3, + BRCMS_SROM_PA5GLW3A0, + BRCMS_SROM_PA5GLW3A1, + BRCMS_SROM_PA5GLW3A2, + BRCMS_SROM_PA5GLW3A3, + BRCMS_SROM_PA5GW0A0, + BRCMS_SROM_PA5GW0A1, + BRCMS_SROM_PA5GW0A2, + BRCMS_SROM_PA5GW0A3, + BRCMS_SROM_PA5GW1A0, + BRCMS_SROM_PA5GW1A1, + BRCMS_SROM_PA5GW1A2, + BRCMS_SROM_PA5GW1A3, + BRCMS_SROM_PA5GW2A0, + BRCMS_SROM_PA5GW2A1, + BRCMS_SROM_PA5GW2A2, + BRCMS_SROM_PA5GW2A3, + BRCMS_SROM_PA5GW3A0, + BRCMS_SROM_PA5GW3A1, + BRCMS_SROM_PA5GW3A2, + BRCMS_SROM_PA5GW3A3, +}; + #define BRCMS_NUMRATES 16 /* max # of rates in a rateset */ #define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */ @@ -356,8 +614,8 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, struct ieee80211_sta *sta, u16 tid); extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, u8 ba_wsize, uint max_rx_ampdu_bytes); -extern char *getvar(struct si_pub *sih, const char *name); -extern int getintvar(struct si_pub *sih, const char *name); +extern char *getvar(struct si_pub *sih, enum brcms_srom_id id); +extern int getintvar(struct si_pub *sih, enum brcms_srom_id id); /* wlc_phy.c helper functions */ extern void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc); diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index 524f1cc..c7a6e65 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -23,6 +23,7 @@ #include <chipcommon.h> #include <brcmu_utils.h> +#include "pub.h" #include "nicpci.h" #include "aiutils.h" #include "otp.h" @@ -1243,18 +1244,289 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, return -EINVAL; } +struct srom_id_name { + enum brcms_srom_id id; + const char *name; +}; + +static const struct srom_id_name srom_id_map[] = { + { BRCMS_SROM_AA2G, "aa2g" }, + { BRCMS_SROM_AA5G, "aa5g" }, + { BRCMS_SROM_AG0, "ag0" }, + { BRCMS_SROM_AG1, "ag1" }, + { BRCMS_SROM_AG2, "ag2" }, + { BRCMS_SROM_AG3, "ag3" }, + { BRCMS_SROM_ANTSWCTL2G, "antswctl2g" }, + { BRCMS_SROM_ANTSWCTL5G, "antswctl5g" }, + { BRCMS_SROM_ANTSWITCH, "antswitch" }, + { BRCMS_SROM_BOARDFLAGS2, "boardflags2" }, + { BRCMS_SROM_BOARDFLAGS, "boardflags" }, + { BRCMS_SROM_BOARDNUM, "boardnum" }, + { BRCMS_SROM_BOARDREV, "boardrev" }, + { BRCMS_SROM_BOARDTYPE, "boardtype" }, + { BRCMS_SROM_BW40PO, "bw40po" }, + { BRCMS_SROM_BWDUPPO, "bwduppo" }, + { BRCMS_SROM_BXA2G, "bxa2g" }, + { BRCMS_SROM_BXA5G, "bxa5g" }, + { BRCMS_SROM_CC, "cc" }, + { BRCMS_SROM_CCK2GPO, "cck2gpo" }, + { BRCMS_SROM_CCKBW202GPO, "cckbw202gpo" }, + { BRCMS_SROM_CCKBW20UL2GPO, "cckbw20ul2gpo" }, + { BRCMS_SROM_CCODE, "ccode" }, + { BRCMS_SROM_CDDPO, "cddpo" }, + { BRCMS_SROM_DEVID, "devid" }, + { BRCMS_SROM_ET1MACADDR, "et1macaddr" }, + { BRCMS_SROM_EXTPAGAIN2G, "extpagain2g" }, + { BRCMS_SROM_EXTPAGAIN5G, "extpagain5g" }, + { BRCMS_SROM_FREQOFFSET_CORR, "freqoffset_corr" }, + { BRCMS_SROM_HW_IQCAL_EN, "hw_iqcal_en" }, + { BRCMS_SROM_IL0MACADDR, "il0macaddr" }, + { BRCMS_SROM_IQCAL_SWP_DIS, "iqcal_swp_dis" }, + { BRCMS_SROM_LEDBH0, "ledbh0" }, + { BRCMS_SROM_LEDBH1, "ledbh1" }, + { BRCMS_SROM_LEDBH2, "ledbh2" }, + { BRCMS_SROM_LEDBH3, "ledbh3" }, + { BRCMS_SROM_LEDDC, "leddc" }, + { BRCMS_SROM_LEGOFDM40DUPPO, "legofdm40duppo" }, + { BRCMS_SROM_LEGOFDMBW202GPO, "legofdmbw202gpo" }, + { BRCMS_SROM_LEGOFDMBW205GHPO, "legofdmbw205ghpo" }, + { BRCMS_SROM_LEGOFDMBW205GLPO, "legofdmbw205glpo" }, + { BRCMS_SROM_LEGOFDMBW205GMPO, "legofdmbw205gmpo" }, + { BRCMS_SROM_LEGOFDMBW20UL2GPO, "legofdmbw20ul2gpo" }, + { BRCMS_SROM_LEGOFDMBW20UL5GHPO, "legofdmbw20ul5ghpo" }, + { BRCMS_SROM_LEGOFDMBW20UL5GLPO, "legofdmbw20ul5glpo" }, + { BRCMS_SROM_LEGOFDMBW20UL5GMPO, "legofdmbw20ul5gmpo" }, + { BRCMS_SROM_MACADDR, "macaddr" }, + { BRCMS_SROM_MCS2GPO0, "mcs2gpo0" }, + { BRCMS_SROM_MCS2GPO1, "mcs2gpo1" }, + { BRCMS_SROM_MCS2GPO2, "mcs2gpo2" }, + { BRCMS_SROM_MCS2GPO3, "mcs2gpo3" }, + { BRCMS_SROM_MCS2GPO4, "mcs2gpo4" }, + { BRCMS_SROM_MCS2GPO5, "mcs2gpo5" }, + { BRCMS_SROM_MCS2GPO6, "mcs2gpo6" }, + { BRCMS_SROM_MCS2GPO7, "mcs2gpo7" }, + { BRCMS_SROM_MCS32PO, "mcs32po" }, + { BRCMS_SROM_MCS5GHPO0, "mcs5ghpo0" }, + { BRCMS_SROM_MCS5GHPO1, "mcs5ghpo1" }, + { BRCMS_SROM_MCS5GHPO2, "mcs5ghpo2" }, + { BRCMS_SROM_MCS5GHPO3, "mcs5ghpo3" }, + { BRCMS_SROM_MCS5GHPO4, "mcs5ghpo4" }, + { BRCMS_SROM_MCS5GHPO5, "mcs5ghpo5" }, + { BRCMS_SROM_MCS5GHPO6, "mcs5ghpo6" }, + { BRCMS_SROM_MCS5GHPO7, "mcs5ghpo7" }, + { BRCMS_SROM_MCS5GLPO0, "mcs5glpo0" }, + { BRCMS_SROM_MCS5GLPO1, "mcs5glpo1" }, + { BRCMS_SROM_MCS5GLPO2, "mcs5glpo2" }, + { BRCMS_SROM_MCS5GLPO3, "mcs5glpo3" }, + { BRCMS_SROM_MCS5GLPO4, "mcs5glpo4" }, + { BRCMS_SROM_MCS5GLPO5, "mcs5glpo5" }, + { BRCMS_SROM_MCS5GLPO6, "mcs5glpo6" }, + { BRCMS_SROM_MCS5GLPO7, "mcs5glpo7" }, + { BRCMS_SROM_MCS5GPO0, "mcs5gpo0" }, + { BRCMS_SROM_MCS5GPO1, "mcs5gpo1" }, + { BRCMS_SROM_MCS5GPO2, "mcs5gpo2" }, + { BRCMS_SROM_MCS5GPO3, "mcs5gpo3" }, + { BRCMS_SROM_MCS5GPO4, "mcs5gpo4" }, + { BRCMS_SROM_MCS5GPO5, "mcs5gpo5" }, + { BRCMS_SROM_MCS5GPO6, "mcs5gpo6" }, + { BRCMS_SROM_MCS5GPO7, "mcs5gpo7" }, + { BRCMS_SROM_MCSBW202GPO, "mcsbw202gpo" }, + { BRCMS_SROM_MCSBW205GHPO, "mcsbw205ghpo" }, + { BRCMS_SROM_MCSBW205GLPO, "mcsbw205glpo" }, + { BRCMS_SROM_MCSBW205GMPO, "mcsbw205gmpo" }, + { BRCMS_SROM_MCSBW20UL2GPO, "mcsbw20ul2gpo" }, + { BRCMS_SROM_MCSBW20UL5GHPO, "mcsbw20ul5ghpo" }, + { BRCMS_SROM_MCSBW20UL5GLPO, "mcsbw20ul5glpo" }, + { BRCMS_SROM_MCSBW20UL5GMPO, "mcsbw20ul5gmpo" }, + { BRCMS_SROM_MCSBW402GPO, "mcsbw402gpo" }, + { BRCMS_SROM_MCSBW405GHPO, "mcsbw405ghpo" }, + { BRCMS_SROM_MCSBW405GLPO, "mcsbw405glpo" }, + { BRCMS_SROM_MCSBW405GMPO, "mcsbw405gmpo" }, + { BRCMS_SROM_MEASPOWER, "measpower" }, + { BRCMS_SROM_OFDM2GPO, "ofdm2gpo" }, + { BRCMS_SROM_OFDM5GHPO, "ofdm5ghpo" }, + { BRCMS_SROM_OFDM5GLPO, "ofdm5glpo" }, + { BRCMS_SROM_OFDM5GPO, "ofdm5gpo" }, + { BRCMS_SROM_OPO, "opo" }, + { BRCMS_SROM_PA0B0, "pa0b0" }, + { BRCMS_SROM_PA0B1, "pa0b1" }, + { BRCMS_SROM_PA0B2, "pa0b2" }, + { BRCMS_SROM_PA0ITSSIT, "pa0itssit" }, + { BRCMS_SROM_PA0MAXPWR, "pa0maxpwr" }, + { BRCMS_SROM_PA1B0, "pa1b0" }, + { BRCMS_SROM_PA1B1, "pa1b1" }, + { BRCMS_SROM_PA1B2, "pa1b2" }, + { BRCMS_SROM_PA1HIB0, "pa1hib0" }, + { BRCMS_SROM_PA1HIB1, "pa1hib1" }, + { BRCMS_SROM_PA1HIB2, "pa1hib2" }, + { BRCMS_SROM_PA1HIMAXPWR, "pa1himaxpwr" }, + { BRCMS_SROM_PA1ITSSIT, "pa1itssit" }, + { BRCMS_SROM_PA1LOB0, "pa1lob0" }, + { BRCMS_SROM_PA1LOB1, "pa1lob1" }, + { BRCMS_SROM_PA1LOB2, "pa1lob2" }, + { BRCMS_SROM_PA1LOMAXPWR, "pa1lomaxpwr" }, + { BRCMS_SROM_PA1MAXPWR, "pa1maxpwr" }, + { BRCMS_SROM_PDETRANGE2G, "pdetrange2g" }, + { BRCMS_SROM_PDETRANGE5G, "pdetrange5g" }, + { BRCMS_SROM_PHYCAL_TEMPDELTA, "phycal_tempdelta" }, + { BRCMS_SROM_RAWTEMPSENSE, "rawtempsense" }, + { BRCMS_SROM_REV, "sromrev" }, + { BRCMS_SROM_REGREV, "regrev" }, + { BRCMS_SROM_RSSISAV2G, "rssisav2g" }, + { BRCMS_SROM_RSSISAV5G, "rssisav5g" }, + { BRCMS_SROM_RSSISMC2G, "rssismc2g" }, + { BRCMS_SROM_RSSISMC5G, "rssismc5g" }, + { BRCMS_SROM_RSSISMF2G, "rssismf2g" }, + { BRCMS_SROM_RSSISMF5G, "rssismf5g" }, + { BRCMS_SROM_RXCHAIN, "rxchain" }, + { BRCMS_SROM_RXPO2G, "rxpo2g" }, + { BRCMS_SROM_RXPO5G, "rxpo5g" }, + { BRCMS_SROM_STBCPO, "stbcpo" }, + { BRCMS_SROM_TEMPCORRX, "tempcorrx" }, + { BRCMS_SROM_TEMPOFFSET, "tempoffset" }, + { BRCMS_SROM_TEMPSENSE_OPTION, "tempsense_option" }, + { BRCMS_SROM_TEMPSENSE_SLOPE, "tempsense_slope" }, + { BRCMS_SROM_TEMPTHRESH, "tempthresh" }, + { BRCMS_SROM_TRI2G, "tri2g" }, + { BRCMS_SROM_TRI5GH, "tri5gh" }, + { BRCMS_SROM_TRI5GL, "tri5gl" }, + { BRCMS_SROM_TRI5G, "tri5g" }, + { BRCMS_SROM_TRISO2G, "triso2g" }, + { BRCMS_SROM_TRISO5G, "triso5g" }, + { BRCMS_SROM_TSSIPOS2G, "tssipos2g" }, + { BRCMS_SROM_TSSIPOS5G, "tssipos5g" }, + { BRCMS_SROM_TXCHAIN, "txchain" }, + { BRCMS_SROM_TXPID2GA0, "txpid2ga0" }, + { BRCMS_SROM_TXPID2GA1, "txpid2ga1" }, + { BRCMS_SROM_TXPID2GA2, "txpid2ga2" }, + { BRCMS_SROM_TXPID2GA3, "txpid2ga3" }, + { BRCMS_SROM_TXPID5GA0, "txpid5ga0" }, + { BRCMS_SROM_TXPID5GA1, "txpid5ga1" }, + { BRCMS_SROM_TXPID5GA2, "txpid5ga2" }, + { BRCMS_SROM_TXPID5GA3, "txpid5ga3" }, + { BRCMS_SROM_TXPID5GHA0, "txpid5gha0" }, + { BRCMS_SROM_TXPID5GHA1, "txpid5gha1" }, + { BRCMS_SROM_TXPID5GHA2, "txpid5gha2" }, + { BRCMS_SROM_TXPID5GHA3, "txpid5gha3" }, + { BRCMS_SROM_TXPID5GLA0, "txpid5gla0" }, + { BRCMS_SROM_TXPID5GLA1, "txpid5gla1" }, + { BRCMS_SROM_TXPID5GLA2, "txpid5gla2" }, + { BRCMS_SROM_TXPID5GLA3, "txpid5gla3" }, + { BRCMS_SROM_ITT2GA0, "itt2ga0" }, + { BRCMS_SROM_ITT2GA1, "itt2ga1" }, + { BRCMS_SROM_ITT2GA2, "itt2ga2" }, + { BRCMS_SROM_ITT2GA3, "itt2ga3" }, + { BRCMS_SROM_ITT5GA0, "itt5ga0" }, + { BRCMS_SROM_ITT5GA1, "itt5ga1" }, + { BRCMS_SROM_ITT5GA2, "itt5ga2" }, + { BRCMS_SROM_ITT5GA3, "itt5ga3" }, + { BRCMS_SROM_MAXP2GA0, "maxp2ga0" }, + { BRCMS_SROM_MAXP2GA1, "maxp2ga1" }, + { BRCMS_SROM_MAXP2GA2, "maxp2ga2" }, + { BRCMS_SROM_MAXP2GA3, "maxp2ga3" }, + { BRCMS_SROM_MAXP5GA0, "maxp5ga0" }, + { BRCMS_SROM_MAXP5GA1, "maxp5ga1" }, + { BRCMS_SROM_MAXP5GA2, "maxp5ga2" }, + { BRCMS_SROM_MAXP5GA3, "maxp5ga3" }, + { BRCMS_SROM_MAXP5GHA0, "maxp5gha0" }, + { BRCMS_SROM_MAXP5GHA1, "maxp5gha1" }, + { BRCMS_SROM_MAXP5GHA2, "maxp5gha2" }, + { BRCMS_SROM_MAXP5GHA3, "maxp5gha3" }, + { BRCMS_SROM_MAXP5GLA0, "maxp5gla0" }, + { BRCMS_SROM_MAXP5GLA1, "maxp5gla1" }, + { BRCMS_SROM_MAXP5GLA2, "maxp5gla2" }, + { BRCMS_SROM_MAXP5GLA3, "maxp5gla3" }, + { BRCMS_SROM_PA2GW0A0, "pa2gw0a0" }, + { BRCMS_SROM_PA2GW0A1, "pa2gw0a1" }, + { BRCMS_SROM_PA2GW0A2, "pa2gw0a2" }, + { BRCMS_SROM_PA2GW0A3, "pa2gw0a3" }, + { BRCMS_SROM_PA2GW1A0, "pa2gw1a0" }, + { BRCMS_SROM_PA2GW1A1, "pa2gw1a1" }, + { BRCMS_SROM_PA2GW1A2, "pa2gw1a2" }, + { BRCMS_SROM_PA2GW1A3, "pa2gw1a3" }, + { BRCMS_SROM_PA2GW2A0, "pa2gw2a0" }, + { BRCMS_SROM_PA2GW2A1, "pa2gw2a1" }, + { BRCMS_SROM_PA2GW2A2, "pa2gw2a2" }, + { BRCMS_SROM_PA2GW2A3, "pa2gw2a3" }, + { BRCMS_SROM_PA2GW3A0, "pa2gw3a0" }, + { BRCMS_SROM_PA2GW3A1, "pa2gw3a1" }, + { BRCMS_SROM_PA2GW3A2, "pa2gw3a2" }, + { BRCMS_SROM_PA2GW3A3, "pa2gw3a3" }, + { BRCMS_SROM_PA5GHW0A0, "pa5ghw0a0" }, + { BRCMS_SROM_PA5GHW0A1, "pa5ghw0a1" }, + { BRCMS_SROM_PA5GHW0A2, "pa5ghw0a2" }, + { BRCMS_SROM_PA5GHW0A3, "pa5ghw0a3" }, + { BRCMS_SROM_PA5GHW1A0, "pa5ghw1a0" }, + { BRCMS_SROM_PA5GHW1A1, "pa5ghw1a1" }, + { BRCMS_SROM_PA5GHW1A2, "pa5ghw1a2" }, + { BRCMS_SROM_PA5GHW1A3, "pa5ghw1a3" }, + { BRCMS_SROM_PA5GHW2A0, "pa5ghw2a0" }, + { BRCMS_SROM_PA5GHW2A1, "pa5ghw2a1" }, + { BRCMS_SROM_PA5GHW2A2, "pa5ghw2a2" }, + { BRCMS_SROM_PA5GHW2A3, "pa5ghw2a3" }, + { BRCMS_SROM_PA5GHW3A0, "pa5ghw3a0" }, + { BRCMS_SROM_PA5GHW3A1, "pa5ghw3a1" }, + { BRCMS_SROM_PA5GHW3A2, "pa5ghw3a2" }, + { BRCMS_SROM_PA5GHW3A3, "pa5ghw3a3" }, + { BRCMS_SROM_PA5GLW0A0, "pa5glw0a0" }, + { BRCMS_SROM_PA5GLW0A1, "pa5glw0a1" }, + { BRCMS_SROM_PA5GLW0A2, "pa5glw0a2" }, + { BRCMS_SROM_PA5GLW0A3, "pa5glw0a3" }, + { BRCMS_SROM_PA5GLW1A0, "pa5glw1a0" }, + { BRCMS_SROM_PA5GLW1A1, "pa5glw1a1" }, + { BRCMS_SROM_PA5GLW1A2, "pa5glw1a2" }, + { BRCMS_SROM_PA5GLW1A3, "pa5glw1a3" }, + { BRCMS_SROM_PA5GLW2A0, "pa5glw2a0" }, + { BRCMS_SROM_PA5GLW2A1, "pa5glw2a1" }, + { BRCMS_SROM_PA5GLW2A2, "pa5glw2a2" }, + { BRCMS_SROM_PA5GLW2A3, "pa5glw2a3" }, + { BRCMS_SROM_PA5GLW3A0, "pa5glw3a0" }, + { BRCMS_SROM_PA5GLW3A1, "pa5glw3a1" }, + { BRCMS_SROM_PA5GLW3A2, "pa5glw3a2" }, + { BRCMS_SROM_PA5GLW3A3, "pa5glw3a3" }, + { BRCMS_SROM_PA5GW0A0, "pa5gw0a0" }, + { BRCMS_SROM_PA5GW0A1, "pa5gw0a1" }, + { BRCMS_SROM_PA5GW0A2, "pa5gw0a2" }, + { BRCMS_SROM_PA5GW0A3, "pa5gw0a3" }, + { BRCMS_SROM_PA5GW1A0, "pa5gw1a0" }, + { BRCMS_SROM_PA5GW1A1, "pa5gw1a1" }, + { BRCMS_SROM_PA5GW1A2, "pa5gw1a2" }, + { BRCMS_SROM_PA5GW1A3, "pa5gw1a3" }, + { BRCMS_SROM_PA5GW2A0, "pa5gw2a0" }, + { BRCMS_SROM_PA5GW2A1, "pa5gw2a1" }, + { BRCMS_SROM_PA5GW2A2, "pa5gw2a2" }, + { BRCMS_SROM_PA5GW2A3, "pa5gw2a3" }, + { BRCMS_SROM_PA5GW3A0, "pa5gw3a0" }, + { BRCMS_SROM_PA5GW3A1, "pa5gw3a1" }, + { BRCMS_SROM_PA5GW3A2, "pa5gw3a2" }, + { BRCMS_SROM_PA5GW3A3, "pa5gw3a3" }, +}; + +static const char *get_varname(enum brcms_srom_id id) +{ + const struct srom_id_name *entry; + int i; + + entry = &srom_id_map[0]; + for (i = 0; i < ARRAY_SIZE(srom_id_map); i++) { + if (entry->id == id) + return entry->name; + entry++; + } + return NULL; +} + /* * Search the name=value vars for a specific one and return its value. * Returns NULL if not found. */ -char *getvar(struct si_pub *sih, const char *name) +char *getvar(struct si_pub *sih, enum brcms_srom_id id) { + const char *name = get_varname(id); char *s; int len; struct si_info *sii; - sii = (struct si_info *)sih; - if (!name) return NULL; @@ -1262,6 +1534,8 @@ char *getvar(struct si_pub *sih, const char *name) if (len == 0) return NULL; + sii = (struct si_info *)sih; + /* first look in vars[] */ for (s = sii->vars; s && *s;) { if ((memcmp(s, name, len) == 0) && (s[len] == '=')) @@ -1278,12 +1552,12 @@ char *getvar(struct si_pub *sih, const char *name) * Search the vars for a specific one and return its value as * an integer. Returns 0 if not found. */ -int getintvar(struct si_pub *sih, const char *name) +int getintvar(struct si_pub *sih, enum brcms_srom_id id) { char *val; unsigned long res; - val = getvar(sih, name); + val = getvar(sih, id); if (val && !kstrtoul(val, 0, &res)) return res; diff --git a/drivers/staging/brcm80211/brcmsmac/stf.c b/drivers/staging/brcm80211/brcmsmac/stf.c index 3ce9049..f1bd1bf 100644 --- a/drivers/staging/brcm80211/brcmsmac/stf.c +++ b/drivers/staging/brcm80211/brcmsmac/stf.c @@ -373,8 +373,8 @@ void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc) { /* get available rx/tx chains */ - wlc->stf->hw_txchain = (u8) getintvar(wlc->hw->sih, "txchain"); - wlc->stf->hw_rxchain = (u8) getintvar(wlc->hw->sih, "rxchain"); + wlc->stf->hw_txchain = (u8) getintvar(wlc->hw->sih, BRCMS_SROM_TXCHAIN); + wlc->stf->hw_rxchain = (u8) getintvar(wlc->hw->sih, BRCMS_SROM_RXCHAIN); /* these parameter are intended to be used for all PHY types */ if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/15] staging: brcm80211: use enum identifiers in srom variable tables 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (8 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 09/15] staging: brcm80211: use identifiers instead of string for srom lookup Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 11/15] staging: brcm80211: replace string based variable storage by linked list Arend van Spriel ` (6 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel In the srom variable tables fields were identified using string identifiers. This has been replaced by enumeration identifiers. Reported-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/srom.c | 1735 +++++++++++++++-------------- 1 files changed, 896 insertions(+), 839 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index c7a6e65..f014044 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -365,7 +365,7 @@ #define MAXSZ_NVRAM_VARS 4096 struct brcms_sromvar { - const char *name; + enum brcms_srom_id varid; u32 revmask; u32 flags; u16 off; @@ -392,862 +392,452 @@ struct brcms_varbuf { * Other entries must have non-NULL name. */ static const struct brcms_sromvar pci_sromvars[] = { - {"devid", 0xffffff00, SRFL_PRHEX | SRFL_NOVAR, PCI_F0DEVID, 0xffff}, - {"boardrev", 0x0000000e, SRFL_PRHEX, SROM_AABREV, SROM_BR_MASK}, - {"boardrev", 0x000000f0, SRFL_PRHEX, SROM4_BREV, 0xffff}, - {"boardrev", 0xffffff00, SRFL_PRHEX, SROM8_BREV, 0xffff}, - {"boardflags", 0x00000002, SRFL_PRHEX, SROM_BFL, 0xffff}, - {"boardflags", 0x00000004, SRFL_PRHEX | SRFL_MORE, SROM_BFL, 0xffff}, - {"", 0, 0, SROM_BFL2, 0xffff}, - {"boardflags", 0x00000008, SRFL_PRHEX | SRFL_MORE, SROM_BFL, 0xffff}, - {"", 0, 0, SROM3_BFL2, 0xffff}, - {"boardflags", 0x00000010, SRFL_PRHEX | SRFL_MORE, SROM4_BFL0, 0xffff}, - {"", 0, 0, SROM4_BFL1, 0xffff}, - {"boardflags", 0x000000e0, SRFL_PRHEX | SRFL_MORE, SROM5_BFL0, 0xffff}, - {"", 0, 0, SROM5_BFL1, 0xffff}, - {"boardflags", 0xffffff00, SRFL_PRHEX | SRFL_MORE, SROM8_BFL0, 0xffff}, - {"", 0, 0, SROM8_BFL1, 0xffff}, - {"boardflags2", 0x00000010, SRFL_PRHEX | SRFL_MORE, SROM4_BFL2, 0xffff}, - {"", 0, 0, SROM4_BFL3, 0xffff}, - {"boardflags2", 0x000000e0, SRFL_PRHEX | SRFL_MORE, SROM5_BFL2, 0xffff}, - {"", 0, 0, SROM5_BFL3, 0xffff}, - {"boardflags2", 0xffffff00, SRFL_PRHEX | SRFL_MORE, SROM8_BFL2, 0xffff}, - {"", 0, 0, SROM8_BFL3, 0xffff}, - {"boardtype", 0xfffffffc, SRFL_PRHEX, SROM_SSID, 0xffff}, - {"boardnum", 0x00000006, 0, SROM_MACLO_IL0, 0xffff}, - {"boardnum", 0x00000008, 0, SROM3_MACLO, 0xffff}, - {"boardnum", 0x00000010, 0, SROM4_MACLO, 0xffff}, - {"boardnum", 0x000000e0, 0, SROM5_MACLO, 0xffff}, - {"boardnum", 0xffffff00, 0, SROM8_MACLO, 0xffff}, - {"cc", 0x00000002, 0, SROM_AABREV, SROM_CC_MASK}, - {"regrev", 0x00000008, 0, SROM_OPO, 0xff00}, - {"regrev", 0x00000010, 0, SROM4_REGREV, 0x00ff}, - {"regrev", 0x000000e0, 0, SROM5_REGREV, 0x00ff}, - {"regrev", 0xffffff00, 0, SROM8_REGREV, 0x00ff}, - {"ledbh0", 0x0000000e, SRFL_NOFFS, SROM_LEDBH10, 0x00ff}, - {"ledbh1", 0x0000000e, SRFL_NOFFS, SROM_LEDBH10, 0xff00}, - {"ledbh2", 0x0000000e, SRFL_NOFFS, SROM_LEDBH32, 0x00ff}, - {"ledbh3", 0x0000000e, SRFL_NOFFS, SROM_LEDBH32, 0xff00}, - {"ledbh0", 0x00000010, SRFL_NOFFS, SROM4_LEDBH10, 0x00ff}, - {"ledbh1", 0x00000010, SRFL_NOFFS, SROM4_LEDBH10, 0xff00}, - {"ledbh2", 0x00000010, SRFL_NOFFS, SROM4_LEDBH32, 0x00ff}, - {"ledbh3", 0x00000010, SRFL_NOFFS, SROM4_LEDBH32, 0xff00}, - {"ledbh0", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH10, 0x00ff}, - {"ledbh1", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH10, 0xff00}, - {"ledbh2", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH32, 0x00ff}, - {"ledbh3", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH32, 0xff00}, - {"ledbh0", 0xffffff00, SRFL_NOFFS, SROM8_LEDBH10, 0x00ff}, - {"ledbh1", 0xffffff00, SRFL_NOFFS, SROM8_LEDBH10, 0xff00}, - {"ledbh2", 0xffffff00, SRFL_NOFFS, SROM8_LEDBH32, 0x00ff}, - {"ledbh3", 0xffffff00, SRFL_NOFFS, SROM8_LEDBH32, 0xff00}, - {"pa0b0", 0x0000000e, SRFL_PRHEX, SROM_WL0PAB0, 0xffff}, - {"pa0b1", 0x0000000e, SRFL_PRHEX, SROM_WL0PAB1, 0xffff}, - {"pa0b2", 0x0000000e, SRFL_PRHEX, SROM_WL0PAB2, 0xffff}, - {"pa0itssit", 0x0000000e, 0, SROM_ITT, 0x00ff}, - {"pa0maxpwr", 0x0000000e, 0, SROM_WL10MAXP, 0x00ff}, - {"pa0b0", 0xffffff00, SRFL_PRHEX, SROM8_W0_PAB0, 0xffff}, - {"pa0b1", 0xffffff00, SRFL_PRHEX, SROM8_W0_PAB1, 0xffff}, - {"pa0b2", 0xffffff00, SRFL_PRHEX, SROM8_W0_PAB2, 0xffff}, - {"pa0itssit", 0xffffff00, 0, SROM8_W0_ITTMAXP, 0xff00}, - {"pa0maxpwr", 0xffffff00, 0, SROM8_W0_ITTMAXP, 0x00ff}, - {"opo", 0x0000000c, 0, SROM_OPO, 0x00ff}, - {"opo", 0xffffff00, 0, SROM8_2G_OFDMPO, 0x00ff}, - {"aa2g", 0x0000000e, 0, SROM_AABREV, SROM_AA0_MASK}, - {"aa2g", 0x000000f0, 0, SROM4_AA, 0x00ff}, - {"aa2g", 0xffffff00, 0, SROM8_AA, 0x00ff}, - {"aa5g", 0x0000000e, 0, SROM_AABREV, SROM_AA1_MASK}, - {"aa5g", 0x000000f0, 0, SROM4_AA, 0xff00}, - {"aa5g", 0xffffff00, 0, SROM8_AA, 0xff00}, - {"ag0", 0x0000000e, 0, SROM_AG10, 0x00ff}, - {"ag1", 0x0000000e, 0, SROM_AG10, 0xff00}, - {"ag0", 0x000000f0, 0, SROM4_AG10, 0x00ff}, - {"ag1", 0x000000f0, 0, SROM4_AG10, 0xff00}, - {"ag2", 0x000000f0, 0, SROM4_AG32, 0x00ff}, - {"ag3", 0x000000f0, 0, SROM4_AG32, 0xff00}, - {"ag0", 0xffffff00, 0, SROM8_AG10, 0x00ff}, - {"ag1", 0xffffff00, 0, SROM8_AG10, 0xff00}, - {"ag2", 0xffffff00, 0, SROM8_AG32, 0x00ff}, - {"ag3", 0xffffff00, 0, SROM8_AG32, 0xff00}, - {"pa1b0", 0x0000000e, SRFL_PRHEX, SROM_WL1PAB0, 0xffff}, - {"pa1b1", 0x0000000e, SRFL_PRHEX, SROM_WL1PAB1, 0xffff}, - {"pa1b2", 0x0000000e, SRFL_PRHEX, SROM_WL1PAB2, 0xffff}, - {"pa1lob0", 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB0, 0xffff}, - {"pa1lob1", 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB1, 0xffff}, - {"pa1lob2", 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB2, 0xffff}, - {"pa1hib0", 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB0, 0xffff}, - {"pa1hib1", 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB1, 0xffff}, - {"pa1hib2", 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB2, 0xffff}, - {"pa1itssit", 0x0000000e, 0, SROM_ITT, 0xff00}, - {"pa1maxpwr", 0x0000000e, 0, SROM_WL10MAXP, 0xff00}, - {"pa1lomaxpwr", 0x0000000c, 0, SROM_WL1LHMAXP, 0xff00}, - {"pa1himaxpwr", 0x0000000c, 0, SROM_WL1LHMAXP, 0x00ff}, - {"pa1b0", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB0, 0xffff}, - {"pa1b1", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB1, 0xffff}, - {"pa1b2", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB2, 0xffff}, - {"pa1lob0", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB0_LC, 0xffff}, - {"pa1lob1", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB1_LC, 0xffff}, - {"pa1lob2", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB2_LC, 0xffff}, - {"pa1hib0", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB0_HC, 0xffff}, - {"pa1hib1", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB1_HC, 0xffff}, - {"pa1hib2", 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB2_HC, 0xffff}, - {"pa1itssit", 0xffffff00, 0, SROM8_W1_ITTMAXP, 0xff00}, - {"pa1maxpwr", 0xffffff00, 0, SROM8_W1_ITTMAXP, 0x00ff}, - {"pa1lomaxpwr", 0xffffff00, 0, SROM8_W1_MAXP_LCHC, 0xff00}, - {"pa1himaxpwr", 0xffffff00, 0, SROM8_W1_MAXP_LCHC, 0x00ff}, - {"bxa2g", 0x00000008, 0, SROM_BXARSSI2G, 0x1800}, - {"rssisav2g", 0x00000008, 0, SROM_BXARSSI2G, 0x0700}, - {"rssismc2g", 0x00000008, 0, SROM_BXARSSI2G, 0x00f0}, - {"rssismf2g", 0x00000008, 0, SROM_BXARSSI2G, 0x000f}, - {"bxa2g", 0xffffff00, 0, SROM8_BXARSSI2G, 0x1800}, - {"rssisav2g", 0xffffff00, 0, SROM8_BXARSSI2G, 0x0700}, - {"rssismc2g", 0xffffff00, 0, SROM8_BXARSSI2G, 0x00f0}, - {"rssismf2g", 0xffffff00, 0, SROM8_BXARSSI2G, 0x000f}, - {"bxa5g", 0x00000008, 0, SROM_BXARSSI5G, 0x1800}, - {"rssisav5g", 0x00000008, 0, SROM_BXARSSI5G, 0x0700}, - {"rssismc5g", 0x00000008, 0, SROM_BXARSSI5G, 0x00f0}, - {"rssismf5g", 0x00000008, 0, SROM_BXARSSI5G, 0x000f}, - {"bxa5g", 0xffffff00, 0, SROM8_BXARSSI5G, 0x1800}, - {"rssisav5g", 0xffffff00, 0, SROM8_BXARSSI5G, 0x0700}, - {"rssismc5g", 0xffffff00, 0, SROM8_BXARSSI5G, 0x00f0}, - {"rssismf5g", 0xffffff00, 0, SROM8_BXARSSI5G, 0x000f}, - {"tri2g", 0x00000008, 0, SROM_TRI52G, 0x00ff}, - {"tri5g", 0x00000008, 0, SROM_TRI52G, 0xff00}, - {"tri5gl", 0x00000008, 0, SROM_TRI5GHL, 0x00ff}, - {"tri5gh", 0x00000008, 0, SROM_TRI5GHL, 0xff00}, - {"tri2g", 0xffffff00, 0, SROM8_TRI52G, 0x00ff}, - {"tri5g", 0xffffff00, 0, SROM8_TRI52G, 0xff00}, - {"tri5gl", 0xffffff00, 0, SROM8_TRI5GHL, 0x00ff}, - {"tri5gh", 0xffffff00, 0, SROM8_TRI5GHL, 0xff00}, - {"rxpo2g", 0x00000008, SRFL_PRSIGN, SROM_RXPO52G, 0x00ff}, - {"rxpo5g", 0x00000008, SRFL_PRSIGN, SROM_RXPO52G, 0xff00}, - {"rxpo2g", 0xffffff00, SRFL_PRSIGN, SROM8_RXPO52G, 0x00ff}, - {"rxpo5g", 0xffffff00, SRFL_PRSIGN, SROM8_RXPO52G, 0xff00}, - {"txchain", 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, SROM4_TXCHAIN_MASK}, - {"rxchain", 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, SROM4_RXCHAIN_MASK}, - {"antswitch", 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, SROM4_SWITCH_MASK}, - {"txchain", 0xffffff00, SRFL_NOFFS, SROM8_TXRXC, SROM4_TXCHAIN_MASK}, - {"rxchain", 0xffffff00, SRFL_NOFFS, SROM8_TXRXC, SROM4_RXCHAIN_MASK}, - {"antswitch", 0xffffff00, SRFL_NOFFS, SROM8_TXRXC, SROM4_SWITCH_MASK}, - {"tssipos2g", 0xffffff00, 0, SROM8_FEM2G, SROM8_FEM_TSSIPOS_MASK}, - {"extpagain2g", 0xffffff00, 0, SROM8_FEM2G, SROM8_FEM_EXTPA_GAIN_MASK}, - {"pdetrange2g", 0xffffff00, 0, SROM8_FEM2G, SROM8_FEM_PDET_RANGE_MASK}, - {"triso2g", 0xffffff00, 0, SROM8_FEM2G, SROM8_FEM_TR_ISO_MASK}, - {"antswctl2g", 0xffffff00, 0, SROM8_FEM2G, SROM8_FEM_ANTSWLUT_MASK}, - {"tssipos5g", 0xffffff00, 0, SROM8_FEM5G, SROM8_FEM_TSSIPOS_MASK}, - {"extpagain5g", 0xffffff00, 0, SROM8_FEM5G, SROM8_FEM_EXTPA_GAIN_MASK}, - {"pdetrange5g", 0xffffff00, 0, SROM8_FEM5G, SROM8_FEM_PDET_RANGE_MASK}, - {"triso5g", 0xffffff00, 0, SROM8_FEM5G, SROM8_FEM_TR_ISO_MASK}, - {"antswctl5g", 0xffffff00, 0, SROM8_FEM5G, SROM8_FEM_ANTSWLUT_MASK}, - {"tempthresh", 0xffffff00, 0, SROM8_THERMAL, 0xff00}, - {"tempoffset", 0xffffff00, 0, SROM8_THERMAL, 0x00ff}, - {"txpid2ga0", 0x000000f0, 0, SROM4_TXPID2G, 0x00ff}, - {"txpid2ga1", 0x000000f0, 0, SROM4_TXPID2G, 0xff00}, - {"txpid2ga2", 0x000000f0, 0, SROM4_TXPID2G + 1, 0x00ff}, - {"txpid2ga3", 0x000000f0, 0, SROM4_TXPID2G + 1, 0xff00}, - {"txpid5ga0", 0x000000f0, 0, SROM4_TXPID5G, 0x00ff}, - {"txpid5ga1", 0x000000f0, 0, SROM4_TXPID5G, 0xff00}, - {"txpid5ga2", 0x000000f0, 0, SROM4_TXPID5G + 1, 0x00ff}, - {"txpid5ga3", 0x000000f0, 0, SROM4_TXPID5G + 1, 0xff00}, - {"txpid5gla0", 0x000000f0, 0, SROM4_TXPID5GL, 0x00ff}, - {"txpid5gla1", 0x000000f0, 0, SROM4_TXPID5GL, 0xff00}, - {"txpid5gla2", 0x000000f0, 0, SROM4_TXPID5GL + 1, 0x00ff}, - {"txpid5gla3", 0x000000f0, 0, SROM4_TXPID5GL + 1, 0xff00}, - {"txpid5gha0", 0x000000f0, 0, SROM4_TXPID5GH, 0x00ff}, - {"txpid5gha1", 0x000000f0, 0, SROM4_TXPID5GH, 0xff00}, - {"txpid5gha2", 0x000000f0, 0, SROM4_TXPID5GH + 1, 0x00ff}, - {"txpid5gha3", 0x000000f0, 0, SROM4_TXPID5GH + 1, 0xff00}, - - {"ccode", 0x0000000f, SRFL_CCODE, SROM_CCODE, 0xffff}, - {"ccode", 0x00000010, SRFL_CCODE, SROM4_CCODE, 0xffff}, - {"ccode", 0x000000e0, SRFL_CCODE, SROM5_CCODE, 0xffff}, - {"ccode", 0xffffff00, SRFL_CCODE, SROM8_CCODE, 0xffff}, - {"macaddr", 0xffffff00, SRFL_ETHADDR, SROM8_MACHI, 0xffff}, - {"macaddr", 0x000000e0, SRFL_ETHADDR, SROM5_MACHI, 0xffff}, - {"macaddr", 0x00000010, SRFL_ETHADDR, SROM4_MACHI, 0xffff}, - {"macaddr", 0x00000008, SRFL_ETHADDR, SROM3_MACHI, 0xffff}, - {"il0macaddr", 0x00000007, SRFL_ETHADDR, SROM_MACHI_IL0, 0xffff}, - {"et1macaddr", 0x00000007, SRFL_ETHADDR, SROM_MACHI_ET1, 0xffff}, - {"leddc", 0xffffff00, SRFL_NOFFS | SRFL_LEDDC, SROM8_LEDDC, 0xffff}, - {"leddc", 0x000000e0, SRFL_NOFFS | SRFL_LEDDC, SROM5_LEDDC, 0xffff}, - {"leddc", 0x00000010, SRFL_NOFFS | SRFL_LEDDC, SROM4_LEDDC, 0xffff}, - {"leddc", 0x00000008, SRFL_NOFFS | SRFL_LEDDC, SROM3_LEDDC, 0xffff}, - {"rawtempsense", 0xffffff00, SRFL_PRHEX, SROM8_MPWR_RAWTS, 0x01ff}, - {"measpower", 0xffffff00, SRFL_PRHEX, SROM8_MPWR_RAWTS, 0xfe00}, - {"tempsense_slope", 0xffffff00, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, + {BRCMS_SROM_DEVID, 0xffffff00, SRFL_PRHEX | SRFL_NOVAR, PCI_F0DEVID, + 0xffff}, + {BRCMS_SROM_BOARDREV, 0x0000000e, SRFL_PRHEX, SROM_AABREV, + SROM_BR_MASK}, + {BRCMS_SROM_BOARDREV, 0x000000f0, SRFL_PRHEX, SROM4_BREV, 0xffff}, + {BRCMS_SROM_BOARDREV, 0xffffff00, SRFL_PRHEX, SROM8_BREV, 0xffff}, + {BRCMS_SROM_BOARDFLAGS, 0x00000002, SRFL_PRHEX, SROM_BFL, 0xffff}, + {BRCMS_SROM_BOARDFLAGS, 0x00000004, SRFL_PRHEX | SRFL_MORE, SROM_BFL, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM_BFL2, 0xffff}, + {BRCMS_SROM_BOARDFLAGS, 0x00000008, SRFL_PRHEX | SRFL_MORE, SROM_BFL, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM3_BFL2, 0xffff}, + {BRCMS_SROM_BOARDFLAGS, 0x00000010, SRFL_PRHEX | SRFL_MORE, SROM4_BFL0, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM4_BFL1, 0xffff}, + {BRCMS_SROM_BOARDFLAGS, 0x000000e0, SRFL_PRHEX | SRFL_MORE, SROM5_BFL0, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM5_BFL1, 0xffff}, + {BRCMS_SROM_BOARDFLAGS, 0xffffff00, SRFL_PRHEX | SRFL_MORE, SROM8_BFL0, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM8_BFL1, 0xffff}, + {BRCMS_SROM_BOARDFLAGS2, 0x00000010, SRFL_PRHEX | SRFL_MORE, SROM4_BFL2, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM4_BFL3, 0xffff}, + {BRCMS_SROM_BOARDFLAGS2, 0x000000e0, SRFL_PRHEX | SRFL_MORE, SROM5_BFL2, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM5_BFL3, 0xffff}, + {BRCMS_SROM_BOARDFLAGS2, 0xffffff00, SRFL_PRHEX | SRFL_MORE, SROM8_BFL2, + 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM8_BFL3, 0xffff}, + {BRCMS_SROM_BOARDTYPE, 0xfffffffc, SRFL_PRHEX, SROM_SSID, 0xffff}, + {BRCMS_SROM_BOARDNUM, 0x00000006, 0, SROM_MACLO_IL0, 0xffff}, + {BRCMS_SROM_BOARDNUM, 0x00000008, 0, SROM3_MACLO, 0xffff}, + {BRCMS_SROM_BOARDNUM, 0x00000010, 0, SROM4_MACLO, 0xffff}, + {BRCMS_SROM_BOARDNUM, 0x000000e0, 0, SROM5_MACLO, 0xffff}, + {BRCMS_SROM_BOARDNUM, 0xffffff00, 0, SROM8_MACLO, 0xffff}, + {BRCMS_SROM_CC, 0x00000002, 0, SROM_AABREV, SROM_CC_MASK}, + {BRCMS_SROM_REGREV, 0x00000008, 0, SROM_OPO, 0xff00}, + {BRCMS_SROM_REGREV, 0x00000010, 0, SROM4_REGREV, 0x00ff}, + {BRCMS_SROM_REGREV, 0x000000e0, 0, SROM5_REGREV, 0x00ff}, + {BRCMS_SROM_REGREV, 0xffffff00, 0, SROM8_REGREV, 0x00ff}, + {BRCMS_SROM_LEDBH0, 0x0000000e, SRFL_NOFFS, SROM_LEDBH10, 0x00ff}, + {BRCMS_SROM_LEDBH1, 0x0000000e, SRFL_NOFFS, SROM_LEDBH10, 0xff00}, + {BRCMS_SROM_LEDBH2, 0x0000000e, SRFL_NOFFS, SROM_LEDBH32, 0x00ff}, + {BRCMS_SROM_LEDBH3, 0x0000000e, SRFL_NOFFS, SROM_LEDBH32, 0xff00}, + {BRCMS_SROM_LEDBH0, 0x00000010, SRFL_NOFFS, SROM4_LEDBH10, 0x00ff}, + {BRCMS_SROM_LEDBH1, 0x00000010, SRFL_NOFFS, SROM4_LEDBH10, 0xff00}, + {BRCMS_SROM_LEDBH2, 0x00000010, SRFL_NOFFS, SROM4_LEDBH32, 0x00ff}, + {BRCMS_SROM_LEDBH3, 0x00000010, SRFL_NOFFS, SROM4_LEDBH32, 0xff00}, + {BRCMS_SROM_LEDBH0, 0x000000e0, SRFL_NOFFS, SROM5_LEDBH10, 0x00ff}, + {BRCMS_SROM_LEDBH1, 0x000000e0, SRFL_NOFFS, SROM5_LEDBH10, 0xff00}, + {BRCMS_SROM_LEDBH2, 0x000000e0, SRFL_NOFFS, SROM5_LEDBH32, 0x00ff}, + {BRCMS_SROM_LEDBH3, 0x000000e0, SRFL_NOFFS, SROM5_LEDBH32, 0xff00}, + {BRCMS_SROM_LEDBH0, 0xffffff00, SRFL_NOFFS, SROM8_LEDBH10, 0x00ff}, + {BRCMS_SROM_LEDBH1, 0xffffff00, SRFL_NOFFS, SROM8_LEDBH10, 0xff00}, + {BRCMS_SROM_LEDBH2, 0xffffff00, SRFL_NOFFS, SROM8_LEDBH32, 0x00ff}, + {BRCMS_SROM_LEDBH3, 0xffffff00, SRFL_NOFFS, SROM8_LEDBH32, 0xff00}, + {BRCMS_SROM_PA0B0, 0x0000000e, SRFL_PRHEX, SROM_WL0PAB0, 0xffff}, + {BRCMS_SROM_PA0B1, 0x0000000e, SRFL_PRHEX, SROM_WL0PAB1, 0xffff}, + {BRCMS_SROM_PA0B2, 0x0000000e, SRFL_PRHEX, SROM_WL0PAB2, 0xffff}, + {BRCMS_SROM_PA0ITSSIT, 0x0000000e, 0, SROM_ITT, 0x00ff}, + {BRCMS_SROM_PA0MAXPWR, 0x0000000e, 0, SROM_WL10MAXP, 0x00ff}, + {BRCMS_SROM_PA0B0, 0xffffff00, SRFL_PRHEX, SROM8_W0_PAB0, 0xffff}, + {BRCMS_SROM_PA0B1, 0xffffff00, SRFL_PRHEX, SROM8_W0_PAB1, 0xffff}, + {BRCMS_SROM_PA0B2, 0xffffff00, SRFL_PRHEX, SROM8_W0_PAB2, 0xffff}, + {BRCMS_SROM_PA0ITSSIT, 0xffffff00, 0, SROM8_W0_ITTMAXP, 0xff00}, + {BRCMS_SROM_PA0MAXPWR, 0xffffff00, 0, SROM8_W0_ITTMAXP, 0x00ff}, + {BRCMS_SROM_OPO, 0x0000000c, 0, SROM_OPO, 0x00ff}, + {BRCMS_SROM_OPO, 0xffffff00, 0, SROM8_2G_OFDMPO, 0x00ff}, + {BRCMS_SROM_AA2G, 0x0000000e, 0, SROM_AABREV, SROM_AA0_MASK}, + {BRCMS_SROM_AA2G, 0x000000f0, 0, SROM4_AA, 0x00ff}, + {BRCMS_SROM_AA2G, 0xffffff00, 0, SROM8_AA, 0x00ff}, + {BRCMS_SROM_AA5G, 0x0000000e, 0, SROM_AABREV, SROM_AA1_MASK}, + {BRCMS_SROM_AA5G, 0x000000f0, 0, SROM4_AA, 0xff00}, + {BRCMS_SROM_AA5G, 0xffffff00, 0, SROM8_AA, 0xff00}, + {BRCMS_SROM_AG0, 0x0000000e, 0, SROM_AG10, 0x00ff}, + {BRCMS_SROM_AG1, 0x0000000e, 0, SROM_AG10, 0xff00}, + {BRCMS_SROM_AG0, 0x000000f0, 0, SROM4_AG10, 0x00ff}, + {BRCMS_SROM_AG1, 0x000000f0, 0, SROM4_AG10, 0xff00}, + {BRCMS_SROM_AG2, 0x000000f0, 0, SROM4_AG32, 0x00ff}, + {BRCMS_SROM_AG3, 0x000000f0, 0, SROM4_AG32, 0xff00}, + {BRCMS_SROM_AG0, 0xffffff00, 0, SROM8_AG10, 0x00ff}, + {BRCMS_SROM_AG1, 0xffffff00, 0, SROM8_AG10, 0xff00}, + {BRCMS_SROM_AG2, 0xffffff00, 0, SROM8_AG32, 0x00ff}, + {BRCMS_SROM_AG3, 0xffffff00, 0, SROM8_AG32, 0xff00}, + {BRCMS_SROM_PA1B0, 0x0000000e, SRFL_PRHEX, SROM_WL1PAB0, 0xffff}, + {BRCMS_SROM_PA1B1, 0x0000000e, SRFL_PRHEX, SROM_WL1PAB1, 0xffff}, + {BRCMS_SROM_PA1B2, 0x0000000e, SRFL_PRHEX, SROM_WL1PAB2, 0xffff}, + {BRCMS_SROM_PA1LOB0, 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB0, 0xffff}, + {BRCMS_SROM_PA1LOB1, 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB1, 0xffff}, + {BRCMS_SROM_PA1LOB2, 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB2, 0xffff}, + {BRCMS_SROM_PA1HIB0, 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB0, 0xffff}, + {BRCMS_SROM_PA1HIB1, 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB1, 0xffff}, + {BRCMS_SROM_PA1HIB2, 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB2, 0xffff}, + {BRCMS_SROM_PA1ITSSIT, 0x0000000e, 0, SROM_ITT, 0xff00}, + {BRCMS_SROM_PA1MAXPWR, 0x0000000e, 0, SROM_WL10MAXP, 0xff00}, + {BRCMS_SROM_PA1LOMAXPWR, 0x0000000c, 0, SROM_WL1LHMAXP, 0xff00}, + {BRCMS_SROM_PA1HIMAXPWR, 0x0000000c, 0, SROM_WL1LHMAXP, 0x00ff}, + {BRCMS_SROM_PA1B0, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB0, 0xffff}, + {BRCMS_SROM_PA1B1, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB1, 0xffff}, + {BRCMS_SROM_PA1B2, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB2, 0xffff}, + {BRCMS_SROM_PA1LOB0, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB0_LC, 0xffff}, + {BRCMS_SROM_PA1LOB1, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB1_LC, 0xffff}, + {BRCMS_SROM_PA1LOB2, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB2_LC, 0xffff}, + {BRCMS_SROM_PA1HIB0, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB0_HC, 0xffff}, + {BRCMS_SROM_PA1HIB1, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB1_HC, 0xffff}, + {BRCMS_SROM_PA1HIB2, 0xffffff00, SRFL_PRHEX, SROM8_W1_PAB2_HC, 0xffff}, + {BRCMS_SROM_PA1ITSSIT, 0xffffff00, 0, SROM8_W1_ITTMAXP, 0xff00}, + {BRCMS_SROM_PA1MAXPWR, 0xffffff00, 0, SROM8_W1_ITTMAXP, 0x00ff}, + {BRCMS_SROM_PA1LOMAXPWR, 0xffffff00, 0, SROM8_W1_MAXP_LCHC, 0xff00}, + {BRCMS_SROM_PA1HIMAXPWR, 0xffffff00, 0, SROM8_W1_MAXP_LCHC, 0x00ff}, + {BRCMS_SROM_BXA2G, 0x00000008, 0, SROM_BXARSSI2G, 0x1800}, + {BRCMS_SROM_RSSISAV2G, 0x00000008, 0, SROM_BXARSSI2G, 0x0700}, + {BRCMS_SROM_RSSISMC2G, 0x00000008, 0, SROM_BXARSSI2G, 0x00f0}, + {BRCMS_SROM_RSSISMF2G, 0x00000008, 0, SROM_BXARSSI2G, 0x000f}, + {BRCMS_SROM_BXA2G, 0xffffff00, 0, SROM8_BXARSSI2G, 0x1800}, + {BRCMS_SROM_RSSISAV2G, 0xffffff00, 0, SROM8_BXARSSI2G, 0x0700}, + {BRCMS_SROM_RSSISMC2G, 0xffffff00, 0, SROM8_BXARSSI2G, 0x00f0}, + {BRCMS_SROM_RSSISMF2G, 0xffffff00, 0, SROM8_BXARSSI2G, 0x000f}, + {BRCMS_SROM_BXA5G, 0x00000008, 0, SROM_BXARSSI5G, 0x1800}, + {BRCMS_SROM_RSSISAV5G, 0x00000008, 0, SROM_BXARSSI5G, 0x0700}, + {BRCMS_SROM_RSSISMC5G, 0x00000008, 0, SROM_BXARSSI5G, 0x00f0}, + {BRCMS_SROM_RSSISMF5G, 0x00000008, 0, SROM_BXARSSI5G, 0x000f}, + {BRCMS_SROM_BXA5G, 0xffffff00, 0, SROM8_BXARSSI5G, 0x1800}, + {BRCMS_SROM_RSSISAV5G, 0xffffff00, 0, SROM8_BXARSSI5G, 0x0700}, + {BRCMS_SROM_RSSISMC5G, 0xffffff00, 0, SROM8_BXARSSI5G, 0x00f0}, + {BRCMS_SROM_RSSISMF5G, 0xffffff00, 0, SROM8_BXARSSI5G, 0x000f}, + {BRCMS_SROM_TRI2G, 0x00000008, 0, SROM_TRI52G, 0x00ff}, + {BRCMS_SROM_TRI5G, 0x00000008, 0, SROM_TRI52G, 0xff00}, + {BRCMS_SROM_TRI5GL, 0x00000008, 0, SROM_TRI5GHL, 0x00ff}, + {BRCMS_SROM_TRI5GH, 0x00000008, 0, SROM_TRI5GHL, 0xff00}, + {BRCMS_SROM_TRI2G, 0xffffff00, 0, SROM8_TRI52G, 0x00ff}, + {BRCMS_SROM_TRI5G, 0xffffff00, 0, SROM8_TRI52G, 0xff00}, + {BRCMS_SROM_TRI5GL, 0xffffff00, 0, SROM8_TRI5GHL, 0x00ff}, + {BRCMS_SROM_TRI5GH, 0xffffff00, 0, SROM8_TRI5GHL, 0xff00}, + {BRCMS_SROM_RXPO2G, 0x00000008, SRFL_PRSIGN, SROM_RXPO52G, 0x00ff}, + {BRCMS_SROM_RXPO5G, 0x00000008, SRFL_PRSIGN, SROM_RXPO52G, 0xff00}, + {BRCMS_SROM_RXPO2G, 0xffffff00, SRFL_PRSIGN, SROM8_RXPO52G, 0x00ff}, + {BRCMS_SROM_RXPO5G, 0xffffff00, SRFL_PRSIGN, SROM8_RXPO52G, 0xff00}, + {BRCMS_SROM_TXCHAIN, 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, + SROM4_TXCHAIN_MASK}, + {BRCMS_SROM_RXCHAIN, 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, + SROM4_RXCHAIN_MASK}, + {BRCMS_SROM_ANTSWITCH, 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, + SROM4_SWITCH_MASK}, + {BRCMS_SROM_TXCHAIN, 0xffffff00, SRFL_NOFFS, SROM8_TXRXC, + SROM4_TXCHAIN_MASK}, + {BRCMS_SROM_RXCHAIN, 0xffffff00, SRFL_NOFFS, SROM8_TXRXC, + SROM4_RXCHAIN_MASK}, + {BRCMS_SROM_ANTSWITCH, 0xffffff00, SRFL_NOFFS, SROM8_TXRXC, + SROM4_SWITCH_MASK}, + {BRCMS_SROM_TSSIPOS2G, 0xffffff00, 0, SROM8_FEM2G, + SROM8_FEM_TSSIPOS_MASK}, + {BRCMS_SROM_EXTPAGAIN2G, 0xffffff00, 0, SROM8_FEM2G, + SROM8_FEM_EXTPA_GAIN_MASK}, + {BRCMS_SROM_PDETRANGE2G, 0xffffff00, 0, SROM8_FEM2G, + SROM8_FEM_PDET_RANGE_MASK}, + {BRCMS_SROM_TRISO2G, 0xffffff00, 0, SROM8_FEM2G, SROM8_FEM_TR_ISO_MASK}, + {BRCMS_SROM_ANTSWCTL2G, 0xffffff00, 0, SROM8_FEM2G, + SROM8_FEM_ANTSWLUT_MASK}, + {BRCMS_SROM_TSSIPOS5G, 0xffffff00, 0, SROM8_FEM5G, + SROM8_FEM_TSSIPOS_MASK}, + {BRCMS_SROM_EXTPAGAIN5G, 0xffffff00, 0, SROM8_FEM5G, + SROM8_FEM_EXTPA_GAIN_MASK}, + {BRCMS_SROM_PDETRANGE5G, 0xffffff00, 0, SROM8_FEM5G, + SROM8_FEM_PDET_RANGE_MASK}, + {BRCMS_SROM_TRISO5G, 0xffffff00, 0, SROM8_FEM5G, SROM8_FEM_TR_ISO_MASK}, + {BRCMS_SROM_ANTSWCTL5G, 0xffffff00, 0, SROM8_FEM5G, + SROM8_FEM_ANTSWLUT_MASK}, + {BRCMS_SROM_TEMPTHRESH, 0xffffff00, 0, SROM8_THERMAL, 0xff00}, + {BRCMS_SROM_TEMPOFFSET, 0xffffff00, 0, SROM8_THERMAL, 0x00ff}, + {BRCMS_SROM_TXPID2GA0, 0x000000f0, 0, SROM4_TXPID2G, 0x00ff}, + {BRCMS_SROM_TXPID2GA1, 0x000000f0, 0, SROM4_TXPID2G, 0xff00}, + {BRCMS_SROM_TXPID2GA2, 0x000000f0, 0, SROM4_TXPID2G + 1, 0x00ff}, + {BRCMS_SROM_TXPID2GA3, 0x000000f0, 0, SROM4_TXPID2G + 1, 0xff00}, + {BRCMS_SROM_TXPID5GA0, 0x000000f0, 0, SROM4_TXPID5G, 0x00ff}, + {BRCMS_SROM_TXPID5GA1, 0x000000f0, 0, SROM4_TXPID5G, 0xff00}, + {BRCMS_SROM_TXPID5GA2, 0x000000f0, 0, SROM4_TXPID5G + 1, 0x00ff}, + {BRCMS_SROM_TXPID5GA3, 0x000000f0, 0, SROM4_TXPID5G + 1, 0xff00}, + {BRCMS_SROM_TXPID5GLA0, 0x000000f0, 0, SROM4_TXPID5GL, 0x00ff}, + {BRCMS_SROM_TXPID5GLA1, 0x000000f0, 0, SROM4_TXPID5GL, 0xff00}, + {BRCMS_SROM_TXPID5GLA2, 0x000000f0, 0, SROM4_TXPID5GL + 1, 0x00ff}, + {BRCMS_SROM_TXPID5GLA3, 0x000000f0, 0, SROM4_TXPID5GL + 1, 0xff00}, + {BRCMS_SROM_TXPID5GHA0, 0x000000f0, 0, SROM4_TXPID5GH, 0x00ff}, + {BRCMS_SROM_TXPID5GHA1, 0x000000f0, 0, SROM4_TXPID5GH, 0xff00}, + {BRCMS_SROM_TXPID5GHA2, 0x000000f0, 0, SROM4_TXPID5GH + 1, 0x00ff}, + {BRCMS_SROM_TXPID5GHA3, 0x000000f0, 0, SROM4_TXPID5GH + 1, 0xff00}, + + {BRCMS_SROM_CCODE, 0x0000000f, SRFL_CCODE, SROM_CCODE, 0xffff}, + {BRCMS_SROM_CCODE, 0x00000010, SRFL_CCODE, SROM4_CCODE, 0xffff}, + {BRCMS_SROM_CCODE, 0x000000e0, SRFL_CCODE, SROM5_CCODE, 0xffff}, + {BRCMS_SROM_CCODE, 0xffffff00, SRFL_CCODE, SROM8_CCODE, 0xffff}, + {BRCMS_SROM_MACADDR, 0xffffff00, SRFL_ETHADDR, SROM8_MACHI, 0xffff}, + {BRCMS_SROM_MACADDR, 0x000000e0, SRFL_ETHADDR, SROM5_MACHI, 0xffff}, + {BRCMS_SROM_MACADDR, 0x00000010, SRFL_ETHADDR, SROM4_MACHI, 0xffff}, + {BRCMS_SROM_MACADDR, 0x00000008, SRFL_ETHADDR, SROM3_MACHI, 0xffff}, + {BRCMS_SROM_IL0MACADDR, 0x00000007, SRFL_ETHADDR, SROM_MACHI_IL0, + 0xffff}, + {BRCMS_SROM_ET1MACADDR, 0x00000007, SRFL_ETHADDR, SROM_MACHI_ET1, + 0xffff}, + {BRCMS_SROM_LEDDC, 0xffffff00, SRFL_NOFFS | SRFL_LEDDC, SROM8_LEDDC, + 0xffff}, + {BRCMS_SROM_LEDDC, 0x000000e0, SRFL_NOFFS | SRFL_LEDDC, SROM5_LEDDC, + 0xffff}, + {BRCMS_SROM_LEDDC, 0x00000010, SRFL_NOFFS | SRFL_LEDDC, SROM4_LEDDC, + 0xffff}, + {BRCMS_SROM_LEDDC, 0x00000008, SRFL_NOFFS | SRFL_LEDDC, SROM3_LEDDC, + 0xffff}, + {BRCMS_SROM_RAWTEMPSENSE, 0xffffff00, SRFL_PRHEX, SROM8_MPWR_RAWTS, + 0x01ff}, + {BRCMS_SROM_MEASPOWER, 0xffffff00, SRFL_PRHEX, SROM8_MPWR_RAWTS, + 0xfe00}, + {BRCMS_SROM_TEMPSENSE_SLOPE, 0xffffff00, SRFL_PRHEX, + SROM8_TS_SLP_OPT_CORRX, 0x00ff}, + {BRCMS_SROM_TEMPCORRX, 0xffffff00, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, + 0xfc00}, + {BRCMS_SROM_TEMPSENSE_OPTION, 0xffffff00, SRFL_PRHEX, + SROM8_TS_SLP_OPT_CORRX, 0x0300}, + {BRCMS_SROM_FREQOFFSET_CORR, 0xffffff00, SRFL_PRHEX, + SROM8_FOC_HWIQ_IQSWP, 0x000f}, + {BRCMS_SROM_IQCAL_SWP_DIS, 0xffffff00, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, + 0x0010}, + {BRCMS_SROM_HW_IQCAL_EN, 0xffffff00, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, + 0x0020}, + {BRCMS_SROM_PHYCAL_TEMPDELTA, 0xffffff00, 0, SROM8_PHYCAL_TEMPDELTA, 0x00ff}, - {"tempcorrx", 0xffffff00, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, 0xfc00}, - {"tempsense_option", 0xffffff00, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, - 0x0300}, - {"freqoffset_corr", 0xffffff00, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, - 0x000f}, - {"iqcal_swp_dis", 0xffffff00, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, 0x0010}, - {"hw_iqcal_en", 0xffffff00, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, 0x0020}, - {"phycal_tempdelta", 0xffffff00, 0, SROM8_PHYCAL_TEMPDELTA, 0x00ff}, - - {"cck2gpo", 0x000000f0, 0, SROM4_2G_CCKPO, 0xffff}, - {"cck2gpo", 0x00000100, 0, SROM8_2G_CCKPO, 0xffff}, - {"ofdm2gpo", 0x000000f0, SRFL_MORE, SROM4_2G_OFDMPO, 0xffff}, - {"", 0, 0, SROM4_2G_OFDMPO + 1, 0xffff}, - {"ofdm5gpo", 0x000000f0, SRFL_MORE, SROM4_5G_OFDMPO, 0xffff}, - {"", 0, 0, SROM4_5G_OFDMPO + 1, 0xffff}, - {"ofdm5glpo", 0x000000f0, SRFL_MORE, SROM4_5GL_OFDMPO, 0xffff}, - {"", 0, 0, SROM4_5GL_OFDMPO + 1, 0xffff}, - {"ofdm5ghpo", 0x000000f0, SRFL_MORE, SROM4_5GH_OFDMPO, 0xffff}, - {"", 0, 0, SROM4_5GH_OFDMPO + 1, 0xffff}, - {"ofdm2gpo", 0x00000100, SRFL_MORE, SROM8_2G_OFDMPO, 0xffff}, - {"", 0, 0, SROM8_2G_OFDMPO + 1, 0xffff}, - {"ofdm5gpo", 0x00000100, SRFL_MORE, SROM8_5G_OFDMPO, 0xffff}, - {"", 0, 0, SROM8_5G_OFDMPO + 1, 0xffff}, - {"ofdm5glpo", 0x00000100, SRFL_MORE, SROM8_5GL_OFDMPO, 0xffff}, - {"", 0, 0, SROM8_5GL_OFDMPO + 1, 0xffff}, - {"ofdm5ghpo", 0x00000100, SRFL_MORE, SROM8_5GH_OFDMPO, 0xffff}, - {"", 0, 0, SROM8_5GH_OFDMPO + 1, 0xffff}, - {"mcs2gpo0", 0x000000f0, 0, SROM4_2G_MCSPO, 0xffff}, - {"mcs2gpo1", 0x000000f0, 0, SROM4_2G_MCSPO + 1, 0xffff}, - {"mcs2gpo2", 0x000000f0, 0, SROM4_2G_MCSPO + 2, 0xffff}, - {"mcs2gpo3", 0x000000f0, 0, SROM4_2G_MCSPO + 3, 0xffff}, - {"mcs2gpo4", 0x000000f0, 0, SROM4_2G_MCSPO + 4, 0xffff}, - {"mcs2gpo5", 0x000000f0, 0, SROM4_2G_MCSPO + 5, 0xffff}, - {"mcs2gpo6", 0x000000f0, 0, SROM4_2G_MCSPO + 6, 0xffff}, - {"mcs2gpo7", 0x000000f0, 0, SROM4_2G_MCSPO + 7, 0xffff}, - {"mcs5gpo0", 0x000000f0, 0, SROM4_5G_MCSPO, 0xffff}, - {"mcs5gpo1", 0x000000f0, 0, SROM4_5G_MCSPO + 1, 0xffff}, - {"mcs5gpo2", 0x000000f0, 0, SROM4_5G_MCSPO + 2, 0xffff}, - {"mcs5gpo3", 0x000000f0, 0, SROM4_5G_MCSPO + 3, 0xffff}, - {"mcs5gpo4", 0x000000f0, 0, SROM4_5G_MCSPO + 4, 0xffff}, - {"mcs5gpo5", 0x000000f0, 0, SROM4_5G_MCSPO + 5, 0xffff}, - {"mcs5gpo6", 0x000000f0, 0, SROM4_5G_MCSPO + 6, 0xffff}, - {"mcs5gpo7", 0x000000f0, 0, SROM4_5G_MCSPO + 7, 0xffff}, - {"mcs5glpo0", 0x000000f0, 0, SROM4_5GL_MCSPO, 0xffff}, - {"mcs5glpo1", 0x000000f0, 0, SROM4_5GL_MCSPO + 1, 0xffff}, - {"mcs5glpo2", 0x000000f0, 0, SROM4_5GL_MCSPO + 2, 0xffff}, - {"mcs5glpo3", 0x000000f0, 0, SROM4_5GL_MCSPO + 3, 0xffff}, - {"mcs5glpo4", 0x000000f0, 0, SROM4_5GL_MCSPO + 4, 0xffff}, - {"mcs5glpo5", 0x000000f0, 0, SROM4_5GL_MCSPO + 5, 0xffff}, - {"mcs5glpo6", 0x000000f0, 0, SROM4_5GL_MCSPO + 6, 0xffff}, - {"mcs5glpo7", 0x000000f0, 0, SROM4_5GL_MCSPO + 7, 0xffff}, - {"mcs5ghpo0", 0x000000f0, 0, SROM4_5GH_MCSPO, 0xffff}, - {"mcs5ghpo1", 0x000000f0, 0, SROM4_5GH_MCSPO + 1, 0xffff}, - {"mcs5ghpo2", 0x000000f0, 0, SROM4_5GH_MCSPO + 2, 0xffff}, - {"mcs5ghpo3", 0x000000f0, 0, SROM4_5GH_MCSPO + 3, 0xffff}, - {"mcs5ghpo4", 0x000000f0, 0, SROM4_5GH_MCSPO + 4, 0xffff}, - {"mcs5ghpo5", 0x000000f0, 0, SROM4_5GH_MCSPO + 5, 0xffff}, - {"mcs5ghpo6", 0x000000f0, 0, SROM4_5GH_MCSPO + 6, 0xffff}, - {"mcs5ghpo7", 0x000000f0, 0, SROM4_5GH_MCSPO + 7, 0xffff}, - {"mcs2gpo0", 0x00000100, 0, SROM8_2G_MCSPO, 0xffff}, - {"mcs2gpo1", 0x00000100, 0, SROM8_2G_MCSPO + 1, 0xffff}, - {"mcs2gpo2", 0x00000100, 0, SROM8_2G_MCSPO + 2, 0xffff}, - {"mcs2gpo3", 0x00000100, 0, SROM8_2G_MCSPO + 3, 0xffff}, - {"mcs2gpo4", 0x00000100, 0, SROM8_2G_MCSPO + 4, 0xffff}, - {"mcs2gpo5", 0x00000100, 0, SROM8_2G_MCSPO + 5, 0xffff}, - {"mcs2gpo6", 0x00000100, 0, SROM8_2G_MCSPO + 6, 0xffff}, - {"mcs2gpo7", 0x00000100, 0, SROM8_2G_MCSPO + 7, 0xffff}, - {"mcs5gpo0", 0x00000100, 0, SROM8_5G_MCSPO, 0xffff}, - {"mcs5gpo1", 0x00000100, 0, SROM8_5G_MCSPO + 1, 0xffff}, - {"mcs5gpo2", 0x00000100, 0, SROM8_5G_MCSPO + 2, 0xffff}, - {"mcs5gpo3", 0x00000100, 0, SROM8_5G_MCSPO + 3, 0xffff}, - {"mcs5gpo4", 0x00000100, 0, SROM8_5G_MCSPO + 4, 0xffff}, - {"mcs5gpo5", 0x00000100, 0, SROM8_5G_MCSPO + 5, 0xffff}, - {"mcs5gpo6", 0x00000100, 0, SROM8_5G_MCSPO + 6, 0xffff}, - {"mcs5gpo7", 0x00000100, 0, SROM8_5G_MCSPO + 7, 0xffff}, - {"mcs5glpo0", 0x00000100, 0, SROM8_5GL_MCSPO, 0xffff}, - {"mcs5glpo1", 0x00000100, 0, SROM8_5GL_MCSPO + 1, 0xffff}, - {"mcs5glpo2", 0x00000100, 0, SROM8_5GL_MCSPO + 2, 0xffff}, - {"mcs5glpo3", 0x00000100, 0, SROM8_5GL_MCSPO + 3, 0xffff}, - {"mcs5glpo4", 0x00000100, 0, SROM8_5GL_MCSPO + 4, 0xffff}, - {"mcs5glpo5", 0x00000100, 0, SROM8_5GL_MCSPO + 5, 0xffff}, - {"mcs5glpo6", 0x00000100, 0, SROM8_5GL_MCSPO + 6, 0xffff}, - {"mcs5glpo7", 0x00000100, 0, SROM8_5GL_MCSPO + 7, 0xffff}, - {"mcs5ghpo0", 0x00000100, 0, SROM8_5GH_MCSPO, 0xffff}, - {"mcs5ghpo1", 0x00000100, 0, SROM8_5GH_MCSPO + 1, 0xffff}, - {"mcs5ghpo2", 0x00000100, 0, SROM8_5GH_MCSPO + 2, 0xffff}, - {"mcs5ghpo3", 0x00000100, 0, SROM8_5GH_MCSPO + 3, 0xffff}, - {"mcs5ghpo4", 0x00000100, 0, SROM8_5GH_MCSPO + 4, 0xffff}, - {"mcs5ghpo5", 0x00000100, 0, SROM8_5GH_MCSPO + 5, 0xffff}, - {"mcs5ghpo6", 0x00000100, 0, SROM8_5GH_MCSPO + 6, 0xffff}, - {"mcs5ghpo7", 0x00000100, 0, SROM8_5GH_MCSPO + 7, 0xffff}, - {"cddpo", 0x000000f0, 0, SROM4_CDDPO, 0xffff}, - {"stbcpo", 0x000000f0, 0, SROM4_STBCPO, 0xffff}, - {"bw40po", 0x000000f0, 0, SROM4_BW40PO, 0xffff}, - {"bwduppo", 0x000000f0, 0, SROM4_BWDUPPO, 0xffff}, - {"cddpo", 0x00000100, 0, SROM8_CDDPO, 0xffff}, - {"stbcpo", 0x00000100, 0, SROM8_STBCPO, 0xffff}, - {"bw40po", 0x00000100, 0, SROM8_BW40PO, 0xffff}, - {"bwduppo", 0x00000100, 0, SROM8_BWDUPPO, 0xffff}, + + {BRCMS_SROM_CCK2GPO, 0x000000f0, 0, SROM4_2G_CCKPO, 0xffff}, + {BRCMS_SROM_CCK2GPO, 0x00000100, 0, SROM8_2G_CCKPO, 0xffff}, + {BRCMS_SROM_OFDM2GPO, 0x000000f0, SRFL_MORE, SROM4_2G_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM4_2G_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM5GPO, 0x000000f0, SRFL_MORE, SROM4_5G_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM4_5G_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM5GLPO, 0x000000f0, SRFL_MORE, SROM4_5GL_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM4_5GL_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM5GHPO, 0x000000f0, SRFL_MORE, SROM4_5GH_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM4_5GH_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM2GPO, 0x00000100, SRFL_MORE, SROM8_2G_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM8_2G_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM5GPO, 0x00000100, SRFL_MORE, SROM8_5G_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM8_5G_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM5GLPO, 0x00000100, SRFL_MORE, SROM8_5GL_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM8_5GL_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_OFDM5GHPO, 0x00000100, SRFL_MORE, SROM8_5GH_OFDMPO, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM8_5GH_OFDMPO + 1, 0xffff}, + {BRCMS_SROM_MCS2GPO0, 0x000000f0, 0, SROM4_2G_MCSPO, 0xffff}, + {BRCMS_SROM_MCS2GPO1, 0x000000f0, 0, SROM4_2G_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS2GPO2, 0x000000f0, 0, SROM4_2G_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS2GPO3, 0x000000f0, 0, SROM4_2G_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS2GPO4, 0x000000f0, 0, SROM4_2G_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS2GPO5, 0x000000f0, 0, SROM4_2G_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS2GPO6, 0x000000f0, 0, SROM4_2G_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS2GPO7, 0x000000f0, 0, SROM4_2G_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS5GPO0, 0x000000f0, 0, SROM4_5G_MCSPO, 0xffff}, + {BRCMS_SROM_MCS5GPO1, 0x000000f0, 0, SROM4_5G_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS5GPO2, 0x000000f0, 0, SROM4_5G_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS5GPO3, 0x000000f0, 0, SROM4_5G_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS5GPO4, 0x000000f0, 0, SROM4_5G_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS5GPO5, 0x000000f0, 0, SROM4_5G_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS5GPO6, 0x000000f0, 0, SROM4_5G_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS5GPO7, 0x000000f0, 0, SROM4_5G_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS5GLPO0, 0x000000f0, 0, SROM4_5GL_MCSPO, 0xffff}, + {BRCMS_SROM_MCS5GLPO1, 0x000000f0, 0, SROM4_5GL_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS5GLPO2, 0x000000f0, 0, SROM4_5GL_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS5GLPO3, 0x000000f0, 0, SROM4_5GL_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS5GLPO4, 0x000000f0, 0, SROM4_5GL_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS5GLPO5, 0x000000f0, 0, SROM4_5GL_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS5GLPO6, 0x000000f0, 0, SROM4_5GL_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS5GLPO7, 0x000000f0, 0, SROM4_5GL_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS5GHPO0, 0x000000f0, 0, SROM4_5GH_MCSPO, 0xffff}, + {BRCMS_SROM_MCS5GHPO1, 0x000000f0, 0, SROM4_5GH_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS5GHPO2, 0x000000f0, 0, SROM4_5GH_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS5GHPO3, 0x000000f0, 0, SROM4_5GH_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS5GHPO4, 0x000000f0, 0, SROM4_5GH_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS5GHPO5, 0x000000f0, 0, SROM4_5GH_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS5GHPO6, 0x000000f0, 0, SROM4_5GH_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS5GHPO7, 0x000000f0, 0, SROM4_5GH_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS2GPO0, 0x00000100, 0, SROM8_2G_MCSPO, 0xffff}, + {BRCMS_SROM_MCS2GPO1, 0x00000100, 0, SROM8_2G_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS2GPO2, 0x00000100, 0, SROM8_2G_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS2GPO3, 0x00000100, 0, SROM8_2G_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS2GPO4, 0x00000100, 0, SROM8_2G_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS2GPO5, 0x00000100, 0, SROM8_2G_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS2GPO6, 0x00000100, 0, SROM8_2G_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS2GPO7, 0x00000100, 0, SROM8_2G_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS5GPO0, 0x00000100, 0, SROM8_5G_MCSPO, 0xffff}, + {BRCMS_SROM_MCS5GPO1, 0x00000100, 0, SROM8_5G_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS5GPO2, 0x00000100, 0, SROM8_5G_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS5GPO3, 0x00000100, 0, SROM8_5G_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS5GPO4, 0x00000100, 0, SROM8_5G_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS5GPO5, 0x00000100, 0, SROM8_5G_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS5GPO6, 0x00000100, 0, SROM8_5G_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS5GPO7, 0x00000100, 0, SROM8_5G_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS5GLPO0, 0x00000100, 0, SROM8_5GL_MCSPO, 0xffff}, + {BRCMS_SROM_MCS5GLPO1, 0x00000100, 0, SROM8_5GL_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS5GLPO2, 0x00000100, 0, SROM8_5GL_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS5GLPO3, 0x00000100, 0, SROM8_5GL_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS5GLPO4, 0x00000100, 0, SROM8_5GL_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS5GLPO5, 0x00000100, 0, SROM8_5GL_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS5GLPO6, 0x00000100, 0, SROM8_5GL_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS5GLPO7, 0x00000100, 0, SROM8_5GL_MCSPO + 7, 0xffff}, + {BRCMS_SROM_MCS5GHPO0, 0x00000100, 0, SROM8_5GH_MCSPO, 0xffff}, + {BRCMS_SROM_MCS5GHPO1, 0x00000100, 0, SROM8_5GH_MCSPO + 1, 0xffff}, + {BRCMS_SROM_MCS5GHPO2, 0x00000100, 0, SROM8_5GH_MCSPO + 2, 0xffff}, + {BRCMS_SROM_MCS5GHPO3, 0x00000100, 0, SROM8_5GH_MCSPO + 3, 0xffff}, + {BRCMS_SROM_MCS5GHPO4, 0x00000100, 0, SROM8_5GH_MCSPO + 4, 0xffff}, + {BRCMS_SROM_MCS5GHPO5, 0x00000100, 0, SROM8_5GH_MCSPO + 5, 0xffff}, + {BRCMS_SROM_MCS5GHPO6, 0x00000100, 0, SROM8_5GH_MCSPO + 6, 0xffff}, + {BRCMS_SROM_MCS5GHPO7, 0x00000100, 0, SROM8_5GH_MCSPO + 7, 0xffff}, + {BRCMS_SROM_CDDPO, 0x000000f0, 0, SROM4_CDDPO, 0xffff}, + {BRCMS_SROM_STBCPO, 0x000000f0, 0, SROM4_STBCPO, 0xffff}, + {BRCMS_SROM_BW40PO, 0x000000f0, 0, SROM4_BW40PO, 0xffff}, + {BRCMS_SROM_BWDUPPO, 0x000000f0, 0, SROM4_BWDUPPO, 0xffff}, + {BRCMS_SROM_CDDPO, 0x00000100, 0, SROM8_CDDPO, 0xffff}, + {BRCMS_SROM_STBCPO, 0x00000100, 0, SROM8_STBCPO, 0xffff}, + {BRCMS_SROM_BW40PO, 0x00000100, 0, SROM8_BW40PO, 0xffff}, + {BRCMS_SROM_BWDUPPO, 0x00000100, 0, SROM8_BWDUPPO, 0xffff}, /* power per rate from sromrev 9 */ - {"cckbw202gpo", 0xfffffe00, 0, SROM9_2GPO_CCKBW20, 0xffff}, - {"cckbw20ul2gpo", 0xfffffe00, 0, SROM9_2GPO_CCKBW20UL, 0xffff}, - {"legofdmbw202gpo", 0xfffffe00, SRFL_MORE, SROM9_2GPO_LOFDMBW20, - 0xffff}, - {"", 0, 0, SROM9_2GPO_LOFDMBW20 + 1, 0xffff}, - {"legofdmbw20ul2gpo", 0xfffffe00, SRFL_MORE, SROM9_2GPO_LOFDMBW20UL, + {BRCMS_SROM_CCKBW202GPO, 0xfffffe00, 0, SROM9_2GPO_CCKBW20, 0xffff}, + {BRCMS_SROM_CCKBW20UL2GPO, 0xfffffe00, 0, SROM9_2GPO_CCKBW20UL, 0xffff}, + {BRCMS_SROM_LEGOFDMBW202GPO, 0xfffffe00, SRFL_MORE, + SROM9_2GPO_LOFDMBW20, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_2GPO_LOFDMBW20 + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW20UL2GPO, 0xfffffe00, SRFL_MORE, + SROM9_2GPO_LOFDMBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_2GPO_LOFDMBW20UL + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW205GLPO, 0xfffffe00, SRFL_MORE, + SROM9_5GLPO_LOFDMBW20, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GLPO_LOFDMBW20 + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW20UL5GLPO, 0xfffffe00, SRFL_MORE, + SROM9_5GLPO_LOFDMBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GLPO_LOFDMBW20UL + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW205GMPO, 0xfffffe00, SRFL_MORE, + SROM9_5GMPO_LOFDMBW20, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GMPO_LOFDMBW20 + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW20UL5GMPO, 0xfffffe00, SRFL_MORE, + SROM9_5GMPO_LOFDMBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GMPO_LOFDMBW20UL + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW205GHPO, 0xfffffe00, SRFL_MORE, + SROM9_5GHPO_LOFDMBW20, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GHPO_LOFDMBW20 + 1, 0xffff}, + {BRCMS_SROM_LEGOFDMBW20UL5GHPO, 0xfffffe00, SRFL_MORE, + SROM9_5GHPO_LOFDMBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GHPO_LOFDMBW20UL + 1, 0xffff}, + {BRCMS_SROM_MCSBW202GPO, 0xfffffe00, SRFL_MORE, SROM9_2GPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_2GPO_LOFDMBW20UL + 1, 0xffff}, - {"legofdmbw205glpo", 0xfffffe00, SRFL_MORE, SROM9_5GLPO_LOFDMBW20, + {BRCMS_SROM_CONT, 0, 0, SROM9_2GPO_MCSBW20 + 1, 0xffff}, + {BRCMS_SROM_MCSBW20UL2GPO, 0xfffffe00, SRFL_MORE, SROM9_2GPO_MCSBW20UL, 0xffff}, - {"", 0, 0, SROM9_5GLPO_LOFDMBW20 + 1, 0xffff}, - {"legofdmbw20ul5glpo", 0xfffffe00, SRFL_MORE, SROM9_5GLPO_LOFDMBW20UL, + {BRCMS_SROM_CONT, 0, 0, SROM9_2GPO_MCSBW20UL + 1, 0xffff}, + {BRCMS_SROM_MCSBW402GPO, 0xfffffe00, SRFL_MORE, SROM9_2GPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GLPO_LOFDMBW20UL + 1, 0xffff}, - {"legofdmbw205gmpo", 0xfffffe00, SRFL_MORE, SROM9_5GMPO_LOFDMBW20, + {BRCMS_SROM_CONT, 0, 0, SROM9_2GPO_MCSBW40 + 1, 0xffff}, + {BRCMS_SROM_MCSBW205GLPO, 0xfffffe00, SRFL_MORE, SROM9_5GLPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_5GMPO_LOFDMBW20 + 1, 0xffff}, - {"legofdmbw20ul5gmpo", 0xfffffe00, SRFL_MORE, SROM9_5GMPO_LOFDMBW20UL, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GLPO_MCSBW20 + 1, 0xffff}, + {BRCMS_SROM_MCSBW20UL5GLPO, 0xfffffe00, SRFL_MORE, + SROM9_5GLPO_MCSBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GLPO_MCSBW20UL + 1, 0xffff}, + {BRCMS_SROM_MCSBW405GLPO, 0xfffffe00, SRFL_MORE, SROM9_5GLPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GMPO_LOFDMBW20UL + 1, 0xffff}, - {"legofdmbw205ghpo", 0xfffffe00, SRFL_MORE, SROM9_5GHPO_LOFDMBW20, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GLPO_MCSBW40 + 1, 0xffff}, + {BRCMS_SROM_MCSBW205GMPO, 0xfffffe00, SRFL_MORE, SROM9_5GMPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_5GHPO_LOFDMBW20 + 1, 0xffff}, - {"legofdmbw20ul5ghpo", 0xfffffe00, SRFL_MORE, SROM9_5GHPO_LOFDMBW20UL, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GMPO_MCSBW20 + 1, 0xffff}, + {BRCMS_SROM_MCSBW20UL5GMPO, 0xfffffe00, SRFL_MORE, + SROM9_5GMPO_MCSBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GMPO_MCSBW20UL + 1, 0xffff}, + {BRCMS_SROM_MCSBW405GMPO, 0xfffffe00, SRFL_MORE, SROM9_5GMPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GHPO_LOFDMBW20UL + 1, 0xffff}, - {"mcsbw202gpo", 0xfffffe00, SRFL_MORE, SROM9_2GPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_2GPO_MCSBW20 + 1, 0xffff}, - {"mcsbw20ul2gpo", 0xfffffe00, SRFL_MORE, SROM9_2GPO_MCSBW20UL, 0xffff}, - {"", 0, 0, SROM9_2GPO_MCSBW20UL + 1, 0xffff}, - {"mcsbw402gpo", 0xfffffe00, SRFL_MORE, SROM9_2GPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_2GPO_MCSBW40 + 1, 0xffff}, - {"mcsbw205glpo", 0xfffffe00, SRFL_MORE, SROM9_5GLPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_5GLPO_MCSBW20 + 1, 0xffff}, - {"mcsbw20ul5glpo", 0xfffffe00, SRFL_MORE, SROM9_5GLPO_MCSBW20UL, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GMPO_MCSBW40 + 1, 0xffff}, + {BRCMS_SROM_MCSBW205GHPO, 0xfffffe00, SRFL_MORE, SROM9_5GHPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_5GLPO_MCSBW20UL + 1, 0xffff}, - {"mcsbw405glpo", 0xfffffe00, SRFL_MORE, SROM9_5GLPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GLPO_MCSBW40 + 1, 0xffff}, - {"mcsbw205gmpo", 0xfffffe00, SRFL_MORE, SROM9_5GMPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_5GMPO_MCSBW20 + 1, 0xffff}, - {"mcsbw20ul5gmpo", 0xfffffe00, SRFL_MORE, SROM9_5GMPO_MCSBW20UL, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GHPO_MCSBW20 + 1, 0xffff}, + {BRCMS_SROM_MCSBW20UL5GHPO, 0xfffffe00, SRFL_MORE, + SROM9_5GHPO_MCSBW20UL, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GHPO_MCSBW20UL + 1, 0xffff}, + {BRCMS_SROM_MCSBW405GHPO, 0xfffffe00, SRFL_MORE, SROM9_5GHPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GMPO_MCSBW20UL + 1, 0xffff}, - {"mcsbw405gmpo", 0xfffffe00, SRFL_MORE, SROM9_5GMPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GMPO_MCSBW40 + 1, 0xffff}, - {"mcsbw205ghpo", 0xfffffe00, SRFL_MORE, SROM9_5GHPO_MCSBW20, 0xffff}, - {"", 0, 0, SROM9_5GHPO_MCSBW20 + 1, 0xffff}, - {"mcsbw20ul5ghpo", 0xfffffe00, SRFL_MORE, SROM9_5GHPO_MCSBW20UL, - 0xffff}, - {"", 0, 0, SROM9_5GHPO_MCSBW20UL + 1, 0xffff}, - {"mcsbw405ghpo", 0xfffffe00, SRFL_MORE, SROM9_5GHPO_MCSBW40, 0xffff}, - {"", 0, 0, SROM9_5GHPO_MCSBW40 + 1, 0xffff}, - {"mcs32po", 0xfffffe00, 0, SROM9_PO_MCS32, 0xffff}, - {"legofdm40duppo", 0xfffffe00, 0, SROM9_PO_LOFDM40DUP, 0xffff}, + {BRCMS_SROM_CONT, 0, 0, SROM9_5GHPO_MCSBW40 + 1, 0xffff}, + {BRCMS_SROM_MCS32PO, 0xfffffe00, 0, SROM9_PO_MCS32, 0xffff}, + {BRCMS_SROM_LEGOFDM40DUPPO, 0xfffffe00, 0, SROM9_PO_LOFDM40DUP, 0xffff}, - {NULL, 0, 0, 0, 0} + {BRCMS_SROM_NULL, 0, 0, 0, 0} }; static const struct brcms_sromvar perpath_pci_sromvars[] = { - {"maxp2ga", 0x000000f0, 0, SROM4_2G_ITT_MAXP, 0x00ff}, - {"itt2ga", 0x000000f0, 0, SROM4_2G_ITT_MAXP, 0xff00}, - {"itt5ga", 0x000000f0, 0, SROM4_5G_ITT_MAXP, 0xff00}, - {"pa2gw0a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA, 0xffff}, - {"pa2gw1a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 1, 0xffff}, - {"pa2gw2a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 2, 0xffff}, - {"pa2gw3a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 3, 0xffff}, - {"maxp5ga", 0x000000f0, 0, SROM4_5G_ITT_MAXP, 0x00ff}, - {"maxp5gha", 0x000000f0, 0, SROM4_5GLH_MAXP, 0x00ff}, - {"maxp5gla", 0x000000f0, 0, SROM4_5GLH_MAXP, 0xff00}, - {"pa5gw0a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA, 0xffff}, - {"pa5gw1a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 1, 0xffff}, - {"pa5gw2a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 2, 0xffff}, - {"pa5gw3a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 3, 0xffff}, - {"pa5glw0a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA, 0xffff}, - {"pa5glw1a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 1, 0xffff}, - {"pa5glw2a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 2, 0xffff}, - {"pa5glw3a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 3, 0xffff}, - {"pa5ghw0a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA, 0xffff}, - {"pa5ghw1a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 1, 0xffff}, - {"pa5ghw2a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 2, 0xffff}, - {"pa5ghw3a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 3, 0xffff}, - {"maxp2ga", 0xffffff00, 0, SROM8_2G_ITT_MAXP, 0x00ff}, - {"itt2ga", 0xffffff00, 0, SROM8_2G_ITT_MAXP, 0xff00}, - {"itt5ga", 0xffffff00, 0, SROM8_5G_ITT_MAXP, 0xff00}, - {"pa2gw0a", 0xffffff00, SRFL_PRHEX, SROM8_2G_PA, 0xffff}, - {"pa2gw1a", 0xffffff00, SRFL_PRHEX, SROM8_2G_PA + 1, 0xffff}, - {"pa2gw2a", 0xffffff00, SRFL_PRHEX, SROM8_2G_PA + 2, 0xffff}, - {"maxp5ga", 0xffffff00, 0, SROM8_5G_ITT_MAXP, 0x00ff}, - {"maxp5gha", 0xffffff00, 0, SROM8_5GLH_MAXP, 0x00ff}, - {"maxp5gla", 0xffffff00, 0, SROM8_5GLH_MAXP, 0xff00}, - {"pa5gw0a", 0xffffff00, SRFL_PRHEX, SROM8_5G_PA, 0xffff}, - {"pa5gw1a", 0xffffff00, SRFL_PRHEX, SROM8_5G_PA + 1, 0xffff}, - {"pa5gw2a", 0xffffff00, SRFL_PRHEX, SROM8_5G_PA + 2, 0xffff}, - {"pa5glw0a", 0xffffff00, SRFL_PRHEX, SROM8_5GL_PA, 0xffff}, - {"pa5glw1a", 0xffffff00, SRFL_PRHEX, SROM8_5GL_PA + 1, 0xffff}, - {"pa5glw2a", 0xffffff00, SRFL_PRHEX, SROM8_5GL_PA + 2, 0xffff}, - {"pa5ghw0a", 0xffffff00, SRFL_PRHEX, SROM8_5GH_PA, 0xffff}, - {"pa5ghw1a", 0xffffff00, SRFL_PRHEX, SROM8_5GH_PA + 1, 0xffff}, - {"pa5ghw2a", 0xffffff00, SRFL_PRHEX, SROM8_5GH_PA + 2, 0xffff}, - {NULL, 0, 0, 0, 0} + {BRCMS_SROM_MAXP2GA0, 0x000000f0, 0, SROM4_2G_ITT_MAXP, 0x00ff}, + {BRCMS_SROM_ITT2GA0, 0x000000f0, 0, SROM4_2G_ITT_MAXP, 0xff00}, + {BRCMS_SROM_ITT5GA0, 0x000000f0, 0, SROM4_5G_ITT_MAXP, 0xff00}, + {BRCMS_SROM_PA2GW0A0, 0x000000f0, SRFL_PRHEX, SROM4_2G_PA, 0xffff}, + {BRCMS_SROM_PA2GW1A0, 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 1, 0xffff}, + {BRCMS_SROM_PA2GW2A0, 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 2, 0xffff}, + {BRCMS_SROM_PA2GW3A0, 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 3, 0xffff}, + {BRCMS_SROM_MAXP5GA0, 0x000000f0, 0, SROM4_5G_ITT_MAXP, 0x00ff}, + {BRCMS_SROM_MAXP5GHA0, 0x000000f0, 0, SROM4_5GLH_MAXP, 0x00ff}, + {BRCMS_SROM_MAXP5GLA0, 0x000000f0, 0, SROM4_5GLH_MAXP, 0xff00}, + {BRCMS_SROM_PA5GW0A0, 0x000000f0, SRFL_PRHEX, SROM4_5G_PA, 0xffff}, + {BRCMS_SROM_PA5GW1A0, 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 1, 0xffff}, + {BRCMS_SROM_PA5GW2A0, 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 2, 0xffff}, + {BRCMS_SROM_PA5GW3A0, 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 3, 0xffff}, + {BRCMS_SROM_PA5GLW0A0, 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA, 0xffff}, + {BRCMS_SROM_PA5GLW1A0, 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 1, + 0xffff}, + {BRCMS_SROM_PA5GLW2A0, 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 2, + 0xffff}, + {BRCMS_SROM_PA5GLW3A0, 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 3, + 0xffff}, + {BRCMS_SROM_PA5GHW0A0, 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA, 0xffff}, + {BRCMS_SROM_PA5GHW1A0, 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 1, + 0xffff}, + {BRCMS_SROM_PA5GHW2A0, 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 2, + 0xffff}, + {BRCMS_SROM_PA5GHW3A0, 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 3, + 0xffff}, + {BRCMS_SROM_MAXP2GA0, 0xffffff00, 0, SROM8_2G_ITT_MAXP, 0x00ff}, + {BRCMS_SROM_ITT2GA0, 0xffffff00, 0, SROM8_2G_ITT_MAXP, 0xff00}, + {BRCMS_SROM_ITT5GA0, 0xffffff00, 0, SROM8_5G_ITT_MAXP, 0xff00}, + {BRCMS_SROM_PA2GW0A0, 0xffffff00, SRFL_PRHEX, SROM8_2G_PA, 0xffff}, + {BRCMS_SROM_PA2GW1A0, 0xffffff00, SRFL_PRHEX, SROM8_2G_PA + 1, 0xffff}, + {BRCMS_SROM_PA2GW2A0, 0xffffff00, SRFL_PRHEX, SROM8_2G_PA + 2, 0xffff}, + {BRCMS_SROM_MAXP5GA0, 0xffffff00, 0, SROM8_5G_ITT_MAXP, 0x00ff}, + {BRCMS_SROM_MAXP5GHA0, 0xffffff00, 0, SROM8_5GLH_MAXP, 0x00ff}, + {BRCMS_SROM_MAXP5GLA0, 0xffffff00, 0, SROM8_5GLH_MAXP, 0xff00}, + {BRCMS_SROM_PA5GW0A0, 0xffffff00, SRFL_PRHEX, SROM8_5G_PA, 0xffff}, + {BRCMS_SROM_PA5GW1A0, 0xffffff00, SRFL_PRHEX, SROM8_5G_PA + 1, 0xffff}, + {BRCMS_SROM_PA5GW2A0, 0xffffff00, SRFL_PRHEX, SROM8_5G_PA + 2, 0xffff}, + {BRCMS_SROM_PA5GLW0A0, 0xffffff00, SRFL_PRHEX, SROM8_5GL_PA, 0xffff}, + {BRCMS_SROM_PA5GLW1A0, 0xffffff00, SRFL_PRHEX, SROM8_5GL_PA + 1, + 0xffff}, + {BRCMS_SROM_PA5GLW2A0, 0xffffff00, SRFL_PRHEX, SROM8_5GL_PA + 2, + 0xffff}, + {BRCMS_SROM_PA5GHW0A0, 0xffffff00, SRFL_PRHEX, SROM8_5GH_PA, 0xffff}, + {BRCMS_SROM_PA5GHW1A0, 0xffffff00, SRFL_PRHEX, SROM8_5GH_PA + 1, + 0xffff}, + {BRCMS_SROM_PA5GHW2A0, 0xffffff00, SRFL_PRHEX, SROM8_5GH_PA + 2, + 0xffff}, + {BRCMS_SROM_NULL, 0, 0, 0, 0} }; -/* crc table has the same contents for every device instance, so it can be - * shared between devices. */ -static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE]; - -static u16 __iomem * -srom_window_address(struct si_pub *sih, u8 __iomem *curmap) -{ - if (sih->ccrev < 32) - return (u16 __iomem *)(curmap + PCI_BAR0_SPROM_OFFSET); - if (sih->cccaps & CC_CAP_SROM) - return (u16 __iomem *) - (curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP); - - return NULL; -} - -/* Parse SROM and create name=value pairs. 'srom' points to - * the SROM word array. 'off' specifies the offset of the - * first word 'srom' points to, which should be either 0 or - * SROM3_SWRG_OFF (full SROM or software region). - */ - -static uint mask_shift(u16 mask) -{ - uint i; - for (i = 0; i < (sizeof(mask) << 3); i++) { - if (mask & (1 << i)) - return i; - } - return 0; -} - -static uint mask_width(u16 mask) -{ - int i; - for (i = (sizeof(mask) << 3) - 1; i >= 0; i--) { - if (mask & (1 << i)) - return (uint) (i - mask_shift(mask) + 1); - } - return 0; -} - -static inline void ltoh16_buf(u16 *buf, unsigned int size) -{ - size /= 2; - while (size--) - *(buf + size) = le16_to_cpu(*(__le16 *)(buf + size)); -} - -static inline void htol16_buf(u16 *buf, unsigned int size) -{ - size /= 2; - while (size--) - *(__le16 *)(buf + size) = cpu_to_le16(*(buf + size)); -} - -/* Initialization of varbuf structure */ -static void varbuf_init(struct brcms_varbuf *b, char *buf, uint size) -{ - b->size = size; - b->base = b->buf = buf; -} - -/* append a null terminated var=value string */ -static int varbuf_append(struct brcms_varbuf *b, const char *fmt, ...) -{ - va_list ap; - int r; - size_t len; - char *s; - - if (b->size < 2) - return 0; - - va_start(ap, fmt); - r = vsnprintf(b->buf, b->size, fmt, ap); - va_end(ap); - - /* - * C99 snprintf behavior returns r >= size on overflow, - * others return -1 on overflow. All return -1 on format error. - * We need to leave room for 2 null terminations, one for the current - * var string, and one for final null of the var table. So check that - * the strlen written, r, leaves room for 2 chars. - */ - if ((r == -1) || (r > (int)(b->size - 2))) { - b->size = 0; - return 0; - } - - /* Remove any earlier occurrence of the same variable */ - s = strchr(b->buf, '='); - if (s != NULL) { - len = (size_t) (s - b->buf); - for (s = b->base; s < b->buf;) { - if ((memcmp(s, b->buf, len) == 0) && s[len] == '=') { - len = strlen(s) + 1; - memmove(s, (s + len), - ((b->buf + r + 1) - (s + len))); - b->buf -= len; - b->size += (unsigned int)len; - break; - } - - while (*s++) - ; - } - } - - /* skip over this string's null termination */ - r++; - b->size -= r; - b->buf += r; - - return r; -} - -static void -_initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) -{ - u16 w; - u32 val; - const struct brcms_sromvar *srv; - uint width; - uint flags; - u32 sr = (1 << sromrev); - - varbuf_append(b, "sromrev=%d", sromrev); - - for (srv = pci_sromvars; srv->name != NULL; srv++) { - const char *name; - - if ((srv->revmask & sr) == 0) - continue; - - if (srv->off < off) - continue; - - flags = srv->flags; - name = srv->name; - - /* This entry is for mfgc only. Don't generate param for it, */ - if (flags & SRFL_NOVAR) - continue; - - if (flags & SRFL_ETHADDR) { - u8 ea[ETH_ALEN]; - - ea[0] = (srom[srv->off - off] >> 8) & 0xff; - ea[1] = srom[srv->off - off] & 0xff; - ea[2] = (srom[srv->off + 1 - off] >> 8) & 0xff; - ea[3] = srom[srv->off + 1 - off] & 0xff; - ea[4] = (srom[srv->off + 2 - off] >> 8) & 0xff; - ea[5] = srom[srv->off + 2 - off] & 0xff; - - varbuf_append(b, "%s=%pM", name, ea); - } else { - w = srom[srv->off - off]; - val = (w & srv->mask) >> mask_shift(srv->mask); - width = mask_width(srv->mask); - - while (srv->flags & SRFL_MORE) { - srv++; - if (srv->off == 0 || srv->off < off) - continue; - - w = srom[srv->off - off]; - val += - ((w & srv->mask) >> mask_shift(srv-> - mask)) << - width; - width += mask_width(srv->mask); - } - - if ((flags & SRFL_NOFFS) - && ((int)val == (1 << width) - 1)) - continue; - - if (flags & SRFL_CCODE) { - if (val == 0) - varbuf_append(b, "ccode="); - else - varbuf_append(b, "ccode=%c%c", - (val >> 8), (val & 0xff)); - } - /* LED Powersave duty cycle has to be scaled: - *(oncount >> 24) (offcount >> 8) - */ - else if (flags & SRFL_LEDDC) { - u32 w32 = /* oncount */ - (((val >> 8) & 0xff) << 24) | - /* offcount */ - (((val & 0xff)) << 8); - varbuf_append(b, "leddc=%d", w32); - } else if (flags & SRFL_PRHEX) - varbuf_append(b, "%s=0x%x", name, val); - else if ((flags & SRFL_PRSIGN) - && (val & (1 << (width - 1)))) - varbuf_append(b, "%s=%d", name, - (int)(val | (~0 << width))); - else - varbuf_append(b, "%s=%u", name, val); - } - } - - if (sromrev >= 4) { - /* Do per-path variables */ - uint p, pb, psz; - - if (sromrev >= 8) { - pb = SROM8_PATH0; - psz = SROM8_PATH1 - SROM8_PATH0; - } else { - pb = SROM4_PATH0; - psz = SROM4_PATH1 - SROM4_PATH0; - } - - for (p = 0; p < MAX_PATH_SROM; p++) { - for (srv = perpath_pci_sromvars; srv->name != NULL; - srv++) { - if ((srv->revmask & sr) == 0) - continue; - - if (pb + srv->off < off) - continue; - - if (srv->flags & SRFL_NOVAR) - continue; - - w = srom[pb + srv->off - off]; - val = (w & srv->mask) >> mask_shift(srv->mask); - width = mask_width(srv->mask); - - /* Cheating: no per-path var is more than - * 1 word */ - if ((srv->flags & SRFL_NOFFS) - && ((int)val == (1 << width) - 1)) - continue; - - if (srv->flags & SRFL_PRHEX) - varbuf_append(b, "%s%d=0x%x", srv->name, - p, val); - else - varbuf_append(b, "%s%d=%d", srv->name, - p, val); - } - pb += psz; - } - } -} - -/* - * Read in and validate sprom. - * Return 0 on success, nonzero on error. - */ -static int -sprom_read_pci(struct si_pub *sih, u16 __iomem *sprom, uint wordoff, - u16 *buf, uint nwords, bool check_crc) -{ - int err = 0; - uint i; - - /* read the sprom */ - for (i = 0; i < nwords; i++) - buf[i] = R_REG(&sprom[wordoff + i]); - - if (check_crc) { - - if (buf[0] == 0xffff) - /* - * The hardware thinks that an srom that starts with - * 0xffff is blank, regardless of the rest of the - * content, so declare it bad. - */ - return -ENODATA; - - /* fixup the endianness so crc8 will pass */ - htol16_buf(buf, nwords * 2); - if (crc8(brcms_srom_crc8_table, (u8 *) buf, nwords * 2, - CRC8_INIT_VALUE) != - CRC8_GOOD_VALUE(brcms_srom_crc8_table)) - /* DBG only pci always read srom4 first, then srom8/9 */ - err = -EIO; - - /* now correct the endianness of the byte array */ - ltoh16_buf(buf, nwords * 2); - } - return err; -} - -static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz) -{ - u8 *otp; - uint sz = OTP_SZ_MAX / 2; /* size in words */ - int err = 0; - - otp = kzalloc(OTP_SZ_MAX, GFP_ATOMIC); - if (otp == NULL) - return -ENOMEM; - - err = otp_read_region(sih, OTP_HW_RGN, (u16 *) otp, &sz); - - memcpy(buf, otp, bufsz); - - kfree(otp); - - /* Check CRC */ - if (buf[0] == 0xffff) - /* The hardware thinks that an srom that starts with 0xffff - * is blank, regardless of the rest of the content, so declare - * it bad. - */ - return -ENODATA; - - /* fixup the endianness so crc8 will pass */ - htol16_buf(buf, bufsz); - if (crc8(brcms_srom_crc8_table, (u8 *) buf, SROM4_WORDS * 2, - CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(brcms_srom_crc8_table)) - err = -EIO; - - /* now correct the endianness of the byte array */ - ltoh16_buf(buf, bufsz); - - return err; -} - -/* -* Create variable table from memory. -* Return 0 on success, nonzero on error. -*/ -static int initvars_table(char *start, char *end, - char **vars, uint *count) -{ - int c = (int)(end - start); - - /* do it only when there is more than just the null string */ - if (c > 1) { - char *vp = kmalloc(c, GFP_ATOMIC); - if (!vp) - return -ENOMEM; - memcpy(vp, start, c); - *vars = vp; - *count = c; - } else { - *vars = NULL; - *count = 0; - } - - return 0; -} - -/* - * Initialize nonvolatile variable table from sprom. - * Return 0 on success, nonzero on error. - */ -static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, - char **vars, uint *count) -{ - u16 *srom; - u16 __iomem *sromwindow; - u8 sromrev = 0; - u32 sr; - struct brcms_varbuf b; - char *vp, *base = NULL; - int err = 0; - - /* - * Apply CRC over SROM content regardless SROM is present or not. - */ - srom = kmalloc(SROM_MAX, GFP_ATOMIC); - if (!srom) - return -ENOMEM; - - sromwindow = srom_window_address(sih, curmap); - - crc8_populate_lsb(brcms_srom_crc8_table, SROM_CRC8_POLY); - if (ai_is_sprom_available(sih)) { - err = sprom_read_pci(sih, sromwindow, 0, srom, SROM_WORDS, - true); - - if ((srom[SROM4_SIGN] == SROM4_SIGNATURE) || - (((sih->buscoretype == PCIE_CORE_ID) - && (sih->buscorerev >= 6)) - || ((sih->buscoretype == PCI_CORE_ID) - && (sih->buscorerev >= 0xe)))) { - /* sromrev >= 4, read more */ - err = sprom_read_pci(sih, sromwindow, 0, srom, - SROM4_WORDS, true); - sromrev = srom[SROM4_CRCREV] & 0xff; - } else if (err == 0) { - /* srom is good and is rev < 4 */ - /* top word of sprom contains version and crc8 */ - sromrev = srom[SROM_CRCREV] & 0xff; - /* bcm4401 sroms misprogrammed */ - if (sromrev == 0x10) - sromrev = 1; - } - } else { - /* Use OTP if SPROM not available */ - err = otp_read_pci(sih, srom, SROM_MAX); - if (err == 0) - /* OTP only contain SROM rev8/rev9 for now */ - sromrev = srom[SROM4_CRCREV] & 0xff; - } - - if (!err) { - /* Bitmask for the sromrev */ - sr = 1 << sromrev; - - /* - * srom version check: Current valid versions: 1, 2, 3, 4, 5, 8, - * 9 - */ - if ((sr & 0x33e) == 0) { - err = -EINVAL; - goto errout; - } - - base = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC); - if (!base) { - err = -ENOMEM; - goto errout; - } - - varbuf_init(&b, base, MAXSZ_NVRAM_VARS); - - /* parse SROM into name=value pairs. */ - _initvars_srom_pci(sromrev, srom, 0, &b); - - /* final nullbyte terminator */ - vp = b.buf; - *vp++ = '\0'; - - err = initvars_table(base, vp, vars, count); - kfree(base); - } - -errout: - kfree(srom); - return err; -} - -/* - * Initialize local vars from the right source for this platform. - * Return 0 on success, nonzero on error. - */ -int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, - uint *count) -{ - uint len; - - len = 0; - - if (vars == NULL || count == NULL) - return 0; - - *vars = NULL; - *count = 0; - - if (curmap != NULL) - return initvars_srom_pci(sih, curmap, vars, count); - - return -EINVAL; -} - -struct srom_id_name { - enum brcms_srom_id id; - const char *name; -}; +struct srom_id_name { + enum brcms_srom_id id; + const char *name; +}; static const struct srom_id_name srom_id_map[] = { { BRCMS_SROM_AA2G, "aa2g" }, @@ -1516,6 +1106,473 @@ static const char *get_varname(enum brcms_srom_id id) return NULL; } +/* crc table has the same contents for every device instance, so it can be + * shared between devices. */ +static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE]; + +static u16 __iomem * +srom_window_address(struct si_pub *sih, u8 __iomem *curmap) +{ + if (sih->ccrev < 32) + return (u16 __iomem *)(curmap + PCI_BAR0_SPROM_OFFSET); + if (sih->cccaps & CC_CAP_SROM) + return (u16 __iomem *) + (curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP); + + return NULL; +} + +/* Parse SROM and create name=value pairs. 'srom' points to + * the SROM word array. 'off' specifies the offset of the + * first word 'srom' points to, which should be either 0 or + * SROM3_SWRG_OFF (full SROM or software region). + */ + +static uint mask_shift(u16 mask) +{ + uint i; + for (i = 0; i < (sizeof(mask) << 3); i++) { + if (mask & (1 << i)) + return i; + } + return 0; +} + +static uint mask_width(u16 mask) +{ + int i; + for (i = (sizeof(mask) << 3) - 1; i >= 0; i--) { + if (mask & (1 << i)) + return (uint) (i - mask_shift(mask) + 1); + } + return 0; +} + +static inline void ltoh16_buf(u16 *buf, unsigned int size) +{ + size /= 2; + while (size--) + *(buf + size) = le16_to_cpu(*(__le16 *)(buf + size)); +} + +static inline void htol16_buf(u16 *buf, unsigned int size) +{ + size /= 2; + while (size--) + *(__le16 *)(buf + size) = cpu_to_le16(*(buf + size)); +} + +/* Initialization of varbuf structure */ +static void varbuf_init(struct brcms_varbuf *b, char *buf, uint size) +{ + b->size = size; + b->base = b->buf = buf; +} + +/* append a null terminated var=value string */ +static int varbuf_append(struct brcms_varbuf *b, const char *fmt, ...) +{ + va_list ap; + int r; + size_t len; + char *s; + + if (b->size < 2) + return 0; + + va_start(ap, fmt); + r = vsnprintf(b->buf, b->size, fmt, ap); + va_end(ap); + + /* + * C99 snprintf behavior returns r >= size on overflow, + * others return -1 on overflow. All return -1 on format error. + * We need to leave room for 2 null terminations, one for the current + * var string, and one for final null of the var table. So check that + * the strlen written, r, leaves room for 2 chars. + */ + if ((r == -1) || (r > (int)(b->size - 2))) { + b->size = 0; + return 0; + } + + /* Remove any earlier occurrence of the same variable */ + s = strchr(b->buf, '='); + if (s != NULL) { + len = (size_t) (s - b->buf); + for (s = b->base; s < b->buf;) { + if ((memcmp(s, b->buf, len) == 0) && s[len] == '=') { + len = strlen(s) + 1; + memmove(s, (s + len), + ((b->buf + r + 1) - (s + len))); + b->buf -= len; + b->size += (unsigned int)len; + break; + } + + while (*s++) + ; + } + } + + /* skip over this string's null termination */ + r++; + b->size -= r; + b->buf += r; + + return r; +} + +static void +_initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) +{ + u16 w; + u32 val; + const struct brcms_sromvar *srv; + uint width; + uint flags; + u32 sr = (1 << sromrev); + + varbuf_append(b, "sromrev=%d", sromrev); + + for (srv = pci_sromvars; srv->varid != BRCMS_SROM_NULL; srv++) { + const char *name; + + if ((srv->revmask & sr) == 0) + continue; + + if (srv->off < off) + continue; + + flags = srv->flags; + name = get_varname(srv->varid); + + /* This entry is for mfgc only. Don't generate param for it, */ + if (flags & SRFL_NOVAR) + continue; + + if (flags & SRFL_ETHADDR) { + u8 ea[ETH_ALEN]; + + ea[0] = (srom[srv->off - off] >> 8) & 0xff; + ea[1] = srom[srv->off - off] & 0xff; + ea[2] = (srom[srv->off + 1 - off] >> 8) & 0xff; + ea[3] = srom[srv->off + 1 - off] & 0xff; + ea[4] = (srom[srv->off + 2 - off] >> 8) & 0xff; + ea[5] = srom[srv->off + 2 - off] & 0xff; + + varbuf_append(b, "%s=%pM", name, ea); + } else { + w = srom[srv->off - off]; + val = (w & srv->mask) >> mask_shift(srv->mask); + width = mask_width(srv->mask); + + while (srv->flags & SRFL_MORE) { + srv++; + if (srv->off == 0 || srv->off < off) + continue; + + w = srom[srv->off - off]; + val += + ((w & srv->mask) >> mask_shift(srv-> + mask)) << + width; + width += mask_width(srv->mask); + } + + if ((flags & SRFL_NOFFS) + && ((int)val == (1 << width) - 1)) + continue; + + if (flags & SRFL_CCODE) { + if (val == 0) + varbuf_append(b, "ccode="); + else + varbuf_append(b, "ccode=%c%c", + (val >> 8), (val & 0xff)); + } + /* LED Powersave duty cycle has to be scaled: + *(oncount >> 24) (offcount >> 8) + */ + else if (flags & SRFL_LEDDC) { + u32 w32 = /* oncount */ + (((val >> 8) & 0xff) << 24) | + /* offcount */ + (((val & 0xff)) << 8); + varbuf_append(b, "leddc=%d", w32); + } else if (flags & SRFL_PRHEX) + varbuf_append(b, "%s=0x%x", name, val); + else if ((flags & SRFL_PRSIGN) + && (val & (1 << (width - 1)))) + varbuf_append(b, "%s=%d", name, + (int)(val | (~0 << width))); + else + varbuf_append(b, "%s=%u", name, val); + } + } + + if (sromrev >= 4) { + /* Do per-path variables */ + uint p, pb, psz; + + if (sromrev >= 8) { + pb = SROM8_PATH0; + psz = SROM8_PATH1 - SROM8_PATH0; + } else { + pb = SROM4_PATH0; + psz = SROM4_PATH1 - SROM4_PATH0; + } + + for (p = 0; p < MAX_PATH_SROM; p++) { + for (srv = perpath_pci_sromvars; + srv->varid != BRCMS_SROM_NULL; srv++) { + if ((srv->revmask & sr) == 0) + continue; + + if (pb + srv->off < off) + continue; + + if (srv->flags & SRFL_NOVAR) + continue; + + w = srom[pb + srv->off - off]; + val = (w & srv->mask) >> mask_shift(srv->mask); + width = mask_width(srv->mask); + + /* Cheating: no per-path var is more than + * 1 word */ + if ((srv->flags & SRFL_NOFFS) + && ((int)val == (1 << width) - 1)) + continue; + + if (srv->flags & SRFL_PRHEX) + varbuf_append(b, "%s%d=0x%x", + get_varname(srv->varid), + p, val); + else + varbuf_append(b, "%s%d=%d", + get_varname(srv->varid), + p, val); + } + pb += psz; + } + } +} + +/* + * Read in and validate sprom. + * Return 0 on success, nonzero on error. + */ +static int +sprom_read_pci(struct si_pub *sih, u16 __iomem *sprom, uint wordoff, + u16 *buf, uint nwords, bool check_crc) +{ + int err = 0; + uint i; + + /* read the sprom */ + for (i = 0; i < nwords; i++) + buf[i] = R_REG(&sprom[wordoff + i]); + + if (check_crc) { + + if (buf[0] == 0xffff) + /* + * The hardware thinks that an srom that starts with + * 0xffff is blank, regardless of the rest of the + * content, so declare it bad. + */ + return -ENODATA; + + /* fixup the endianness so crc8 will pass */ + htol16_buf(buf, nwords * 2); + if (crc8(brcms_srom_crc8_table, (u8 *) buf, nwords * 2, + CRC8_INIT_VALUE) != + CRC8_GOOD_VALUE(brcms_srom_crc8_table)) + /* DBG only pci always read srom4 first, then srom8/9 */ + err = -EIO; + + /* now correct the endianness of the byte array */ + ltoh16_buf(buf, nwords * 2); + } + return err; +} + +static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz) +{ + u8 *otp; + uint sz = OTP_SZ_MAX / 2; /* size in words */ + int err = 0; + + otp = kzalloc(OTP_SZ_MAX, GFP_ATOMIC); + if (otp == NULL) + return -ENOMEM; + + err = otp_read_region(sih, OTP_HW_RGN, (u16 *) otp, &sz); + + memcpy(buf, otp, bufsz); + + kfree(otp); + + /* Check CRC */ + if (buf[0] == 0xffff) + /* The hardware thinks that an srom that starts with 0xffff + * is blank, regardless of the rest of the content, so declare + * it bad. + */ + return -ENODATA; + + /* fixup the endianness so crc8 will pass */ + htol16_buf(buf, bufsz); + if (crc8(brcms_srom_crc8_table, (u8 *) buf, SROM4_WORDS * 2, + CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(brcms_srom_crc8_table)) + err = -EIO; + + /* now correct the endianness of the byte array */ + ltoh16_buf(buf, bufsz); + + return err; +} + +/* +* Create variable table from memory. +* Return 0 on success, nonzero on error. +*/ +static int initvars_table(char *start, char *end, + char **vars, uint *count) +{ + int c = (int)(end - start); + + /* do it only when there is more than just the null string */ + if (c > 1) { + char *vp = kmalloc(c, GFP_ATOMIC); + if (!vp) + return -ENOMEM; + memcpy(vp, start, c); + *vars = vp; + *count = c; + } else { + *vars = NULL; + *count = 0; + } + + return 0; +} + +/* + * Initialize nonvolatile variable table from sprom. + * Return 0 on success, nonzero on error. + */ +static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, + char **vars, uint *count) +{ + u16 *srom; + u16 __iomem *sromwindow; + u8 sromrev = 0; + u32 sr; + struct brcms_varbuf b; + char *vp, *base = NULL; + int err = 0; + + /* + * Apply CRC over SROM content regardless SROM is present or not. + */ + srom = kmalloc(SROM_MAX, GFP_ATOMIC); + if (!srom) + return -ENOMEM; + + sromwindow = srom_window_address(sih, curmap); + + crc8_populate_lsb(brcms_srom_crc8_table, SROM_CRC8_POLY); + if (ai_is_sprom_available(sih)) { + err = sprom_read_pci(sih, sromwindow, 0, srom, SROM_WORDS, + true); + + if ((srom[SROM4_SIGN] == SROM4_SIGNATURE) || + (((sih->buscoretype == PCIE_CORE_ID) + && (sih->buscorerev >= 6)) + || ((sih->buscoretype == PCI_CORE_ID) + && (sih->buscorerev >= 0xe)))) { + /* sromrev >= 4, read more */ + err = sprom_read_pci(sih, sromwindow, 0, srom, + SROM4_WORDS, true); + sromrev = srom[SROM4_CRCREV] & 0xff; + } else if (err == 0) { + /* srom is good and is rev < 4 */ + /* top word of sprom contains version and crc8 */ + sromrev = srom[SROM_CRCREV] & 0xff; + /* bcm4401 sroms misprogrammed */ + if (sromrev == 0x10) + sromrev = 1; + } + } else { + /* Use OTP if SPROM not available */ + err = otp_read_pci(sih, srom, SROM_MAX); + if (err == 0) + /* OTP only contain SROM rev8/rev9 for now */ + sromrev = srom[SROM4_CRCREV] & 0xff; + } + + if (!err) { + /* Bitmask for the sromrev */ + sr = 1 << sromrev; + + /* + * srom version check: Current valid versions: 1, 2, 3, 4, 5, 8, + * 9 + */ + if ((sr & 0x33e) == 0) { + err = -EINVAL; + goto errout; + } + + base = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC); + if (!base) { + err = -ENOMEM; + goto errout; + } + + varbuf_init(&b, base, MAXSZ_NVRAM_VARS); + + /* parse SROM into name=value pairs. */ + _initvars_srom_pci(sromrev, srom, 0, &b); + + /* final nullbyte terminator */ + vp = b.buf; + *vp++ = '\0'; + + err = initvars_table(base, vp, vars, count); + kfree(base); + } + +errout: + kfree(srom); + return err; +} + +/* + * Initialize local vars from the right source for this platform. + * Return 0 on success, nonzero on error. + */ +int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, + uint *count) +{ + uint len; + + len = 0; + + if (vars == NULL || count == NULL) + return 0; + + *vars = NULL; + *count = 0; + + if (curmap != NULL) + return initvars_srom_pci(sih, curmap, vars, count); + + return -EINVAL; +} + /* * Search the name=value vars for a specific one and return its value. * Returns NULL if not found. -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/15] staging: brcm80211: replace string based variable storage by linked list 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (9 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 10/15] staging: brcm80211: use enum identifiers in srom variable tables Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 12/15] staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() Arend van Spriel ` (5 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The storage of variables obtained from srom are now stored in a linked list and lookup is done based on the enumerated identifier. Reported-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/aiutils.c | 1 + drivers/staging/brcm80211/brcmsmac/aiutils.h | 1 + drivers/staging/brcm80211/brcmsmac/srom.c | 552 ++++++-------------------- drivers/staging/brcm80211/brcmsmac/srom.h | 1 + 4 files changed, 124 insertions(+), 431 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c index 6086c26..afba8b1 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.c +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c @@ -1210,6 +1210,7 @@ void ai_detach(struct si_pub *sih) pcicore_deinit(sii->pch); sii->pch = NULL; + srom_free_vars(sih); kfree(sii); } diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.h b/drivers/staging/brcm80211/brcmsmac/aiutils.h index 4a3f98e..dce5551 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.h +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.h @@ -266,6 +266,7 @@ struct si_info { struct pcicore_info *pch; /* PCI/E core handle */ + struct list_head var_list; /* list of srom variables */ char *vars; uint varsz; diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index f014044..75de8d1 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -364,6 +364,36 @@ /* Max. nvram variable table size */ #define MAXSZ_NVRAM_VARS 4096 +/* + * indicates type of value. + */ +enum brcms_srom_var_type { + BRCMS_SROM_STRING, + BRCMS_SROM_SNUMBER, + BRCMS_SROM_UNUMBER +}; + +/* + * storage type for srom variable. + * + * var_list: for linked list operations. + * varid: identifier of the variable. + * var_type: type of variable. + * buf: variable value when var_type == BRCMS_SROM_STRING. + * uval: unsigned variable value when var_type == BRCMS_SROM_UNUMBER. + * sval: signed variable value when var_type == BRCMS_SROM_SNUMBER. + */ +struct brcms_srom_list_head { + struct list_head var_list; + enum brcms_srom_id varid; + enum brcms_srom_var_type var_type; + union { + char buf[0]; + u32 uval; + s32 sval; + }; +}; + struct brcms_sromvar { enum brcms_srom_id varid; u32 revmask; @@ -834,278 +864,6 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = { {BRCMS_SROM_NULL, 0, 0, 0, 0} }; -struct srom_id_name { - enum brcms_srom_id id; - const char *name; -}; - -static const struct srom_id_name srom_id_map[] = { - { BRCMS_SROM_AA2G, "aa2g" }, - { BRCMS_SROM_AA5G, "aa5g" }, - { BRCMS_SROM_AG0, "ag0" }, - { BRCMS_SROM_AG1, "ag1" }, - { BRCMS_SROM_AG2, "ag2" }, - { BRCMS_SROM_AG3, "ag3" }, - { BRCMS_SROM_ANTSWCTL2G, "antswctl2g" }, - { BRCMS_SROM_ANTSWCTL5G, "antswctl5g" }, - { BRCMS_SROM_ANTSWITCH, "antswitch" }, - { BRCMS_SROM_BOARDFLAGS2, "boardflags2" }, - { BRCMS_SROM_BOARDFLAGS, "boardflags" }, - { BRCMS_SROM_BOARDNUM, "boardnum" }, - { BRCMS_SROM_BOARDREV, "boardrev" }, - { BRCMS_SROM_BOARDTYPE, "boardtype" }, - { BRCMS_SROM_BW40PO, "bw40po" }, - { BRCMS_SROM_BWDUPPO, "bwduppo" }, - { BRCMS_SROM_BXA2G, "bxa2g" }, - { BRCMS_SROM_BXA5G, "bxa5g" }, - { BRCMS_SROM_CC, "cc" }, - { BRCMS_SROM_CCK2GPO, "cck2gpo" }, - { BRCMS_SROM_CCKBW202GPO, "cckbw202gpo" }, - { BRCMS_SROM_CCKBW20UL2GPO, "cckbw20ul2gpo" }, - { BRCMS_SROM_CCODE, "ccode" }, - { BRCMS_SROM_CDDPO, "cddpo" }, - { BRCMS_SROM_DEVID, "devid" }, - { BRCMS_SROM_ET1MACADDR, "et1macaddr" }, - { BRCMS_SROM_EXTPAGAIN2G, "extpagain2g" }, - { BRCMS_SROM_EXTPAGAIN5G, "extpagain5g" }, - { BRCMS_SROM_FREQOFFSET_CORR, "freqoffset_corr" }, - { BRCMS_SROM_HW_IQCAL_EN, "hw_iqcal_en" }, - { BRCMS_SROM_IL0MACADDR, "il0macaddr" }, - { BRCMS_SROM_IQCAL_SWP_DIS, "iqcal_swp_dis" }, - { BRCMS_SROM_LEDBH0, "ledbh0" }, - { BRCMS_SROM_LEDBH1, "ledbh1" }, - { BRCMS_SROM_LEDBH2, "ledbh2" }, - { BRCMS_SROM_LEDBH3, "ledbh3" }, - { BRCMS_SROM_LEDDC, "leddc" }, - { BRCMS_SROM_LEGOFDM40DUPPO, "legofdm40duppo" }, - { BRCMS_SROM_LEGOFDMBW202GPO, "legofdmbw202gpo" }, - { BRCMS_SROM_LEGOFDMBW205GHPO, "legofdmbw205ghpo" }, - { BRCMS_SROM_LEGOFDMBW205GLPO, "legofdmbw205glpo" }, - { BRCMS_SROM_LEGOFDMBW205GMPO, "legofdmbw205gmpo" }, - { BRCMS_SROM_LEGOFDMBW20UL2GPO, "legofdmbw20ul2gpo" }, - { BRCMS_SROM_LEGOFDMBW20UL5GHPO, "legofdmbw20ul5ghpo" }, - { BRCMS_SROM_LEGOFDMBW20UL5GLPO, "legofdmbw20ul5glpo" }, - { BRCMS_SROM_LEGOFDMBW20UL5GMPO, "legofdmbw20ul5gmpo" }, - { BRCMS_SROM_MACADDR, "macaddr" }, - { BRCMS_SROM_MCS2GPO0, "mcs2gpo0" }, - { BRCMS_SROM_MCS2GPO1, "mcs2gpo1" }, - { BRCMS_SROM_MCS2GPO2, "mcs2gpo2" }, - { BRCMS_SROM_MCS2GPO3, "mcs2gpo3" }, - { BRCMS_SROM_MCS2GPO4, "mcs2gpo4" }, - { BRCMS_SROM_MCS2GPO5, "mcs2gpo5" }, - { BRCMS_SROM_MCS2GPO6, "mcs2gpo6" }, - { BRCMS_SROM_MCS2GPO7, "mcs2gpo7" }, - { BRCMS_SROM_MCS32PO, "mcs32po" }, - { BRCMS_SROM_MCS5GHPO0, "mcs5ghpo0" }, - { BRCMS_SROM_MCS5GHPO1, "mcs5ghpo1" }, - { BRCMS_SROM_MCS5GHPO2, "mcs5ghpo2" }, - { BRCMS_SROM_MCS5GHPO3, "mcs5ghpo3" }, - { BRCMS_SROM_MCS5GHPO4, "mcs5ghpo4" }, - { BRCMS_SROM_MCS5GHPO5, "mcs5ghpo5" }, - { BRCMS_SROM_MCS5GHPO6, "mcs5ghpo6" }, - { BRCMS_SROM_MCS5GHPO7, "mcs5ghpo7" }, - { BRCMS_SROM_MCS5GLPO0, "mcs5glpo0" }, - { BRCMS_SROM_MCS5GLPO1, "mcs5glpo1" }, - { BRCMS_SROM_MCS5GLPO2, "mcs5glpo2" }, - { BRCMS_SROM_MCS5GLPO3, "mcs5glpo3" }, - { BRCMS_SROM_MCS5GLPO4, "mcs5glpo4" }, - { BRCMS_SROM_MCS5GLPO5, "mcs5glpo5" }, - { BRCMS_SROM_MCS5GLPO6, "mcs5glpo6" }, - { BRCMS_SROM_MCS5GLPO7, "mcs5glpo7" }, - { BRCMS_SROM_MCS5GPO0, "mcs5gpo0" }, - { BRCMS_SROM_MCS5GPO1, "mcs5gpo1" }, - { BRCMS_SROM_MCS5GPO2, "mcs5gpo2" }, - { BRCMS_SROM_MCS5GPO3, "mcs5gpo3" }, - { BRCMS_SROM_MCS5GPO4, "mcs5gpo4" }, - { BRCMS_SROM_MCS5GPO5, "mcs5gpo5" }, - { BRCMS_SROM_MCS5GPO6, "mcs5gpo6" }, - { BRCMS_SROM_MCS5GPO7, "mcs5gpo7" }, - { BRCMS_SROM_MCSBW202GPO, "mcsbw202gpo" }, - { BRCMS_SROM_MCSBW205GHPO, "mcsbw205ghpo" }, - { BRCMS_SROM_MCSBW205GLPO, "mcsbw205glpo" }, - { BRCMS_SROM_MCSBW205GMPO, "mcsbw205gmpo" }, - { BRCMS_SROM_MCSBW20UL2GPO, "mcsbw20ul2gpo" }, - { BRCMS_SROM_MCSBW20UL5GHPO, "mcsbw20ul5ghpo" }, - { BRCMS_SROM_MCSBW20UL5GLPO, "mcsbw20ul5glpo" }, - { BRCMS_SROM_MCSBW20UL5GMPO, "mcsbw20ul5gmpo" }, - { BRCMS_SROM_MCSBW402GPO, "mcsbw402gpo" }, - { BRCMS_SROM_MCSBW405GHPO, "mcsbw405ghpo" }, - { BRCMS_SROM_MCSBW405GLPO, "mcsbw405glpo" }, - { BRCMS_SROM_MCSBW405GMPO, "mcsbw405gmpo" }, - { BRCMS_SROM_MEASPOWER, "measpower" }, - { BRCMS_SROM_OFDM2GPO, "ofdm2gpo" }, - { BRCMS_SROM_OFDM5GHPO, "ofdm5ghpo" }, - { BRCMS_SROM_OFDM5GLPO, "ofdm5glpo" }, - { BRCMS_SROM_OFDM5GPO, "ofdm5gpo" }, - { BRCMS_SROM_OPO, "opo" }, - { BRCMS_SROM_PA0B0, "pa0b0" }, - { BRCMS_SROM_PA0B1, "pa0b1" }, - { BRCMS_SROM_PA0B2, "pa0b2" }, - { BRCMS_SROM_PA0ITSSIT, "pa0itssit" }, - { BRCMS_SROM_PA0MAXPWR, "pa0maxpwr" }, - { BRCMS_SROM_PA1B0, "pa1b0" }, - { BRCMS_SROM_PA1B1, "pa1b1" }, - { BRCMS_SROM_PA1B2, "pa1b2" }, - { BRCMS_SROM_PA1HIB0, "pa1hib0" }, - { BRCMS_SROM_PA1HIB1, "pa1hib1" }, - { BRCMS_SROM_PA1HIB2, "pa1hib2" }, - { BRCMS_SROM_PA1HIMAXPWR, "pa1himaxpwr" }, - { BRCMS_SROM_PA1ITSSIT, "pa1itssit" }, - { BRCMS_SROM_PA1LOB0, "pa1lob0" }, - { BRCMS_SROM_PA1LOB1, "pa1lob1" }, - { BRCMS_SROM_PA1LOB2, "pa1lob2" }, - { BRCMS_SROM_PA1LOMAXPWR, "pa1lomaxpwr" }, - { BRCMS_SROM_PA1MAXPWR, "pa1maxpwr" }, - { BRCMS_SROM_PDETRANGE2G, "pdetrange2g" }, - { BRCMS_SROM_PDETRANGE5G, "pdetrange5g" }, - { BRCMS_SROM_PHYCAL_TEMPDELTA, "phycal_tempdelta" }, - { BRCMS_SROM_RAWTEMPSENSE, "rawtempsense" }, - { BRCMS_SROM_REV, "sromrev" }, - { BRCMS_SROM_REGREV, "regrev" }, - { BRCMS_SROM_RSSISAV2G, "rssisav2g" }, - { BRCMS_SROM_RSSISAV5G, "rssisav5g" }, - { BRCMS_SROM_RSSISMC2G, "rssismc2g" }, - { BRCMS_SROM_RSSISMC5G, "rssismc5g" }, - { BRCMS_SROM_RSSISMF2G, "rssismf2g" }, - { BRCMS_SROM_RSSISMF5G, "rssismf5g" }, - { BRCMS_SROM_RXCHAIN, "rxchain" }, - { BRCMS_SROM_RXPO2G, "rxpo2g" }, - { BRCMS_SROM_RXPO5G, "rxpo5g" }, - { BRCMS_SROM_STBCPO, "stbcpo" }, - { BRCMS_SROM_TEMPCORRX, "tempcorrx" }, - { BRCMS_SROM_TEMPOFFSET, "tempoffset" }, - { BRCMS_SROM_TEMPSENSE_OPTION, "tempsense_option" }, - { BRCMS_SROM_TEMPSENSE_SLOPE, "tempsense_slope" }, - { BRCMS_SROM_TEMPTHRESH, "tempthresh" }, - { BRCMS_SROM_TRI2G, "tri2g" }, - { BRCMS_SROM_TRI5GH, "tri5gh" }, - { BRCMS_SROM_TRI5GL, "tri5gl" }, - { BRCMS_SROM_TRI5G, "tri5g" }, - { BRCMS_SROM_TRISO2G, "triso2g" }, - { BRCMS_SROM_TRISO5G, "triso5g" }, - { BRCMS_SROM_TSSIPOS2G, "tssipos2g" }, - { BRCMS_SROM_TSSIPOS5G, "tssipos5g" }, - { BRCMS_SROM_TXCHAIN, "txchain" }, - { BRCMS_SROM_TXPID2GA0, "txpid2ga0" }, - { BRCMS_SROM_TXPID2GA1, "txpid2ga1" }, - { BRCMS_SROM_TXPID2GA2, "txpid2ga2" }, - { BRCMS_SROM_TXPID2GA3, "txpid2ga3" }, - { BRCMS_SROM_TXPID5GA0, "txpid5ga0" }, - { BRCMS_SROM_TXPID5GA1, "txpid5ga1" }, - { BRCMS_SROM_TXPID5GA2, "txpid5ga2" }, - { BRCMS_SROM_TXPID5GA3, "txpid5ga3" }, - { BRCMS_SROM_TXPID5GHA0, "txpid5gha0" }, - { BRCMS_SROM_TXPID5GHA1, "txpid5gha1" }, - { BRCMS_SROM_TXPID5GHA2, "txpid5gha2" }, - { BRCMS_SROM_TXPID5GHA3, "txpid5gha3" }, - { BRCMS_SROM_TXPID5GLA0, "txpid5gla0" }, - { BRCMS_SROM_TXPID5GLA1, "txpid5gla1" }, - { BRCMS_SROM_TXPID5GLA2, "txpid5gla2" }, - { BRCMS_SROM_TXPID5GLA3, "txpid5gla3" }, - { BRCMS_SROM_ITT2GA0, "itt2ga0" }, - { BRCMS_SROM_ITT2GA1, "itt2ga1" }, - { BRCMS_SROM_ITT2GA2, "itt2ga2" }, - { BRCMS_SROM_ITT2GA3, "itt2ga3" }, - { BRCMS_SROM_ITT5GA0, "itt5ga0" }, - { BRCMS_SROM_ITT5GA1, "itt5ga1" }, - { BRCMS_SROM_ITT5GA2, "itt5ga2" }, - { BRCMS_SROM_ITT5GA3, "itt5ga3" }, - { BRCMS_SROM_MAXP2GA0, "maxp2ga0" }, - { BRCMS_SROM_MAXP2GA1, "maxp2ga1" }, - { BRCMS_SROM_MAXP2GA2, "maxp2ga2" }, - { BRCMS_SROM_MAXP2GA3, "maxp2ga3" }, - { BRCMS_SROM_MAXP5GA0, "maxp5ga0" }, - { BRCMS_SROM_MAXP5GA1, "maxp5ga1" }, - { BRCMS_SROM_MAXP5GA2, "maxp5ga2" }, - { BRCMS_SROM_MAXP5GA3, "maxp5ga3" }, - { BRCMS_SROM_MAXP5GHA0, "maxp5gha0" }, - { BRCMS_SROM_MAXP5GHA1, "maxp5gha1" }, - { BRCMS_SROM_MAXP5GHA2, "maxp5gha2" }, - { BRCMS_SROM_MAXP5GHA3, "maxp5gha3" }, - { BRCMS_SROM_MAXP5GLA0, "maxp5gla0" }, - { BRCMS_SROM_MAXP5GLA1, "maxp5gla1" }, - { BRCMS_SROM_MAXP5GLA2, "maxp5gla2" }, - { BRCMS_SROM_MAXP5GLA3, "maxp5gla3" }, - { BRCMS_SROM_PA2GW0A0, "pa2gw0a0" }, - { BRCMS_SROM_PA2GW0A1, "pa2gw0a1" }, - { BRCMS_SROM_PA2GW0A2, "pa2gw0a2" }, - { BRCMS_SROM_PA2GW0A3, "pa2gw0a3" }, - { BRCMS_SROM_PA2GW1A0, "pa2gw1a0" }, - { BRCMS_SROM_PA2GW1A1, "pa2gw1a1" }, - { BRCMS_SROM_PA2GW1A2, "pa2gw1a2" }, - { BRCMS_SROM_PA2GW1A3, "pa2gw1a3" }, - { BRCMS_SROM_PA2GW2A0, "pa2gw2a0" }, - { BRCMS_SROM_PA2GW2A1, "pa2gw2a1" }, - { BRCMS_SROM_PA2GW2A2, "pa2gw2a2" }, - { BRCMS_SROM_PA2GW2A3, "pa2gw2a3" }, - { BRCMS_SROM_PA2GW3A0, "pa2gw3a0" }, - { BRCMS_SROM_PA2GW3A1, "pa2gw3a1" }, - { BRCMS_SROM_PA2GW3A2, "pa2gw3a2" }, - { BRCMS_SROM_PA2GW3A3, "pa2gw3a3" }, - { BRCMS_SROM_PA5GHW0A0, "pa5ghw0a0" }, - { BRCMS_SROM_PA5GHW0A1, "pa5ghw0a1" }, - { BRCMS_SROM_PA5GHW0A2, "pa5ghw0a2" }, - { BRCMS_SROM_PA5GHW0A3, "pa5ghw0a3" }, - { BRCMS_SROM_PA5GHW1A0, "pa5ghw1a0" }, - { BRCMS_SROM_PA5GHW1A1, "pa5ghw1a1" }, - { BRCMS_SROM_PA5GHW1A2, "pa5ghw1a2" }, - { BRCMS_SROM_PA5GHW1A3, "pa5ghw1a3" }, - { BRCMS_SROM_PA5GHW2A0, "pa5ghw2a0" }, - { BRCMS_SROM_PA5GHW2A1, "pa5ghw2a1" }, - { BRCMS_SROM_PA5GHW2A2, "pa5ghw2a2" }, - { BRCMS_SROM_PA5GHW2A3, "pa5ghw2a3" }, - { BRCMS_SROM_PA5GHW3A0, "pa5ghw3a0" }, - { BRCMS_SROM_PA5GHW3A1, "pa5ghw3a1" }, - { BRCMS_SROM_PA5GHW3A2, "pa5ghw3a2" }, - { BRCMS_SROM_PA5GHW3A3, "pa5ghw3a3" }, - { BRCMS_SROM_PA5GLW0A0, "pa5glw0a0" }, - { BRCMS_SROM_PA5GLW0A1, "pa5glw0a1" }, - { BRCMS_SROM_PA5GLW0A2, "pa5glw0a2" }, - { BRCMS_SROM_PA5GLW0A3, "pa5glw0a3" }, - { BRCMS_SROM_PA5GLW1A0, "pa5glw1a0" }, - { BRCMS_SROM_PA5GLW1A1, "pa5glw1a1" }, - { BRCMS_SROM_PA5GLW1A2, "pa5glw1a2" }, - { BRCMS_SROM_PA5GLW1A3, "pa5glw1a3" }, - { BRCMS_SROM_PA5GLW2A0, "pa5glw2a0" }, - { BRCMS_SROM_PA5GLW2A1, "pa5glw2a1" }, - { BRCMS_SROM_PA5GLW2A2, "pa5glw2a2" }, - { BRCMS_SROM_PA5GLW2A3, "pa5glw2a3" }, - { BRCMS_SROM_PA5GLW3A0, "pa5glw3a0" }, - { BRCMS_SROM_PA5GLW3A1, "pa5glw3a1" }, - { BRCMS_SROM_PA5GLW3A2, "pa5glw3a2" }, - { BRCMS_SROM_PA5GLW3A3, "pa5glw3a3" }, - { BRCMS_SROM_PA5GW0A0, "pa5gw0a0" }, - { BRCMS_SROM_PA5GW0A1, "pa5gw0a1" }, - { BRCMS_SROM_PA5GW0A2, "pa5gw0a2" }, - { BRCMS_SROM_PA5GW0A3, "pa5gw0a3" }, - { BRCMS_SROM_PA5GW1A0, "pa5gw1a0" }, - { BRCMS_SROM_PA5GW1A1, "pa5gw1a1" }, - { BRCMS_SROM_PA5GW1A2, "pa5gw1a2" }, - { BRCMS_SROM_PA5GW1A3, "pa5gw1a3" }, - { BRCMS_SROM_PA5GW2A0, "pa5gw2a0" }, - { BRCMS_SROM_PA5GW2A1, "pa5gw2a1" }, - { BRCMS_SROM_PA5GW2A2, "pa5gw2a2" }, - { BRCMS_SROM_PA5GW2A3, "pa5gw2a3" }, - { BRCMS_SROM_PA5GW3A0, "pa5gw3a0" }, - { BRCMS_SROM_PA5GW3A1, "pa5gw3a1" }, - { BRCMS_SROM_PA5GW3A2, "pa5gw3a2" }, - { BRCMS_SROM_PA5GW3A3, "pa5gw3a3" }, -}; - -static const char *get_varname(enum brcms_srom_id id) -{ - const struct srom_id_name *entry; - int i; - - entry = &srom_id_map[0]; - for (i = 0; i < ARRAY_SIZE(srom_id_map); i++) { - if (entry->id == id) - return entry->name; - entry++; - } - return NULL; -} - /* crc table has the same contents for every device instance, so it can be * shared between devices. */ static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE]; @@ -1162,70 +920,14 @@ static inline void htol16_buf(u16 *buf, unsigned int size) *(__le16 *)(buf + size) = cpu_to_le16(*(buf + size)); } -/* Initialization of varbuf structure */ -static void varbuf_init(struct brcms_varbuf *b, char *buf, uint size) -{ - b->size = size; - b->base = b->buf = buf; -} - -/* append a null terminated var=value string */ -static int varbuf_append(struct brcms_varbuf *b, const char *fmt, ...) -{ - va_list ap; - int r; - size_t len; - char *s; - - if (b->size < 2) - return 0; - - va_start(ap, fmt); - r = vsnprintf(b->buf, b->size, fmt, ap); - va_end(ap); - - /* - * C99 snprintf behavior returns r >= size on overflow, - * others return -1 on overflow. All return -1 on format error. - * We need to leave room for 2 null terminations, one for the current - * var string, and one for final null of the var table. So check that - * the strlen written, r, leaves room for 2 chars. - */ - if ((r == -1) || (r > (int)(b->size - 2))) { - b->size = 0; - return 0; - } - - /* Remove any earlier occurrence of the same variable */ - s = strchr(b->buf, '='); - if (s != NULL) { - len = (size_t) (s - b->buf); - for (s = b->base; s < b->buf;) { - if ((memcmp(s, b->buf, len) == 0) && s[len] == '=') { - len = strlen(s) + 1; - memmove(s, (s + len), - ((b->buf + r + 1) - (s + len))); - b->buf -= len; - b->size += (unsigned int)len; - break; - } - - while (*s++) - ; - } - } - - /* skip over this string's null termination */ - r++; - b->size -= r; - b->buf += r; - - return r; -} - +/* + * convert binary srom data into linked list of srom variable items. + */ static void -_initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) +_initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct list_head *var_list) { + struct brcms_srom_list_head *entry; + enum brcms_srom_id id; u16 w; u32 val; const struct brcms_sromvar *srv; @@ -1233,10 +935,17 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) uint flags; u32 sr = (1 << sromrev); - varbuf_append(b, "sromrev=%d", sromrev); + /* first store the srom revision */ + entry = kzalloc(sizeof(struct brcms_srom_list_head), GFP_KERNEL); + entry->varid = BRCMS_SROM_REV; + entry->var_type = BRCMS_SROM_UNUMBER; + entry->uval = sromrev; + list_add(&entry->var_list, var_list); for (srv = pci_sromvars; srv->varid != BRCMS_SROM_NULL; srv++) { - const char *name; + enum brcms_srom_var_type type; + u8 ea[ETH_ALEN]; + u8 extra_space = 0; if ((srv->revmask & sr) == 0) continue; @@ -1245,23 +954,25 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) continue; flags = srv->flags; - name = get_varname(srv->varid); + id = srv->varid; /* This entry is for mfgc only. Don't generate param for it, */ if (flags & SRFL_NOVAR) continue; if (flags & SRFL_ETHADDR) { - u8 ea[ETH_ALEN]; - + /* + * stored in string format XX:XX:XX:XX:XX:XX (17 chars) + */ ea[0] = (srom[srv->off - off] >> 8) & 0xff; ea[1] = srom[srv->off - off] & 0xff; ea[2] = (srom[srv->off + 1 - off] >> 8) & 0xff; ea[3] = srom[srv->off + 1 - off] & 0xff; ea[4] = (srom[srv->off + 2 - off] >> 8) & 0xff; ea[5] = srom[srv->off + 2 - off] & 0xff; - - varbuf_append(b, "%s=%pM", name, ea); + /* 17 characters + string terminator - union size */ + extra_space = 18 - sizeof(s32); + type = BRCMS_SROM_STRING; } else { w = srom[srv->off - off]; val = (w & srv->mask) >> mask_shift(srv->mask); @@ -1285,30 +996,42 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) continue; if (flags & SRFL_CCODE) { - if (val == 0) - varbuf_append(b, "ccode="); - else - varbuf_append(b, "ccode=%c%c", - (val >> 8), (val & 0xff)); - } - /* LED Powersave duty cycle has to be scaled: - *(oncount >> 24) (offcount >> 8) - */ - else if (flags & SRFL_LEDDC) { + type = BRCMS_SROM_STRING; + } else if (flags & SRFL_LEDDC) { + /* LED Powersave duty cycle has to be scaled: + *(oncount >> 24) (offcount >> 8) + */ u32 w32 = /* oncount */ (((val >> 8) & 0xff) << 24) | /* offcount */ (((val & 0xff)) << 8); - varbuf_append(b, "leddc=%d", w32); - } else if (flags & SRFL_PRHEX) - varbuf_append(b, "%s=0x%x", name, val); - else if ((flags & SRFL_PRSIGN) - && (val & (1 << (width - 1)))) - varbuf_append(b, "%s=%d", name, - (int)(val | (~0 << width))); + type = BRCMS_SROM_UNUMBER; + val = w32; + } else if ((flags & SRFL_PRSIGN) + && (val & (1 << (width - 1)))) { + type = BRCMS_SROM_SNUMBER; + val |= ~0 << width; + } else + type = BRCMS_SROM_UNUMBER; + } + + entry = kzalloc(sizeof(struct brcms_srom_list_head) + + extra_space, GFP_KERNEL); + entry->varid = id; + entry->var_type = type; + if (flags & SRFL_ETHADDR) { + snprintf(entry->buf, 18, "%pM", ea); + } else if (flags & SRFL_CCODE) { + if (val == 0) + entry->buf[0] = '\0'; else - varbuf_append(b, "%s=%u", name, val); + snprintf(entry->buf, 3, "%c%c", + (val >> 8), (val & 0xff)); + } else { + entry->uval = val; } + + list_add(&entry->var_list, var_list); } if (sromrev >= 4) { @@ -1345,14 +1068,13 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b) && ((int)val == (1 << width) - 1)) continue; - if (srv->flags & SRFL_PRHEX) - varbuf_append(b, "%s%d=0x%x", - get_varname(srv->varid), - p, val); - else - varbuf_append(b, "%s%d=%d", - get_varname(srv->varid), - p, val); + entry = + kzalloc(sizeof(struct brcms_srom_list_head), + GFP_KERNEL); + entry->varid = srv->varid+p; + entry->var_type = BRCMS_SROM_UNUMBER; + entry->uval = val; + list_add(&entry->var_list, var_list); } pb += psz; } @@ -1435,31 +1157,6 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz) } /* -* Create variable table from memory. -* Return 0 on success, nonzero on error. -*/ -static int initvars_table(char *start, char *end, - char **vars, uint *count) -{ - int c = (int)(end - start); - - /* do it only when there is more than just the null string */ - if (c > 1) { - char *vp = kmalloc(c, GFP_ATOMIC); - if (!vp) - return -ENOMEM; - memcpy(vp, start, c); - *vars = vp; - *count = c; - } else { - *vars = NULL; - *count = 0; - } - - return 0; -} - -/* * Initialize nonvolatile variable table from sprom. * Return 0 on success, nonzero on error. */ @@ -1470,8 +1167,6 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, u16 __iomem *sromwindow; u8 sromrev = 0; u32 sr; - struct brcms_varbuf b; - char *vp, *base = NULL; int err = 0; /* @@ -1514,6 +1209,8 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, } if (!err) { + struct si_info *sii = (struct si_info *)sih; + /* Bitmask for the sromrev */ sr = 1 << sromrev; @@ -1526,23 +1223,10 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, goto errout; } - base = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC); - if (!base) { - err = -ENOMEM; - goto errout; - } - - varbuf_init(&b, base, MAXSZ_NVRAM_VARS); + INIT_LIST_HEAD(&sii->var_list); /* parse SROM into name=value pairs. */ - _initvars_srom_pci(sromrev, srom, 0, &b); - - /* final nullbyte terminator */ - vp = b.buf; - *vp++ = '\0'; - - err = initvars_table(base, vp, vars, count); - kfree(base); + _initvars_srom_pci(sromrev, srom, 0, &sii->var_list); } errout: @@ -1550,6 +1234,17 @@ errout: return err; } +void srom_free_vars(struct si_pub *sih) +{ + struct si_info *sii; + struct brcms_srom_list_head *entry, *next; + + sii = (struct si_info *)sih; + list_for_each_entry_safe(entry, next, &sii->var_list, var_list) { + list_del(&entry->var_list); + kfree(entry); + } +} /* * Initialize local vars from the right source for this platform. * Return 0 on success, nonzero on error. @@ -1579,44 +1274,39 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, */ char *getvar(struct si_pub *sih, enum brcms_srom_id id) { - const char *name = get_varname(id); - char *s; - int len; struct si_info *sii; - - if (!name) - return NULL; - - len = strlen(name); - if (len == 0) - return NULL; + struct brcms_srom_list_head *entry; sii = (struct si_info *)sih; - /* first look in vars[] */ - for (s = sii->vars; s && *s;) { - if ((memcmp(s, name, len) == 0) && (s[len] == '=')) - return &s[len + 1]; + list_for_each_entry(entry, &sii->var_list, var_list) + if (entry->varid == id) + return &entry->buf[0]; - while (*s++) - ; - } /* nothing found */ return NULL; } /* * Search the vars for a specific one and return its value as - * an integer. Returns 0 if not found. + * an integer. Returns 0 if not found.- */ int getintvar(struct si_pub *sih, enum brcms_srom_id id) { - char *val; + struct si_info *sii; + struct brcms_srom_list_head *entry; unsigned long res; - val = getvar(sih, id); - if (val && !kstrtoul(val, 0, &res)) - return res; + sii = (struct si_info *)sih; + + list_for_each_entry(entry, &sii->var_list, var_list) + if (entry->varid == id) { + if (entry->var_type == BRCMS_SROM_SNUMBER || + entry->var_type == BRCMS_SROM_UNUMBER) + return (int)entry->sval; + else if (!kstrtoul(&entry->buf[0], 0, &res)) + return (int)res; + } return 0; } diff --git a/drivers/staging/brcm80211/brcmsmac/srom.h b/drivers/staging/brcm80211/brcmsmac/srom.h index 826c2cd..395ab7f 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.h +++ b/drivers/staging/brcm80211/brcmsmac/srom.h @@ -22,6 +22,7 @@ /* Prototypes */ extern int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, uint *count); +extern void srom_free_vars(struct si_pub *sih); extern int srom_read(struct si_pub *sih, uint bus, void *curmap, uint byteoff, uint nbytes, u16 *buf, bool check_crc); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/15] staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (10 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 11/15] staging: brcm80211: replace string based variable storage by linked list Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 13/15] staging: brcm80211: cleanup driver variable references Arend van Spriel ` (4 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel The function is called once with parameter 'off' fixed to zero. This parameter has been removed. Reviewed-by: Alwin Beukers <alwin@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/srom.c | 30 +++++++++++----------------- 1 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index 75de8d1..8400cf4 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -924,7 +924,7 @@ static inline void htol16_buf(u16 *buf, unsigned int size) * convert binary srom data into linked list of srom variable items. */ static void -_initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct list_head *var_list) +_initvars_srom_pci(u8 sromrev, u16 *srom, struct list_head *var_list) { struct brcms_srom_list_head *entry; enum brcms_srom_id id; @@ -950,9 +950,6 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct list_head *var_list) if ((srv->revmask & sr) == 0) continue; - if (srv->off < off) - continue; - flags = srv->flags; id = srv->varid; @@ -964,26 +961,26 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct list_head *var_list) /* * stored in string format XX:XX:XX:XX:XX:XX (17 chars) */ - ea[0] = (srom[srv->off - off] >> 8) & 0xff; - ea[1] = srom[srv->off - off] & 0xff; - ea[2] = (srom[srv->off + 1 - off] >> 8) & 0xff; - ea[3] = srom[srv->off + 1 - off] & 0xff; - ea[4] = (srom[srv->off + 2 - off] >> 8) & 0xff; - ea[5] = srom[srv->off + 2 - off] & 0xff; + ea[0] = (srom[srv->off] >> 8) & 0xff; + ea[1] = srom[srv->off] & 0xff; + ea[2] = (srom[srv->off + 1] >> 8) & 0xff; + ea[3] = srom[srv->off + 1] & 0xff; + ea[4] = (srom[srv->off + 2] >> 8) & 0xff; + ea[5] = srom[srv->off + 2] & 0xff; /* 17 characters + string terminator - union size */ extra_space = 18 - sizeof(s32); type = BRCMS_SROM_STRING; } else { - w = srom[srv->off - off]; + w = srom[srv->off]; val = (w & srv->mask) >> mask_shift(srv->mask); width = mask_width(srv->mask); while (srv->flags & SRFL_MORE) { srv++; - if (srv->off == 0 || srv->off < off) + if (srv->off == 0) continue; - w = srom[srv->off - off]; + w = srom[srv->off]; val += ((w & srv->mask) >> mask_shift(srv-> mask)) << @@ -1052,13 +1049,10 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct list_head *var_list) if ((srv->revmask & sr) == 0) continue; - if (pb + srv->off < off) - continue; - if (srv->flags & SRFL_NOVAR) continue; - w = srom[pb + srv->off - off]; + w = srom[pb + srv->off]; val = (w & srv->mask) >> mask_shift(srv->mask); width = mask_width(srv->mask); @@ -1226,7 +1220,7 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, INIT_LIST_HEAD(&sii->var_list); /* parse SROM into name=value pairs. */ - _initvars_srom_pci(sromrev, srom, 0, &sii->var_list); + _initvars_srom_pci(sromrev, srom, &sii->var_list); } errout: -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 13/15] staging: brcm80211: cleanup driver variable references 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (11 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 12/15] staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 14/15] staging: brcm80211: clean up struct brcmf_if in fullmac Arend van Spriel ` (3 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel Throughout the data structures within the driver several references to the driver variables were stored. As the storage and access functions are now consolidated into srom.c those references are no longer needed and have been removed. Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmsmac/aiutils.c | 13 +++------ drivers/staging/brcm80211/brcmsmac/aiutils.h | 5 +--- drivers/staging/brcm80211/brcmsmac/main.c | 30 ++------------------- drivers/staging/brcm80211/brcmsmac/main.h | 5 --- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 6 +--- drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 +-- drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 1 - drivers/staging/brcm80211/brcmsmac/pub.h | 1 - drivers/staging/brcm80211/brcmsmac/srom.c | 14 ++-------- drivers/staging/brcm80211/brcmsmac/srom.h | 3 +- 10 files changed, 14 insertions(+), 68 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c index afba8b1..025fa0e 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.c +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c @@ -1025,8 +1025,7 @@ 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, - char **vars, uint *varsz) + void __iomem *regs, struct pci_dev *pbus) { struct si_pub *sih = &sii->pub; u32 w, savewin; @@ -1091,11 +1090,9 @@ static struct si_info *ai_doattach(struct si_info *sii, goto exit; /* Init nvram from sprom/otp if they exist */ - if (srom_var_init(&sii->pub, cc, vars, varsz)) + if (srom_var_init(&sii->pub, cc)) goto exit; - sii->vars = vars ? *vars : NULL; - sii->varsz = varsz ? *varsz : 0; ai_nvram_process(sii); /* === NVRAM, clock is ready === */ @@ -1172,11 +1169,9 @@ static struct si_info *ai_doattach(struct si_info *sii, * devid - pci device id (used to determine chip#) * osh - opaque OS handle * regs - virtual address of initial core registers - * vars - pointer to a pointer area for "environment" variables - * varsz - pointer to int to return the size of the vars */ struct si_pub * -ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz) +ai_attach(void __iomem *regs, struct pci_dev *sdh) { struct si_info *sii; @@ -1185,7 +1180,7 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz) if (sii == NULL) return NULL; - if (ai_doattach(sii, regs, sdh, vars, varsz) == NULL) { + if (ai_doattach(sii, regs, sdh) == NULL) { kfree(sii); return NULL; } diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.h b/drivers/staging/brcm80211/brcmsmac/aiutils.h index dce5551..106a742 100644 --- a/drivers/staging/brcm80211/brcmsmac/aiutils.h +++ b/drivers/staging/brcm80211/brcmsmac/aiutils.h @@ -267,8 +267,6 @@ struct si_info { struct pcicore_info *pch; /* PCI/E core handle */ struct list_head var_list; /* list of srom variables */ - char *vars; - uint varsz; void __iomem *curmap; /* current regs va */ void __iomem *regs[SI_MAXCORES]; /* other regs va */ @@ -320,8 +318,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, - char **vars, uint *varsz); +extern struct si_pub *ai_attach(void __iomem *regs, struct pci_dev *sdh); extern void ai_detach(struct si_pub *sih); extern uint ai_coreid(struct si_pub *sih); extern uint ai_corerev(struct si_pub *sih); diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c index 5ec25e8..1e35be9 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.c +++ b/drivers/staging/brcm80211/brcmsmac/main.c @@ -3106,16 +3106,6 @@ brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, void *buf, } } -static void brcms_b_copyfrom_vars(struct brcms_hardware *wlc_hw, char **buf, - uint *len) -{ - BCMMSG(wlc_hw->wlc->wiphy, "nvram vars totlen=%d\n", - wlc_hw->vars_size); - - *buf = wlc_hw->vars; - *len = wlc_hw->vars_size; -} - static void brcms_b_retrylimit_upd(struct brcms_hardware *wlc_hw, u16 SRL, u16 LRL) { @@ -4551,7 +4541,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, struct brcms_hardware *wlc_hw; struct d11regs __iomem *regs; char *macaddr = NULL; - char *vars; uint err = 0; uint j; bool wme = false; @@ -4576,15 +4565,13 @@ 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->vars, &wlc_hw->vars_size); + wlc_hw->sih = ai_attach(regsva, btparam); if (wlc_hw->sih == NULL) { wiphy_err(wiphy, "wl%d: brcms_b_attach: si_attach failed\n", unit); err = 11; goto fail; } - vars = wlc_hw->vars; /* verify again the device is supported */ if (!brcms_c_chipmatch(vendor, device)) { @@ -4692,7 +4679,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, sha_params.physhim = wlc_hw->physhim; sha_params.unit = unit; sha_params.corerev = wlc_hw->corerev; - sha_params.vars = vars; sha_params.vid = wlc_hw->vendorid; sha_params.did = wlc_hw->deviceid; sha_params.chip = wlc_hw->sih->chip; @@ -4738,8 +4724,8 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, /* Get a phy for this band */ wlc_hw->band->pi = wlc_phy_attach(wlc_hw->phy_sh, regs, - wlc_hw->band->bandtype, vars, - wlc->wiphy); + wlc_hw->band->bandtype, + wlc->wiphy); if (wlc_hw->band->pi == NULL) { wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_" "attach failed\n", unit); @@ -4897,12 +4883,10 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) { int aa; uint unit; - char *vars; int bandtype; struct si_pub *sih = wlc->hw->sih; unit = wlc->pub->unit; - vars = wlc->pub->vars; bandtype = wlc->band->bandtype; /* get antennas available */ @@ -5092,10 +5076,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, pub->phy_11ncapable = BRCMS_PHY_11N_CAP(wlc->band); - /* propagate *vars* from BMAC driver to high driver */ - brcms_b_copyfrom_vars(wlc->hw, &pub->vars, &wlc->vars_size); - - /* disable allowed duty cycle */ wlc->tx_duty_cycle_ofdm = 0; wlc->tx_duty_cycle_cck = 0; @@ -5304,10 +5284,6 @@ static int brcms_b_detach(struct brcms_c_info *wlc) wlc_phy_shim_detach(wlc_hw->physhim); - /* free vars */ - kfree(wlc_hw->vars); - wlc_hw->vars = NULL; - if (wlc_hw->sih) { ai_detach(wlc_hw->sih); wlc_hw->sih = NULL; diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h index 441292a..7a2554f 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.h +++ b/drivers/staging/brcm80211/brcmsmac/main.h @@ -336,8 +336,6 @@ struct brcms_hardware { u32 machwcap_backup; /* backup of machwcap */ struct si_pub *sih; /* SI handle (cookie for siutils calls) */ - char *vars; /* "environment" name=value */ - uint vars_size; /* size of vars, free vars on detach */ struct d11regs __iomem *regs; /* pointer to device registers */ struct phy_shim_info *physhim; /* phy shim layer handler */ struct shared_phy *phy_sh; /* pointer to shared phy state */ @@ -420,7 +418,6 @@ struct brcms_txq_info { * ampdu: ampdu module handler. * asi: antsel module handler. * cmi: channel manager module handler. - * vars_size: size of vars, free vars on detach. * vendorid: PCI vendor id. * deviceid: PCI device id. * ucode_rev: microcode revision. @@ -513,8 +510,6 @@ struct brcms_c_info { struct antsel_info *asi; struct brcms_cm_info *cmi; - uint vars_size; - u16 vendorid; u16 deviceid; uint ucode_rev; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c index 59767e3..d54cfdb 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c @@ -459,7 +459,7 @@ static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi) struct brcms_phy_pub * wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs, - int bandtype, char *vars, struct wiphy *wiphy) + int bandtype, struct wiphy *wiphy) { struct brcms_phy *pi; u32 sflags = 0; @@ -493,8 +493,6 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs, pi->phy_init_por = true; pi->phy_wreg_limit = PHY_WREG_LIMIT; - pi->vars = vars; - pi->txpwr_percent = 100; pi->do_initcal = true; @@ -609,8 +607,6 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs, pi->next = pi->sh->phy_head; sh->phy_head = pi; - pi->vars = (char *)&pi->vars; - memcpy(&pi->pubpi_ro, &pi->pubpi, sizeof(struct brcms_phy_pub)); return &pi->pubpi_ro; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h index 44818af..96e1516 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h @@ -167,7 +167,6 @@ struct shared_phy_params { uint unit; uint corerev; uint buscorerev; - char *vars; u16 vid; u16 did; uint chip; @@ -185,8 +184,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, - int bandtype, char *vars, - struct wiphy *wiphy); + int bandtype, struct wiphy *wiphy); extern void wlc_phy_detach(struct brcms_phy_pub *ppi); extern bool wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype, diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h index 4330e38..bea8524 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h @@ -561,7 +561,6 @@ struct brcms_phy { struct d11regs __iomem *regs; struct brcms_phy *next; - char *vars; struct brcms_phy_pub pubpi; bool do_initcal; diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h index 8c9ac8f..3942f47 100644 --- a/drivers/staging/brcm80211/brcmsmac/pub.h +++ b/drivers/staging/brcm80211/brcmsmac/pub.h @@ -407,7 +407,6 @@ struct brcms_pub { uint unit; /* device instance number */ uint corerev; /* core revision */ struct si_pub *sih; /* SI handle (cookie for siutils calls) */ - char *vars; /* "environment" name=value */ bool up; /* interface up and running */ bool hw_off; /* HW is off */ bool hw_up; /* one time hw up/down */ diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index 8400cf4..99f7910 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -1154,8 +1154,7 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz) * Initialize nonvolatile variable table from sprom. * Return 0 on success, nonzero on error. */ -static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap, - char **vars, uint *count) +static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap) { u16 *srom; u16 __iomem *sromwindow; @@ -1243,21 +1242,14 @@ void srom_free_vars(struct si_pub *sih) * Initialize local vars from the right source for this platform. * Return 0 on success, nonzero on error. */ -int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, - uint *count) +int srom_var_init(struct si_pub *sih, void __iomem *curmap) { uint len; len = 0; - if (vars == NULL || count == NULL) - return 0; - - *vars = NULL; - *count = 0; - if (curmap != NULL) - return initvars_srom_pci(sih, curmap, vars, count); + return initvars_srom_pci(sih, curmap); return -EINVAL; } diff --git a/drivers/staging/brcm80211/brcmsmac/srom.h b/drivers/staging/brcm80211/brcmsmac/srom.h index 395ab7f..708c43f 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.h +++ b/drivers/staging/brcm80211/brcmsmac/srom.h @@ -20,8 +20,7 @@ #include "types.h" /* Prototypes */ -extern int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars, - uint *count); +extern int srom_var_init(struct si_pub *sih, void __iomem *curmap); extern void srom_free_vars(struct si_pub *sih); extern int srom_read(struct si_pub *sih, uint bus, void *curmap, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 14/15] staging: brcm80211: clean up struct brcmf_if in fullmac 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (12 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 13/15] staging: brcm80211: cleanup driver variable references Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 13:20 ` [PATCH 15/15] staging: brcm80211: remove brcmf_op_if from fullmac Arend van Spriel ` (2 subsequent siblings) 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel From: Franky Lin <frankyl@broadcom.com> Some elements in structure brcmf_if are unused at all or redundant. This patch cleans it up. Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c index 804b2bc..b0202b7 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c @@ -58,11 +58,7 @@ struct brcmf_if { struct net_device_stats stats; int idx; /* iface idx in dongle */ int state; /* interface state */ - uint subunit; /* subunit */ u8 mac_addr[ETH_ALEN]; /* assigned MAC address */ - bool attached; /* Delayed attachment when unset */ - bool txflowcontrol; /* Per interface flow control indicator */ - char name[IFNAMSIZ]; /* linux interface name */ }; /* Local private structure (extension of pub) */ @@ -100,14 +96,16 @@ static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *ndev) int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name) { int i = BRCMF_MAX_IFS; + struct brcmf_if *ifp; if (name == NULL || *name == '\0') return 0; - while (--i > 0) - if (drvr_priv->iflist[i] - && !strncmp(drvr_priv->iflist[i]->name, name, IFNAMSIZ)) + while (--i > 0) { + ifp = drvr_priv->iflist[i]; + if (ifp && !strncmp(ifp->ndev->name, name, IFNAMSIZ)) break; + } brcmf_dbg(TRACE, "return idx %d for \"%s\"\n", i, name); @@ -315,7 +313,6 @@ static void brcmf_op_if(struct brcmf_if *ifp) ret = -ENOMEM; } if (ret == 0) { - strcpy(ifp->ndev->name, ifp->name); memcpy(netdev_priv(ifp->ndev), &drvr_priv, sizeof(drvr_priv)); err = brcmf_net_attach(&drvr_priv->pub, ifp->idx); @@ -980,7 +977,6 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *ndev, memset(ifp, 0, sizeof(struct brcmf_if)); ifp->info = drvr_priv; drvr_priv->iflist[ifidx] = ifp; - strlcpy(ifp->name, name, IFNAMSIZ); if (mac_addr != NULL) memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 15/15] staging: brcm80211: remove brcmf_op_if from fullmac 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (13 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 14/15] staging: brcm80211: clean up struct brcmf_if in fullmac Arend van Spriel @ 2011-10-05 13:20 ` Arend van Spriel 2011-10-05 14:40 ` [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Hauke Mehrtens 2011-10-05 20:47 ` Greg KH 16 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel From: Franky Lin <frankyl@broadcom.com> Absorb related code into brcmf_add_if/brcmf_del_if. This is part of the net device interface clean up. Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 120 ++++++++++-------------- 1 files changed, 50 insertions(+), 70 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c index b0202b7..99ba5e3 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c @@ -282,74 +282,6 @@ _brcmf_set_mac_address(struct work_struct *work) return; } -/* Virtual interfaces only ((ifp && ifp->info && ifp->idx == true) */ -static void brcmf_op_if(struct brcmf_if *ifp) -{ - struct brcmf_info *drvr_priv; - int ret = 0, err = 0; - - drvr_priv = ifp->info; - - brcmf_dbg(TRACE, "idx %d, state %d\n", ifp->idx, ifp->state); - - switch (ifp->state) { - case BRCMF_E_IF_ADD: - /* - * Delete the existing interface before overwriting it - * in case we missed the BRCMF_E_IF_DEL event. - */ - if (ifp->ndev != NULL) { - brcmf_dbg(ERROR, "ERROR: netdev:%s already exists, try free & unregister\n", - ifp->ndev->name); - netif_stop_queue(ifp->ndev); - unregister_netdev(ifp->ndev); - free_netdev(ifp->ndev); - } - /* Allocate netdev, including space for private structure */ - ifp->ndev = alloc_netdev(sizeof(drvr_priv), "wlan%d", - ether_setup); - if (!ifp->ndev) { - brcmf_dbg(ERROR, "OOM - alloc_netdev\n"); - ret = -ENOMEM; - } - if (ret == 0) { - memcpy(netdev_priv(ifp->ndev), &drvr_priv, - sizeof(drvr_priv)); - err = brcmf_net_attach(&drvr_priv->pub, ifp->idx); - if (err != 0) { - brcmf_dbg(ERROR, "brcmf_net_attach failed, err %d\n", - err); - ret = -EOPNOTSUPP; - } else { - brcmf_dbg(TRACE, " ==== pid:%x, net_device for if:%s created ===\n", - current->pid, ifp->ndev->name); - ifp->state = 0; - } - } - break; - case BRCMF_E_IF_DEL: - if (ifp->ndev != NULL) { - brcmf_dbg(TRACE, "got 'WLC_E_IF_DEL' state\n"); - netif_stop_queue(ifp->ndev); - unregister_netdev(ifp->ndev); - ret = BRCMF_DEL_IF; /* Make sure the free_netdev() - is called */ - } - break; - default: - brcmf_dbg(ERROR, "bad op %d\n", ifp->state); - break; - } - - if (ret < 0) { - if (ifp->ndev) - free_netdev(ifp->ndev); - - drvr_priv->iflist[ifp->idx] = NULL; - kfree(ifp); - } -} - static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr) { struct brcmf_info *drvr_priv = *(struct brcmf_info **) @@ -964,6 +896,7 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *ndev, char *name, u8 *mac_addr, u32 flags, u8 bssidx) { struct brcmf_if *ifp; + int ret = 0, err = 0; brcmf_dbg(TRACE, "idx %d, handle->%p\n", ifidx, ndev); @@ -983,7 +916,48 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *ndev, if (ndev == NULL) { ifp->state = BRCMF_E_IF_ADD; ifp->idx = ifidx; - brcmf_op_if(ifp); + /* + * Delete the existing interface before overwriting it + * in case we missed the BRCMF_E_IF_DEL event. + */ + if (ifp->ndev != NULL) { + brcmf_dbg(ERROR, "ERROR: netdev:%s already exists, try free & unregister\n", + ifp->ndev->name); + netif_stop_queue(ifp->ndev); + unregister_netdev(ifp->ndev); + free_netdev(ifp->ndev); + } + + /* Allocate netdev, including space for private structure */ + ifp->ndev = alloc_netdev(sizeof(drvr_priv), "wlan%d", + ether_setup); + if (!ifp->ndev) { + brcmf_dbg(ERROR, "OOM - alloc_netdev\n"); + ret = -ENOMEM; + } + + if (ret == 0) { + memcpy(netdev_priv(ifp->ndev), &drvr_priv, + sizeof(drvr_priv)); + err = brcmf_net_attach(&drvr_priv->pub, ifp->idx); + if (err != 0) { + brcmf_dbg(ERROR, "brcmf_net_attach failed, err %d\n", + err); + ret = -EOPNOTSUPP; + } else { + brcmf_dbg(TRACE, " ==== pid:%x, net_device for if:%s created ===\n", + current->pid, ifp->ndev->name); + ifp->state = 0; + } + } + + if (ret < 0) { + if (ifp->ndev) + free_netdev(ifp->ndev); + + drvr_priv->iflist[ifp->idx] = NULL; + kfree(ifp); + } } else ifp->ndev = ndev; @@ -1004,7 +978,13 @@ void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx) ifp->state = BRCMF_E_IF_DEL; ifp->idx = ifidx; - brcmf_op_if(ifp); + if (ifp->ndev != NULL) { + netif_stop_queue(ifp->ndev); + unregister_netdev(ifp->ndev); + free_netdev(ifp->ndev); + drvr_priv->iflist[ifidx] = NULL; + kfree(ifp); + } } struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (14 preceding siblings ...) 2011-10-05 13:20 ` [PATCH 15/15] staging: brcm80211: remove brcmf_op_if from fullmac Arend van Spriel @ 2011-10-05 14:40 ` Hauke Mehrtens 2011-10-05 16:56 ` Arend van Spriel 2011-10-05 20:47 ` Greg KH 16 siblings, 1 reply; 21+ messages in thread From: Hauke Mehrtens @ 2011-10-05 14:40 UTC (permalink / raw) To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless On 10/05/2011 03:19 PM, Arend van Spriel wrote: > This series addresses more community feedback items received on mainline > patch (v2) posted August 25, 2011. The driver structures in brcmfmac could > do with some tidying and in the brcmsmac variables loaded from srom were > accessed by string identifiers. This has been replaced by enumerated > identifiers and the entries are stored in kernel standard linked list. > > This series applies to staging-next and depends on the patch series posted > on Oct 4, 2011 (see Message-ID below). > > Message-ID: <1317763152-17607-1-git-send-email-arend@broadcom.com> > > Arend van Spriel (11): > staging: brcm80211: move driver variable functions to srom.c > staging: brcm80211: remove code duplication for driver variable > lookup > staging: brcm80211: change parameter in driver variable lookup > staging: brcm80211: remove locking macro definitions > staging: brcm80211: fix thread blocking issue in > brcmf_sdbrcm_bus_stop() > staging: brcm80211: remove invalid variable lookup from srom > staging: brcm80211: use identifiers instead of string for srom lookup > staging: brcm80211: use enum identifiers in srom variable tables > staging: brcm80211: replace string based variable storage by linked > list > staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() > staging: brcm80211: cleanup driver variable references > > Franky Lin (4): > staging: brcm80211: remove threads_only code from fullmac > staging: brcm80211: remove redundant bus register layer from fullmac > staging: brcm80211: clean up struct brcmf_if in fullmac > staging: brcm80211: remove brcmf_op_if from fullmac > > drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 10 - > drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 16 +- > drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 134 +-- > drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 133 +-- > drivers/staging/brcm80211/brcmfmac/sdio_host.h | 4 - > drivers/staging/brcm80211/brcmsmac/aiutils.c | 32 +- > drivers/staging/brcm80211/brcmsmac/aiutils.h | 6 +- > drivers/staging/brcm80211/brcmsmac/antsel.c | 15 +- > drivers/staging/brcm80211/brcmsmac/channel.c | 2 +- > drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 157 ++-- > drivers/staging/brcm80211/brcmsmac/main.c | 144 +--- > drivers/staging/brcm80211/brcmsmac/main.h | 5 - > drivers/staging/brcm80211/brcmsmac/nicpci.c | 5 +- > drivers/staging/brcm80211/brcmsmac/nicpci.h | 2 +- > drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 42 +- > drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 +- > drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 7 - > drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 64 +- > drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 330 ++++-- > drivers/staging/brcm80211/brcmsmac/phy_shim.c | 9 + > drivers/staging/brcm80211/brcmsmac/phy_shim.h | 4 + > drivers/staging/brcm80211/brcmsmac/pub.h | 263 +++++- > drivers/staging/brcm80211/brcmsmac/srom.c | 1124 +++++++++++---------- > drivers/staging/brcm80211/brcmsmac/srom.h | 4 +- > drivers/staging/brcm80211/brcmsmac/stf.c | 4 +- > 25 files changed, 1342 insertions(+), 1178 deletions(-) > Hi Arend, the code handling sprom looks better that before, but why don't you use a struct for the sprom and put all the stuff into it like it is done in ssb/bcma? We have haven't observance any problem using structs in b43 on pci bus and SoCs with a nvram storing the sprom variables. I found some references to SROM4_ and other older version, but I think this driver only supports devices with sprom 8 and 9. Hauke ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup 2011-10-05 14:40 ` [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Hauke Mehrtens @ 2011-10-05 16:56 ` Arend van Spriel 0 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-05 16:56 UTC (permalink / raw) To: Hauke Mehrtens Cc: gregkh@suse.de, devel@linuxdriverproject.org, linux-wireless@vger.kernel.org On 10/05/2011 04:40 PM, Hauke Mehrtens wrote: > On 10/05/2011 03:19 PM, Arend van Spriel wrote: >> This series addresses more community feedback items received on mainline >> patch (v2) posted August 25, 2011. The driver structures in brcmfmac could >> do with some tidying and in the brcmsmac variables loaded from srom were >> accessed by string identifiers. This has been replaced by enumerated >> identifiers and the entries are stored in kernel standard linked list. >> >> This series applies to staging-next and depends on the patch series posted >> on Oct 4, 2011 (see Message-ID below). >> >> Message-ID:<1317763152-17607-1-git-send-email-arend@broadcom.com> >> >> Arend van Spriel (11): >> staging: brcm80211: move driver variable functions to srom.c >> staging: brcm80211: remove code duplication for driver variable >> lookup >> staging: brcm80211: change parameter in driver variable lookup >> staging: brcm80211: remove locking macro definitions >> staging: brcm80211: fix thread blocking issue in >> brcmf_sdbrcm_bus_stop() >> staging: brcm80211: remove invalid variable lookup from srom >> staging: brcm80211: use identifiers instead of string for srom lookup >> staging: brcm80211: use enum identifiers in srom variable tables >> staging: brcm80211: replace string based variable storage by linked >> list >> staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() >> staging: brcm80211: cleanup driver variable references >> >> Franky Lin (4): >> staging: brcm80211: remove threads_only code from fullmac >> staging: brcm80211: remove redundant bus register layer from fullmac >> staging: brcm80211: clean up struct brcmf_if in fullmac >> staging: brcm80211: remove brcmf_op_if from fullmac >> >> drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 10 - >> drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 16 +- >> drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 134 +-- >> drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 133 +-- >> drivers/staging/brcm80211/brcmfmac/sdio_host.h | 4 - >> drivers/staging/brcm80211/brcmsmac/aiutils.c | 32 +- >> drivers/staging/brcm80211/brcmsmac/aiutils.h | 6 +- >> drivers/staging/brcm80211/brcmsmac/antsel.c | 15 +- >> drivers/staging/brcm80211/brcmsmac/channel.c | 2 +- >> drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 157 ++-- >> drivers/staging/brcm80211/brcmsmac/main.c | 144 +--- >> drivers/staging/brcm80211/brcmsmac/main.h | 5 - >> drivers/staging/brcm80211/brcmsmac/nicpci.c | 5 +- >> drivers/staging/brcm80211/brcmsmac/nicpci.h | 2 +- >> drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 42 +- >> drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 4 +- >> drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 7 - >> drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 64 +- >> drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 330 ++++-- >> drivers/staging/brcm80211/brcmsmac/phy_shim.c | 9 + >> drivers/staging/brcm80211/brcmsmac/phy_shim.h | 4 + >> drivers/staging/brcm80211/brcmsmac/pub.h | 263 +++++- >> drivers/staging/brcm80211/brcmsmac/srom.c | 1124 +++++++++++---------- >> drivers/staging/brcm80211/brcmsmac/srom.h | 4 +- >> drivers/staging/brcm80211/brcmsmac/stf.c | 4 +- >> 25 files changed, 1342 insertions(+), 1178 deletions(-) >> > Hi Arend, > > the code handling sprom looks better that before, but why don't you use > a struct for the sprom and put all the stuff into it like it is done in > ssb/bcma? We have haven't observance any problem using structs in b43 on > pci bus and SoCs with a nvram storing the sprom variables. If all lookup is done during driver initialization I guess it is not such a problem. I do not know how much cycles are involved in sprom or nvram access so it may not even matter. > I found some references to SROM4_ and other older version, but I think > this driver only supports devices with sprom 8 and 9. > > Hauke Older sprom revisions can indeed go. Thanks, Arend ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel ` (15 preceding siblings ...) 2011-10-05 14:40 ` [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Hauke Mehrtens @ 2011-10-05 20:47 ` Greg KH 2011-10-06 9:56 ` Arend van Spriel 16 siblings, 1 reply; 21+ messages in thread From: Greg KH @ 2011-10-05 20:47 UTC (permalink / raw) To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless On Wed, Oct 05, 2011 at 03:19:59PM +0200, Arend van Spriel wrote: > This series addresses more community feedback items received on mainline > patch (v2) posted August 25, 2011. The driver structures in brcmfmac could > do with some tidying and in the brcmsmac variables loaded from srom were > accessed by string identifiers. This has been replaced by enumerated > identifiers and the entries are stored in kernel standard linked list. > > This series applies to staging-next and depends on the patch series posted > on Oct 4, 2011 (see Message-ID below). > > Message-ID: <1317763152-17607-1-git-send-email-arend@broadcom.com> All applied, thanks. greg k-h ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup 2011-10-05 20:47 ` Greg KH @ 2011-10-06 9:56 ` Arend van Spriel 0 siblings, 0 replies; 21+ messages in thread From: Arend van Spriel @ 2011-10-06 9:56 UTC (permalink / raw) To: Greg KH Cc: gregkh@suse.de, devel@linuxdriverproject.org, linux-wireless@vger.kernel.org On 10/05/2011 10:47 PM, Greg KH wrote: > On Wed, Oct 05, 2011 at 03:19:59PM +0200, Arend van Spriel wrote: >> This series addresses more community feedback items received on mainline >> patch (v2) posted August 25, 2011. The driver structures in brcmfmac could >> do with some tidying and in the brcmsmac variables loaded from srom were >> accessed by string identifiers. This has been replaced by enumerated >> identifiers and the entries are stored in kernel standard linked list. >> >> This series applies to staging-next and depends on the patch series posted >> on Oct 4, 2011 (see Message-ID below). >> >> Message-ID:<1317763152-17607-1-git-send-email-arend@broadcom.com> > All applied, thanks. > > greg k-h Thanks, Greg That was a speedy integration bringing the staging tree in sync with what went in the mainline patch. Gr. AvS ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2011-10-06 14:15 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel 2011-10-05 13:20 ` [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend van Spriel 2011-10-06 14:15 ` Arend Van Spriel 2011-10-05 13:20 ` [PATCH 02/15] staging: brcm80211: remove threads_only code from fullmac Arend van Spriel 2011-10-05 13:20 ` [PATCH 03/15] staging: brcm80211: remove redundant bus register layer " Arend van Spriel 2011-10-05 13:20 ` [PATCH 04/15] staging: brcm80211: remove code duplication for driver variable lookup Arend van Spriel 2011-10-05 13:20 ` [PATCH 05/15] staging: brcm80211: change parameter in " Arend van Spriel 2011-10-05 13:20 ` [PATCH 06/15] staging: brcm80211: remove locking macro definitions Arend van Spriel 2011-10-05 13:20 ` [PATCH 07/15] staging: brcm80211: fix thread blocking issue in brcmf_sdbrcm_bus_stop() Arend van Spriel 2011-10-05 13:20 ` [PATCH 08/15] staging: brcm80211: remove invalid variable lookup from srom Arend van Spriel 2011-10-05 13:20 ` [PATCH 09/15] staging: brcm80211: use identifiers instead of string for srom lookup Arend van Spriel 2011-10-05 13:20 ` [PATCH 10/15] staging: brcm80211: use enum identifiers in srom variable tables Arend van Spriel 2011-10-05 13:20 ` [PATCH 11/15] staging: brcm80211: replace string based variable storage by linked list Arend van Spriel 2011-10-05 13:20 ` [PATCH 12/15] staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() Arend van Spriel 2011-10-05 13:20 ` [PATCH 13/15] staging: brcm80211: cleanup driver variable references Arend van Spriel 2011-10-05 13:20 ` [PATCH 14/15] staging: brcm80211: clean up struct brcmf_if in fullmac Arend van Spriel 2011-10-05 13:20 ` [PATCH 15/15] staging: brcm80211: remove brcmf_op_if from fullmac Arend van Spriel 2011-10-05 14:40 ` [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Hauke Mehrtens 2011-10-05 16:56 ` Arend van Spriel 2011-10-05 20:47 ` Greg KH 2011-10-06 9:56 ` Arend van Spriel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).