staging: brcm80211: sdh related code cleanup

Gave struct brcmf_sdio the more applicable name 'brcmf_sdio_card'. Enforced
stronger type checking by replacing void *sdh by struct brcmf_sdio_card *.

Signed-off-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Roland Vossen 2011-07-05 22:05:58 +02:00 committed by Greg Kroah-Hartman
parent 62dd656d34
commit 127aa5cfd9
5 changed files with 345 additions and 342 deletions

View File

@ -105,7 +105,7 @@ extern int brcmf_sdioh_stop(struct sdioh_info *si);
extern int brcmf_sdioh_reset(struct sdioh_info *si);
/* Helper function */
void *brcmf_sdcard_get_sdioh(struct brcmf_sdio *sdh);
void *brcmf_sdcard_get_sdioh(struct brcmf_sdio_card *card);
/* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(bool enable);

View File

@ -13,7 +13,7 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* ****************** SDIOCARD Interface Functions ***************************/
/* ****************** SDIO CARD Interface Functions **************************/
#include <linux/types.h>
#include <linux/netdevice.h>
@ -33,7 +33,7 @@
#define SDIOH_API_ACCESS_RETRY_LIMIT 2
const uint brcmf_sdio_msglevel = BRCMF_SD_ERROR_VAL;
struct brcmf_sdio {
struct brcmf_sdio_card {
bool init_success; /* underlying driver successfully attached */
void *sdioh; /* handler for sdioh */
u32 vendevid; /* Target Vendor and Device ID on SD bus */
@ -42,13 +42,14 @@ struct brcmf_sdio {
u32 sbwad; /* Save backplane window address */
};
/* local copy of bcm sd handler */
static struct brcmf_sdio *l_card;
static struct brcmf_sdio_card *l_card;
struct brcmf_sdio *brcmf_sdcard_attach(void *cfghdl, void **regsva, uint irq)
struct brcmf_sdio_card*
brcmf_sdcard_attach(void *cfghdl, void **regsva, uint irq)
{
struct brcmf_sdio *card;
struct brcmf_sdio_card *card;
card = kzalloc(sizeof(struct brcmf_sdio), GFP_ATOMIC);
card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
if (card == NULL) {
BRCMF_SD_ERROR(("sdcard_attach: out of memory"));
return NULL;
@ -72,10 +73,8 @@ struct brcmf_sdio *brcmf_sdcard_attach(void *cfghdl, void **regsva, uint irq)
return card;
}
int brcmf_sdcard_detach(void *sdh)
int brcmf_sdcard_detach(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
if (card != NULL) {
if (card->sdioh) {
brcmf_sdioh_detach(card->sdioh);
@ -89,17 +88,15 @@ int brcmf_sdcard_detach(void *sdh)
}
int
brcmf_sdcard_iovar_op(void *sdh, const char *name,
brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
return brcmf_sdioh_iovar_op(card->sdioh, name, params, plen, arg,
len, set);
}
bool brcmf_sdcard_intr_query(void *sdh)
bool brcmf_sdcard_intr_query(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
bool on;
@ -111,59 +108,57 @@ bool brcmf_sdcard_intr_query(void *sdh)
return on;
}
int brcmf_sdcard_intr_enable(void *sdh)
int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
ASSERT(card);
return brcmf_sdioh_interrupt_set(card->sdioh, true);
}
int brcmf_sdcard_intr_disable(void *sdh)
int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
ASSERT(card);
return brcmf_sdioh_interrupt_set(card->sdioh, false);
}
int brcmf_sdcard_intr_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh)
int brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card,
brcmf_sdiocard_cb_fn_t fn,
void *argh)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
ASSERT(card);
return brcmf_sdioh_interrupt_register(card->sdioh, fn, argh);
}
int brcmf_sdcard_intr_dereg(void *sdh)
int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
ASSERT(card);
return brcmf_sdioh_interrupt_deregister(card->sdioh);
}
#if defined(BCMDBG)
bool brcmf_sdcard_intr_pending(void *sdh)
bool brcmf_sdcard_intr_pending(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
ASSERT(sdh);
ASSERT(card);
return brcmf_sdioh_interrupt_pending(card->sdioh);
}
#endif
int brcmf_sdcard_devremove_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh)
int brcmf_sdcard_devremove_reg(struct brcmf_sdio_card *card,
brcmf_sdiocard_cb_fn_t fn,
void *argh)
{
ASSERT(sdh);
ASSERT(card);
/* don't support yet */
return -ENOTSUPP;
}
u8 brcmf_sdcard_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err)
u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
int *err)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
s32 retry = 0;
@ -197,9 +192,9 @@ u8 brcmf_sdcard_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err)
}
void
brcmf_sdcard_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err)
brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
u8 data, int *err)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
s32 retry = 0;
@ -229,9 +224,9 @@ brcmf_sdcard_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err)
__func__, fnc_num, addr, data));
}
u32 brcmf_sdcard_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err)
u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
u32 addr, int *err)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
u32 data = 0;
@ -253,10 +248,9 @@ u32 brcmf_sdcard_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err)
}
void
brcmf_sdcard_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data,
int *err)
brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
u32 addr, u32 data, int *err)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
if (!card)
@ -275,9 +269,9 @@ brcmf_sdcard_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data,
__func__, fnc_num, addr, data));
}
int brcmf_sdcard_cis_read(void *sdh, uint func, u8 * cis, uint length)
int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
uint length)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
u8 *tmp_buf, *tmp_ptr;
@ -315,10 +309,10 @@ int brcmf_sdcard_cis_read(void *sdh, uint func, u8 * cis, uint length)
return status;
}
static int brcmf_sdcard_set_sbaddr_window(void *sdh, u32 address)
static int
brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address)
{
int err = 0;
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
(address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
if (!err)
@ -335,9 +329,8 @@ static int brcmf_sdcard_set_sbaddr_window(void *sdh, u32 address)
return err;
}
u32 brcmf_sdcard_reg_read(void *sdh, u32 addr, uint size)
u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
u32 word = 0;
uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
@ -388,9 +381,9 @@ u32 brcmf_sdcard_reg_read(void *sdh, u32 addr, uint size)
return 0xFFFFFFFF;
}
u32 brcmf_sdcard_reg_write(void *sdh, u32 addr, uint size, u32 data)
u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
u32 data)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
int status;
uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
int err = 0;
@ -427,15 +420,16 @@ u32 brcmf_sdcard_reg_write(void *sdh, u32 addr, uint size, u32 data)
return 0xFFFFFFFF;
}
bool brcmf_sdcard_regfail(void *sdh)
bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card)
{
return ((struct brcmf_sdio *) sdh)->regfail;
return card->regfail;
}
int
brcmf_sdcard_recv_buf(struct brcmf_sdio *card, u32 addr, uint fn, uint flags,
u8 *buf, uint nbytes, struct sk_buff *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle)
brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
uint flags,
u8 *buf, uint nbytes, struct sk_buff *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle)
{
int status;
uint incr_fix;
@ -476,11 +470,10 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio *card, u32 addr, uint fn, uint flags,
}
int
brcmf_sdcard_send_buf(void *sdh, u32 addr, uint fn, uint flags,
u8 *buf, uint nbytes, void *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle)
brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, void *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
uint incr_fix;
uint width;
uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
@ -516,10 +509,9 @@ brcmf_sdcard_send_buf(void *sdh, u32 addr, uint fn, uint flags,
incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
}
int brcmf_sdcard_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)
int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
u8 *buf, uint nbytes)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
ASSERT(card);
ASSERT(card->init_success);
ASSERT((addr & SBSDIO_SBWINDOW_MASK) == 0);
@ -532,74 +524,61 @@ int brcmf_sdcard_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)
addr, 4, nbytes, buf, NULL);
}
int brcmf_sdcard_abort(void *sdh, uint fn)
int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
return brcmf_sdioh_abort(card->sdioh, fn);
}
int brcmf_sdcard_start(void *sdh, int stage)
int brcmf_sdcard_start(struct brcmf_sdio_card *card, int stage)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
return brcmf_sdioh_start(card->sdioh, stage);
}
int brcmf_sdcard_stop(void *sdh)
int brcmf_sdcard_stop(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
return brcmf_sdioh_stop(card->sdioh);
}
int brcmf_sdcard_query_device(void *sdh)
int brcmf_sdcard_query_device(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
card->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0;
return card->vendevid;
}
uint brcmf_sdcard_query_iofnum(void *sdh)
uint brcmf_sdcard_query_iofnum(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
if (!card)
card = l_card;
return brcmf_sdioh_query_iofnum(card->sdioh);
}
int brcmf_sdcard_reset(struct brcmf_sdio *sdh)
int brcmf_sdcard_reset(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
return brcmf_sdioh_reset(card->sdioh);
}
void *brcmf_sdcard_get_sdioh(struct brcmf_sdio *sdh)
void *brcmf_sdcard_get_sdioh(struct brcmf_sdio_card *card)
{
ASSERT(sdh);
return sdh->sdioh;
ASSERT(card);
return card->sdioh;
}
/* Function to pass device-status bits to DHD. */
u32 brcmf_sdcard_get_dstatus(void *sdh)
u32 brcmf_sdcard_get_dstatus(struct brcmf_sdio_card *card)
{
return 0;
}
u32 brcmf_sdcard_cur_sbwad(void *sdh)
u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
{
struct brcmf_sdio *card = (struct brcmf_sdio *) sdh;
if (!card)
card = l_card;
return card->sbwad;
}
void brcmf_sdcard_chipinfo(void *sdh, u32 chip, u32 chiprev)
void brcmf_sdcard_chipinfo(struct brcmf_sdio_card *card, u32 chip, u32 chiprev)
{
return;
}

