diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/bcmsdh.c')
-rw-r--r-- | drivers/net/wireless/bcmdhd/bcmsdh.c | 95 |
1 files changed, 28 insertions, 67 deletions
diff --git a/drivers/net/wireless/bcmdhd/bcmsdh.c b/drivers/net/wireless/bcmdhd/bcmsdh.c index b65dbdc..4fa2110 100644 --- a/drivers/net/wireless/bcmdhd/bcmsdh.c +++ b/drivers/net/wireless/bcmdhd/bcmsdh.c @@ -2,7 +2,7 @@ * BCMSDH interface glue * implement bcmsdh API for SDIOH driver * - * Copyright (C) 1999-2012, Broadcom Corporation + * Copyright (C) 1999-2014, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -22,7 +22,7 @@ * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * - * $Id: bcmsdh.c 369547 2012-11-19 08:57:31Z $ + * $Id: bcmsdh.c 455573 2014-02-14 17:49:31Z $ */ /** @@ -42,31 +42,15 @@ #include <bcmsdh.h> /* BRCM API for SDIO clients (such as wl, dhd) */ #include <bcmsdbus.h> /* common SDIO/controller interface */ #include <sbsdio.h> /* SDIO device core hardware definitions. */ - #include <sdio.h> /* SDIO Device and Protocol Specs */ -#ifdef CUSTOMER_HW4 -#include <dhd_sec_feature.h> -#endif /* CUSTOMER_HW4 */ - #define SDIOH_API_ACCESS_RETRY_LIMIT 2 const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL; -/** - * BCMSDH API context - */ -struct bcmsdh_info -{ - bool init_success; /* underlying driver successfully attached */ - void *sdioh; /* handler for sdioh */ - uint32 vendevid; /* Target Vendor and Device ID on SD bus */ - osl_t *osh; - bool regfail; /* Save status of last reg_read/reg_write call */ - uint32 sbwad; /* Save backplane window address */ -}; /* local copy of bcm sd handler */ bcmsdh_info_t * l_bcmsdh = NULL; + #if defined(OOB_INTR_ONLY) && defined(HW_OOB) extern int sdioh_enable_hw_oob_intr(void *sdioh, bool enable); @@ -88,7 +72,7 @@ bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable) * @return bcmsdh_info_t Handle to BCMSDH context. */ bcmsdh_info_t * -bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq) +bcmsdh_attach(osl_t *osh, void *sdioh, ulong *regsva) { bcmsdh_info_t *bcmsdh; @@ -97,22 +81,17 @@ bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq) return NULL; } bzero((char *)bcmsdh, sizeof(bcmsdh_info_t)); - - /* save the handler locally */ - l_bcmsdh = bcmsdh; - - if (!(bcmsdh->sdioh = sdioh_attach(osh, cfghdl, irq))) { - bcmsdh_detach(osh, bcmsdh); - return NULL; - } - + bcmsdh->sdioh = sdioh; bcmsdh->osh = osh; bcmsdh->init_success = TRUE; - - *regsva = (uint32 *)SI_ENUM_BASE; + *regsva = SI_ENUM_BASE; /* Report the BAR, to fix if needed */ bcmsdh->sbwad = SI_ENUM_BASE; + + /* save the handler locally */ + l_bcmsdh = bcmsdh; + return bcmsdh; } @@ -122,14 +101,11 @@ bcmsdh_detach(osl_t *osh, void *sdh) bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; if (bcmsdh != NULL) { - if (bcmsdh->sdioh) { - sdioh_detach(osh, bcmsdh->sdioh); - bcmsdh->sdioh = NULL; - } MFREE(osh, bcmsdh, sizeof(bcmsdh_info_t)); } l_bcmsdh = NULL; + return 0; } @@ -161,9 +137,17 @@ bcmsdh_intr_enable(void *sdh) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; SDIOH_API_RC status; +#ifdef BCMSPI_ANDROID + uint32 data; +#endif /* BCMSPI_ANDROID */ ASSERT(bcmsdh); status = sdioh_interrupt_set(bcmsdh->sdioh, TRUE); +#ifdef BCMSPI_ANDROID + data = bcmsdh_cfg_read_word(sdh, 0, 4, NULL); + data |= 0xE0E70000; + bcmsdh_cfg_write_word(sdh, 0, 4, data, NULL); +#endif /* BCMSPI_ANDROID */ return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); } @@ -172,9 +156,17 @@ bcmsdh_intr_disable(void *sdh) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; SDIOH_API_RC status; +#ifdef BCMSPI_ANDROID + uint32 data; +#endif /* BCMSPI_ANDROID */ ASSERT(bcmsdh); status = sdioh_interrupt_set(bcmsdh->sdioh, FALSE); +#ifdef BCMSPI_ANDROID + data = bcmsdh_cfg_read_word(sdh, 0, 4, NULL); + data &= ~0xE0E70000; + bcmsdh_cfg_write_word(sdh, 0, 4, data, NULL); +#endif /* BCMSPI_ANDROID */ return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); } @@ -617,14 +609,12 @@ int bcmsdh_waitlockfree(void *sdh) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - if (!bcmsdh) - bcmsdh = l_bcmsdh; return sdioh_waitlockfree(bcmsdh->sdioh); } -#ifdef BCMSPI /* 4329 gSPI won't have CIS reads. */ +#ifdef BCMSPI /* 4329 gSPI won't have CIS reads. */ int bcmsdh_query_device(void *sdh) { @@ -763,32 +753,3 @@ bcmsdh_gpioout(void *sdh, uint32 gpio, bool enab) return sdioh_gpioout(sd, gpio, enab); } - -#ifdef BCMSDIOH_TXGLOM -void -bcmsdh_glom_post(void *sdh, uint8 *frame, void *pkt, uint len) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - sdioh_glom_post(bcmsdh->sdioh, frame, pkt, len); -} - -void -bcmsdh_glom_clear(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - sdioh_glom_clear(bcmsdh->sdioh); -} - -uint -bcmsdh_set_mode(void *sdh, uint mode) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - return (sdioh_set_mode(bcmsdh->sdioh, mode)); -} - -bool -bcmsdh_glom_enabled(void) -{ - return (sdioh_glom_enabled()); -} -#endif /* BCMSDIOH_TXGLOM */ |