diff options
author | Hante Meuleman <meuleman@broadcom.com> | 2016-02-17 13:27:07 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-03-07 15:15:50 +0300 |
commit | 4d7928959832ea41f7f91456b76da19cad01bd09 (patch) | |
tree | 413d10ce6f05c54d139c6485bbb506bb9fe36c49 /drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | |
parent | 73ef9e640e94ab6205c0bb92dc8bac53a40d952e (diff) | |
download | linux-4d7928959832ea41f7f91456b76da19cad01bd09.tar.xz |
brcmfmac: switch to new platform data
Platform data is only available for sdio. With this patch a new
platform data structure is being used which allows for platform
data for any device and configurable per device. This patch only
switches to the new structure and adds support for SDIO devices.
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c')
-rw-r--r-- | drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index 020901c2e0ca..4bd3225cdea6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -80,7 +80,7 @@ module_param_named(ignore_probe_fail, brcmf_ignore_probe_fail, int, 0); MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging"); #endif -static struct brcmfmac_sdio_platform_data *brcmfmac_pdata; +static struct brcmfmac_platform_data *brcmfmac_pdata; struct brcmf_mp_global_t brcmf_mp_global; int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) @@ -229,15 +229,46 @@ void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...) static void brcmf_mp_attach(void) { + /* If module param firmware path is set then this will always be used, + * if not set then if available use the platform data version. To make + * sure it gets initialized at all, always copy the module param version + */ strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path, BRCMF_FW_ALTPATH_LEN); + if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) && + (brcmf_mp_global.firmware_path[0] == '\0')) { + strlcpy(brcmf_mp_global.firmware_path, + brcmfmac_pdata->fw_alternative_path, + BRCMF_FW_ALTPATH_LEN); + } } -struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev) +struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev, + enum brcmf_bus_type bus_type, + u32 chip, u32 chiprev) { - if (!brcmfmac_pdata) - brcmf_of_probe(dev, &brcmfmac_pdata); - return brcmfmac_pdata; + struct brcmfmac_sdio_pd *pdata; + struct brcmfmac_pd_device *device_pd; + int i; + + if (brcmfmac_pdata) { + for (i = 0; i < brcmfmac_pdata->device_count; i++) { + device_pd = &brcmfmac_pdata->devices[i]; + if ((device_pd->bus_type == bus_type) && + (device_pd->id == chip) && + ((device_pd->rev == chiprev) || + (device_pd->rev == -1))) { + brcmf_dbg(INFO, "Platform data for device found\n"); + if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO) + return &device_pd->bus.sdio; + break; + } + } + } + pdata = NULL; + brcmf_of_probe(dev, &pdata); + + return pdata; } int brcmf_mp_device_attach(struct brcmf_pub *drvr) @@ -287,7 +318,7 @@ static int brcmf_common_pd_remove(struct platform_device *pdev) static struct platform_driver brcmf_pd = { .remove = brcmf_common_pd_remove, .driver = { - .name = BRCMFMAC_SDIO_PDATA_NAME, + .name = BRCMFMAC_PDATA_NAME, } }; |