View File

@ -42,7 +42,7 @@ struct sdio_hc {
struct sdio_hc *next;
struct device *dev; /* platform device handle */
void *regs; /* SDIO Host Controller address */
struct brcmf_sdio *sdh; /* SDIO Host Controller handle */
struct brcmf_sdio_card *card;
void *ch;
unsigned int oob_irq;
unsigned long oob_flags; /* OOB Host specifiction
@ -113,7 +113,7 @@ int brcmf_sdio_probe(struct device *dev)
{
struct sdio_hc *sdhc = NULL;
unsigned long regs = 0;
struct brcmf_sdio *sdh = NULL;
struct brcmf_sdio_card *card = NULL;
int irq = 0;
u32 vendevid;
unsigned long irq_flags = 0;
@ -126,13 +126,13 @@ int brcmf_sdio_probe(struct device *dev)
}
sdhc->dev = (void *)dev;
sdh = brcmf_sdcard_attach((void *)0, (void **)&regs, irq);
if (!sdh) {
card = brcmf_sdcard_attach((void *)0, (void **)&regs, irq);
if (!card) {
SDLX_MSG(("%s: attach failed\n", __func__));
goto err;
}
sdhc->sdh = sdh;
sdhc->card = card;
sdhc->oob_irq = irq;
sdhc->oob_flags = irq_flags;
sdhc->oob_irq_registered = false; /* to make sure.. */
@ -141,11 +141,11 @@ int brcmf_sdio_probe(struct device *dev)
sdhc->next = sdhcinfo;
sdhcinfo = sdhc;
/* Read the vendor/device ID from the CIS */
vendevid = brcmf_sdcard_query_device(sdh);
vendevid = brcmf_sdcard_query_device(card);
/* try to attach to the target device */
sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
0, 0, 0, 0, (void *)regs, sdh);
0, 0, 0, 0, (void *)regs, card);
if (!sdhc->ch) {
SDLX_MSG(("%s: device attach failed\n", __func__));
goto err;
@ -156,8 +156,8 @@ int brcmf_sdio_probe(struct device *dev)
/* error handling */
err:
if (sdhc) {
if (sdhc->sdh)
brcmf_sdcard_detach(sdhc->sdh);
if (sdhc->card)
brcmf_sdcard_detach(sdhc->card);
kfree(sdhc);
}
@ -170,7 +170,7 @@ int brcmf_sdio_remove(struct device *dev)
sdhc = sdhcinfo;
drvinfo.detach(sdhc->ch);
brcmf_sdcard_detach(sdhc->sdh);
brcmf_sdcard_detach(sdhc->card);
/* find the SDIO Host Controller state for this pdev
and take it out from the list */
for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) {

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,7 @@ extern const uint brcmf_sdio_msglevel;
#define SDIOD_MAX_IOFUNCS 7
/* forward declarations */
struct brcmf_sdio;
struct brcmf_sdio_card;
typedef void (*brcmf_sdiocard_cb_fn_t) (void *);
/* Attach and build an interface to the underlying SD host driver.
@ -73,35 +73,38 @@ typedef void (*brcmf_sdiocard_cb_fn_t) (void *);
* implementation may maintain a single "default" handle (e.g. the first or
* most recent one) to enable single-instance implementations to pass NULL.
*/
extern struct brcmf_sdio *brcmf_sdcard_attach(void *cfghdl, void **regsva,
extern struct brcmf_sdio_card *brcmf_sdcard_attach(void *cfghdl, void **regsva,
uint irq);
/* Detach - freeup resources allocated in attach */
extern int brcmf_sdcard_detach(void *sdh);
extern int brcmf_sdcard_detach(struct brcmf_sdio_card *card);
/* Query if SD device interrupts are enabled */
extern bool brcmf_sdcard_intr_query(void *sdh);
extern bool brcmf_sdcard_intr_query(struct brcmf_sdio_card *card);
/* Enable/disable SD interrupt */
extern int brcmf_sdcard_intr_enable(void *sdh);
extern int brcmf_sdcard_intr_disable(void *sdh);
extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card);
extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card);
/* Register/deregister device interrupt handler. */
extern int
brcmf_sdcard_intr_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh);
brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card, brcmf_sdiocard_cb_fn_t fn,
void *argh);
extern int brcmf_sdcard_intr_dereg(void *sdh);
extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card);
#if defined(BCMDBG)
/* Query pending interrupt status from the host controller */
extern bool brcmf_sdcard_intr_pending(void *sdh);
extern bool brcmf_sdcard_intr_pending(struct brcmf_sdio_card *card);
#endif
/* Register a callback to be called on device removal.
* No-op in the case of non-removable/hardwired devices.
*/
extern int
brcmf_sdcard_devremove_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh);
brcmf_sdcard_devremove_reg(struct brcmf_sdio_card *card,
brcmf_sdiocard_cb_fn_t fn,
void *argh);
/* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface).
* fn: function number
@ -109,15 +112,19 @@ brcmf_sdcard_devremove_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh);
* data: data byte to write
* err: pointer to error code (or NULL)
*/
extern u8 brcmf_sdcard_cfg_read(void *sdh, uint func, u32 addr, int *err);
extern void brcmf_sdcard_cfg_write(void *sdh, uint func, u32 addr, u8 data,
int *err);
extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint func,
u32 addr, int *err);
extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint func,
u32 addr, u8 data, int *err);
/* Read/Write 4bytes from/to cfg space */
extern u32 brcmf_sdcard_cfg_read_word(void *sdh, uint fnc_num, u32 addr,
int *err);
extern void brcmf_sdcard_cfg_write_word(void *sdh, uint fnc_num, u32 addr,
u32 data, int *err);
extern u32
brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
u32 addr, int *err);
extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card,
uint fnc_num, u32 addr,
u32 data, int *err);
/* Read CIS content for specified function.
* fn: function whose CIS is being requested (0 is common CIS)
@ -126,18 +133,23 @@ extern void brcmf_sdcard_cfg_write_word(void *sdh, uint fnc_num, u32 addr,
* Internally, this routine uses the values from the cis base regs (0x9-0xB)
* to form an SDIO-space address to read the data from.
*/
extern int brcmf_sdcard_cis_read(void *sdh, uint func, u8 *cis, uint length);
extern int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func,
u8 *cis, uint length);
/* Synchronous access to device (client) core registers via CMD53 to F1.
* addr: backplane address (i.e. >= regsva from attach)
* size: register width in bytes (2 or 4)
* data: data for register write
*/
extern u32 brcmf_sdcard_reg_read(void *sdh, u32 addr, uint size);
extern u32 brcmf_sdcard_reg_write(void *sdh, u32 addr, uint size, u32 data);
extern u32
brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size);
extern u32
brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
u32 data);
/* Indicate if last reg read/write failed */
extern bool brcmf_sdcard_regfail(void *sdh);
extern bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card);
/* Buffer transfer to/from device (client) core via cmd53.
* fn: function number
@ -153,12 +165,14 @@ extern bool brcmf_sdcard_regfail(void *sdh);
*/
typedef void (*brcmf_sdio_cmplt_fn_t)
(void *handle, int status, bool sync_waiting);
extern int brcmf_sdcard_send_buf(void *sdh, u32 addr, uint fn, uint flags,
u8 *buf, uint nbytes, void *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle);
extern int brcmf_sdcard_recv_buf(struct brcmf_sdio *sdh, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle);
extern int
brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, void *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle);
extern int
brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle);
/* Flags bits */
#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */
@ -175,35 +189,35 @@ extern int brcmf_sdcard_recv_buf(struct brcmf_sdio *sdh, u32 addr, uint fn,
* nbytes: number of bytes to transfer to/from buf
* Returns 0 or error code.
*/
extern int brcmf_sdcard_rwdata(void *sdh, uint rw, u32 addr, u8 *buf,
uint nbytes);
extern int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
u8 *buf, uint nbytes);
/* Issue an abort to the specified function */
extern int brcmf_sdcard_abort(void *sdh, uint fn);
extern int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn);
/* Start SDIO Host Controller communication */
extern int brcmf_sdcard_start(void *sdh, int stage);
extern int brcmf_sdcard_start(struct brcmf_sdio_card *card, int stage);
/* Stop SDIO Host Controller communication */
extern int brcmf_sdcard_stop(void *sdh);
extern int brcmf_sdcard_stop(struct brcmf_sdio_card *card);
/* Returns the "Device ID" of target device on the SDIO bus. */
extern int brcmf_sdcard_query_device(void *sdh);
extern int brcmf_sdcard_query_device(struct brcmf_sdio_card *card);
/* Returns the number of IO functions reported by the device */
extern uint brcmf_sdcard_query_iofnum(void *sdh);
extern uint brcmf_sdcard_query_iofnum(struct brcmf_sdio_card *card);
/* Miscellaneous knob tweaker. */
extern int brcmf_sdcard_iovar_op(void *sdh, const char *name,
void *params, int plen, void *arg, int len,
bool set);
extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
void *params, int plen, void *arg, int len,
bool set);
/* Reset and reinitialize the device */
extern int brcmf_sdcard_reset(struct brcmf_sdio *sdh);
extern int brcmf_sdcard_reset(struct brcmf_sdio_card *card);
/* helper functions */
extern void *brcmf_sdcard_get_sdioh(struct brcmf_sdio *sdh);
extern void *brcmf_sdcard_get_sdioh(struct brcmf_sdio_card *card);
/* callback functions */
struct brcmf_sdioh_driver {
@ -221,7 +235,7 @@ extern int brcmf_sdio_function_init(void);
extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver);
extern void brcmf_sdio_unregister(void);
extern bool brcmf_sdio_chipmatch(u16 vendor, u16 device);
extern void brcmf_sdio_device_remove(void *sdh);
extern void brcmf_sdio_device_remove(void *card);
extern void brcmf_sdio_function_cleanup(void);
extern void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd);
@ -230,12 +244,13 @@ extern int brcmf_sdio_probe(struct device *dev);
extern int brcmf_sdio_remove(struct device *dev);
/* Function to pass device-status bits to DHD. */
extern u32 brcmf_sdcard_get_dstatus(void *sdh);
extern u32 brcmf_sdcard_get_dstatus(struct brcmf_sdio_card *card);
/* Function to return current window addr */
extern u32 brcmf_sdcard_cur_sbwad(void *sdh);
extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card);
/* Function to pass chipid and rev to lower layers for controlling pr's */
extern void brcmf_sdcard_chipinfo(void *sdh, u32 chip, u32 chiprev);
extern void brcmf_sdcard_chipinfo(struct brcmf_sdio_card *card, u32 chip,
u32 chiprev);
#endif /* _BRCM_SDH_H_ */