Commit 127aa5cf authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

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: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 62dd656d
...@@ -105,7 +105,7 @@ extern int brcmf_sdioh_stop(struct sdioh_info *si); ...@@ -105,7 +105,7 @@ extern int brcmf_sdioh_stop(struct sdioh_info *si);
extern int brcmf_sdioh_reset(struct sdioh_info *si); extern int brcmf_sdioh_reset(struct sdioh_info *si);
/* Helper function */ /* 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 */ /* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(bool enable); extern void brcmf_sdio_wdtmr_enable(bool enable);
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ struct sdio_hc { ...@@ -42,7 +42,7 @@ struct sdio_hc {
struct sdio_hc *next; struct sdio_hc *next;
struct device *dev; /* platform device handle */ struct device *dev; /* platform device handle */
void *regs; /* SDIO Host Controller address */ void *regs; /* SDIO Host Controller address */
struct brcmf_sdio *sdh; /* SDIO Host Controller handle */ struct brcmf_sdio_card *card;
void *ch; void *ch;
unsigned int oob_irq; unsigned int oob_irq;
unsigned long oob_flags; /* OOB Host specifiction unsigned long oob_flags; /* OOB Host specifiction
...@@ -113,7 +113,7 @@ int brcmf_sdio_probe(struct device *dev) ...@@ -113,7 +113,7 @@ int brcmf_sdio_probe(struct device *dev)
{ {
struct sdio_hc *sdhc = NULL; struct sdio_hc *sdhc = NULL;
unsigned long regs = 0; unsigned long regs = 0;
struct brcmf_sdio *sdh = NULL; struct brcmf_sdio_card *card = NULL;
int irq = 0; int irq = 0;
u32 vendevid; u32 vendevid;
unsigned long irq_flags = 0; unsigned long irq_flags = 0;
...@@ -126,13 +126,13 @@ int brcmf_sdio_probe(struct device *dev) ...@@ -126,13 +126,13 @@ int brcmf_sdio_probe(struct device *dev)
} }
sdhc->dev = (void *)dev; sdhc->dev = (void *)dev;
sdh = brcmf_sdcard_attach((void *)0, (void **)&regs, irq); card = brcmf_sdcard_attach((void *)0, (void **)&regs, irq);
if (!sdh) { if (!card) {
SDLX_MSG(("%s: attach failed\n", __func__)); SDLX_MSG(("%s: attach failed\n", __func__));
goto err; goto err;
} }
sdhc->sdh = sdh; sdhc->card = card;
sdhc->oob_irq = irq; sdhc->oob_irq = irq;
sdhc->oob_flags = irq_flags; sdhc->oob_flags = irq_flags;
sdhc->oob_irq_registered = false; /* to make sure.. */ sdhc->oob_irq_registered = false; /* to make sure.. */
...@@ -141,11 +141,11 @@ int brcmf_sdio_probe(struct device *dev) ...@@ -141,11 +141,11 @@ int brcmf_sdio_probe(struct device *dev)
sdhc->next = sdhcinfo; sdhc->next = sdhcinfo;
sdhcinfo = sdhc; sdhcinfo = sdhc;
/* Read the vendor/device ID from the CIS */ /* 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 */ /* try to attach to the target device */
sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF), 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) { if (!sdhc->ch) {
SDLX_MSG(("%s: device attach failed\n", __func__)); SDLX_MSG(("%s: device attach failed\n", __func__));
goto err; goto err;
...@@ -156,8 +156,8 @@ int brcmf_sdio_probe(struct device *dev) ...@@ -156,8 +156,8 @@ int brcmf_sdio_probe(struct device *dev)
/* error handling */ /* error handling */
err: err:
if (sdhc) { if (sdhc) {
if (sdhc->sdh) if (sdhc->card)
brcmf_sdcard_detach(sdhc->sdh); brcmf_sdcard_detach(sdhc->card);
kfree(sdhc); kfree(sdhc);
} }
...@@ -170,7 +170,7 @@ int brcmf_sdio_remove(struct device *dev) ...@@ -170,7 +170,7 @@ int brcmf_sdio_remove(struct device *dev)
sdhc = sdhcinfo; sdhc = sdhcinfo;
drvinfo.detach(sdhc->ch); drvinfo.detach(sdhc->ch);
brcmf_sdcard_detach(sdhc->sdh); brcmf_sdcard_detach(sdhc->card);
/* find the SDIO Host Controller state for this pdev /* find the SDIO Host Controller state for this pdev
and take it out from the list */ and take it out from the list */
for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) { for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) {
......
...@@ -62,7 +62,7 @@ extern const uint brcmf_sdio_msglevel; ...@@ -62,7 +62,7 @@ extern const uint brcmf_sdio_msglevel;
#define SDIOD_MAX_IOFUNCS 7 #define SDIOD_MAX_IOFUNCS 7
/* forward declarations */ /* forward declarations */
struct brcmf_sdio; struct brcmf_sdio_card;
typedef void (*brcmf_sdiocard_cb_fn_t) (void *); typedef void (*brcmf_sdiocard_cb_fn_t) (void *);
/* Attach and build an interface to the underlying SD host driver. /* Attach and build an interface to the underlying SD host driver.
...@@ -73,35 +73,38 @@ typedef void (*brcmf_sdiocard_cb_fn_t) (void *); ...@@ -73,35 +73,38 @@ typedef void (*brcmf_sdiocard_cb_fn_t) (void *);
* implementation may maintain a single "default" handle (e.g. the first or * implementation may maintain a single "default" handle (e.g. the first or
* most recent one) to enable single-instance implementations to pass NULL. * 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); uint irq);
/* Detach - freeup resources allocated in attach */ /* 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 */ /* 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 */ /* Enable/disable SD interrupt */
extern int brcmf_sdcard_intr_enable(void *sdh); extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card);
extern int brcmf_sdcard_intr_disable(void *sdh); extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card);
/* Register/deregister device interrupt handler. */ /* Register/deregister device interrupt handler. */
extern int 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) #if defined(BCMDBG)
/* Query pending interrupt status from the host controller */ /* 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 #endif
/* Register a callback to be called on device removal. /* Register a callback to be called on device removal.
* No-op in the case of non-removable/hardwired devices. * No-op in the case of non-removable/hardwired devices.
*/ */
extern int 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). /* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface).
* fn: function number * fn: function number
...@@ -109,15 +112,19 @@ brcmf_sdcard_devremove_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh); ...@@ -109,15 +112,19 @@ brcmf_sdcard_devremove_reg(void *sdh, brcmf_sdiocard_cb_fn_t fn, void *argh);
* data: data byte to write * data: data byte to write
* err: pointer to error code (or NULL) * err: pointer to error code (or NULL)
*/ */
extern u8 brcmf_sdcard_cfg_read(void *sdh, uint func, u32 addr, int *err); extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint func,
extern void brcmf_sdcard_cfg_write(void *sdh, uint func, u32 addr, u8 data, u32 addr, int *err);
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 */ /* Read/Write 4bytes from/to cfg space */
extern u32 brcmf_sdcard_cfg_read_word(void *sdh, uint fnc_num, u32 addr, extern u32
int *err); brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
extern void brcmf_sdcard_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 addr, int *err);
u32 data, 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. /* Read CIS content for specified function.
* fn: function whose CIS is being requested (0 is common CIS) * 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, ...@@ -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) * Internally, this routine uses the values from the cis base regs (0x9-0xB)
* to form an SDIO-space address to read the data from. * 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. /* Synchronous access to device (client) core registers via CMD53 to F1.
* addr: backplane address (i.e. >= regsva from attach) * addr: backplane address (i.e. >= regsva from attach)
* size: register width in bytes (2 or 4) * size: register width in bytes (2 or 4)
* data: data for register write * data: data for register write
*/ */
extern u32 brcmf_sdcard_reg_read(void *sdh, u32 addr, uint size); extern u32
extern u32 brcmf_sdcard_reg_write(void *sdh, u32 addr, uint size, u32 data); 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 */ /* 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. /* Buffer transfer to/from device (client) core via cmd53.
* fn: function number * fn: function number
...@@ -153,12 +165,14 @@ extern bool brcmf_sdcard_regfail(void *sdh); ...@@ -153,12 +165,14 @@ extern bool brcmf_sdcard_regfail(void *sdh);
*/ */
typedef void (*brcmf_sdio_cmplt_fn_t) typedef void (*brcmf_sdio_cmplt_fn_t)
(void *handle, int status, bool sync_waiting); (void *handle, int status, bool sync_waiting);
extern int brcmf_sdcard_send_buf(void *sdh, u32 addr, uint fn, uint flags, extern int
u8 *buf, uint nbytes, void *pkt, brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
brcmf_sdio_cmplt_fn_t complete, void *handle); uint flags, u8 *buf, uint nbytes, void *pkt,
extern int brcmf_sdcard_recv_buf(struct brcmf_sdio *sdh, u32 addr, uint fn, brcmf_sdio_cmplt_fn_t complete, void *handle);
uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt, extern int
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);
/* Flags bits */ /* Flags bits */
#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */ #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, ...@@ -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 * nbytes: number of bytes to transfer to/from buf
* Returns 0 or error code. * Returns 0 or error code.
*/ */
extern int brcmf_sdcard_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, extern int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
uint nbytes); u8 *buf, uint nbytes);
/* Issue an abort to the specified function */ /* 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 */ /* 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 */ /* 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. */ /* 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 */ /* 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. */ /* Miscellaneous knob tweaker. */
extern int brcmf_sdcard_iovar_op(void *sdh, const char *name, extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
void *params, int plen, void *arg, int len, void *params, int plen, void *arg, int len,
bool set); bool set);
/* Reset and reinitialize the device */ /* 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 */ /* 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 */ /* callback functions */
struct brcmf_sdioh_driver { struct brcmf_sdioh_driver {
...@@ -221,7 +235,7 @@ extern int brcmf_sdio_function_init(void); ...@@ -221,7 +235,7 @@ extern int brcmf_sdio_function_init(void);
extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver); extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver);
extern void brcmf_sdio_unregister(void); extern void brcmf_sdio_unregister(void);
extern bool brcmf_sdio_chipmatch(u16 vendor, u16 device); 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_sdio_function_cleanup(void);
extern void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd); extern void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd);
...@@ -230,12 +244,13 @@ extern int brcmf_sdio_probe(struct device *dev); ...@@ -230,12 +244,13 @@ extern int brcmf_sdio_probe(struct device *dev);
extern int brcmf_sdio_remove(struct device *dev); extern int brcmf_sdio_remove(struct device *dev);
/* Function to pass device-status bits to DHD. */ /* 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 */ /* 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 */ /* 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_ */ #endif /* _BRCM_SDH_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment