Commit b73b2f9e authored by Franky Lin's avatar Franky Lin Committed by Greg Kroah-Hartman

staging: brcm80211: remove struct sdioh_info from brcmfmac

Use brcmf_sdio_dev as the unified structure to store information
of device.
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c9ed29ac
...@@ -49,18 +49,18 @@ int ...@@ -49,18 +49,18 @@ int
brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name, brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
void *params, int plen, void *arg, int len, bool set) void *params, int plen, void *arg, int len, bool set)
{ {
return brcmf_sdioh_iovar_op(sdiodev->sdioh, name, params, plen, arg, return brcmf_sdioh_iovar_op(sdiodev, name, params, plen, arg,
len, set); len, set);
} }
int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev) int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)
{ {
return brcmf_sdioh_interrupt_register(sdiodev->sdioh); return brcmf_sdioh_interrupt_register();
} }
int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev) int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
{ {
return brcmf_sdioh_interrupt_deregister(sdiodev->sdioh); return brcmf_sdioh_interrupt_deregister();
} }
u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr, u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
...@@ -74,7 +74,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr, ...@@ -74,7 +74,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
if (retry) /* wait for 1 ms till bus get settled down */ if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000); udelay(1000);
status = status =
brcmf_sdioh_cfg_read(sdiodev->sdioh, fnc_num, addr, brcmf_sdioh_cfg_read(sdiodev, fnc_num, addr,
(u8 *) &data); (u8 *) &data);
} while (status != 0 } while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
...@@ -98,7 +98,7 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr, ...@@ -98,7 +98,7 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
if (retry) /* wait for 1 ms till bus get settled down */ if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000); udelay(1000);
status = status =
brcmf_sdioh_cfg_write(sdiodev->sdioh, fnc_num, addr, brcmf_sdioh_cfg_write(sdiodev, fnc_num, addr,
(u8 *) &data); (u8 *) &data);
} while (status != 0 } while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
...@@ -119,7 +119,7 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis, ...@@ -119,7 +119,7 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis,
bool ascii = func & ~0xf; bool ascii = func & ~0xf;
func &= 0x7; func &= 0x7;
status = brcmf_sdioh_cis_read(sdiodev->sdioh, func, cis, length); status = brcmf_sdioh_cis_read(sdiodev, func, cis, length);
if (ascii) { if (ascii) {
/* Move binary bits to tmp and format them /* Move binary bits to tmp and format them
...@@ -181,7 +181,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size) ...@@ -181,7 +181,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size)
if (size == 4) if (size == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL, status = brcmf_sdioh_request_word(sdiodev, SDIOH_CMD_TYPE_NORMAL,
SDIOH_READ, SDIO_FUNC_1, addr, &word, size); SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
sdiodev->regfail = (status != 0); sdiodev->regfail = (status != 0);
...@@ -231,7 +231,7 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size, ...@@ -231,7 +231,7 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size,
if (size == 4) if (size == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
status = status =
brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL, brcmf_sdioh_request_word(sdiodev, SDIOH_CMD_TYPE_NORMAL,
SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size); SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
sdiodev->regfail = (status != 0); sdiodev->regfail = (status != 0);
...@@ -284,7 +284,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -284,7 +284,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
if (width == 4) if (width == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
status = brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO, status = brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_PIO,
incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt); incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
return status; return status;
...@@ -324,7 +324,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -324,7 +324,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
if (width == 4) if (width == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO, return brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_PIO,
incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt); incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
} }
...@@ -334,14 +334,14 @@ int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr, ...@@ -334,14 +334,14 @@ int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr,
addr &= SBSDIO_SB_OFT_ADDR_MASK; addr &= SBSDIO_SB_OFT_ADDR_MASK;
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO, return brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_PIO,
SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1, SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
addr, 4, nbytes, buf, NULL); addr, 4, nbytes, buf, NULL);
} }
int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn) int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
{ {
return brcmf_sdioh_abort(sdiodev->sdioh, fn); return brcmf_sdioh_abort(sdiodev, fn);
} }
u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev) u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev)
...@@ -354,11 +354,9 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -354,11 +354,9 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
u32 regs = 0; u32 regs = 0;
int ret = 0; int ret = 0;
sdiodev->sdioh = brcmf_sdioh_attach((void *)0); ret = brcmf_sdioh_attach(sdiodev);
if (!sdiodev->sdioh) { if (ret)
ret = -ENODEV;
goto out; goto out;
}
regs = SI_ENUM_BASE; regs = SI_ENUM_BASE;
...@@ -388,10 +386,7 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev) ...@@ -388,10 +386,7 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
sdiodev->bus = NULL; sdiodev->bus = NULL;
} }
if (sdiodev->sdioh) { brcmf_sdioh_detach(sdiodev);
brcmf_sdioh_detach(sdiodev->sdioh);
sdiodev->sdioh = NULL;
}
sdiodev->sbwad = 0; sdiodev->sbwad = 0;
......
...@@ -122,23 +122,7 @@ struct brcmf_sdreg { ...@@ -122,23 +122,7 @@ struct brcmf_sdreg {
int value; int value;
}; };
struct sdioh_info {
struct osl_info *osh; /* osh handler */
uint irq; /* Client irq */
int intrcount; /* Client interrupts */
bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */
/* Must be on for sd_multiblock to be effective */
u8 num_funcs; /* Supported funcs on client */
u32 com_cis_ptr;
u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
uint max_dma_len;
/* DMA Descriptors supported by this controller. */
uint max_dma_descriptors;
};
struct brcmf_sdmmc_instance { struct brcmf_sdmmc_instance {
struct sdioh_info *sd;
struct sdio_func *func[SDIOD_MAX_IOFUNCS]; struct sdio_func *func[SDIOD_MAX_IOFUNCS];
u32 host_claimed; u32 host_claimed;
atomic_t suspend; /* suspend flag */ atomic_t suspend; /* suspend flag */
...@@ -147,7 +131,8 @@ struct brcmf_sdmmc_instance { ...@@ -147,7 +131,8 @@ struct brcmf_sdmmc_instance {
struct brcmf_sdio_dev { struct brcmf_sdio_dev {
struct sdio_func *func1; struct sdio_func *func1;
struct sdio_func *func2; struct sdio_func *func2;
void *sdioh; /* sdioh handler */ u8 num_funcs; /* Supported funcs on client */
u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
u32 sbwad; /* Save backplane window address */ u32 sbwad; /* Save backplane window address */
bool regfail; /* status of last reg_r/w call */ bool regfail; /* status of last reg_r/w call */
void *bus; void *bus;
...@@ -250,10 +235,6 @@ extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, ...@@ -250,10 +235,6 @@ extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev,
const char *name, void *params, int plen, const char *name, void *params, int plen,
void *arg, int len, bool set); void *arg, int len, bool set);
/* helper functions */
struct sdioh_info;
/* platform specific/high level functions */ /* platform specific/high level functions */
extern int brcmf_sdio_function_init(void); extern int brcmf_sdio_function_init(void);
extern int brcmf_sdio_register(void); extern int brcmf_sdio_register(void);
...@@ -269,47 +250,47 @@ extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev); ...@@ -269,47 +250,47 @@ extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
* The handler shall be provided by all subsequent calls. No local cache * The handler shall be provided by all subsequent calls. No local cache
* cfghdl points to the starting address of pci device mapped memory * cfghdl points to the starting address of pci device mapped memory
*/ */
extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl); extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdioh_detach(struct sdioh_info *si); extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev);
extern int extern int
brcmf_sdioh_interrupt_register(struct sdioh_info *si); brcmf_sdioh_interrupt_register(void);
extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si); extern int brcmf_sdioh_interrupt_deregister(void);
/* read or write one byte using cmd52 */ /* read or write one byte using cmd52 */
extern int extern int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
brcmf_sdioh_request_byte(struct sdioh_info *si, uint rw, uint fnc, uint addr, uint fnc, uint addr, u8 *byte);
u8 *byte);
/* read or write 2/4 bytes using cmd53 */ /* read or write 2/4 bytes using cmd53 */
extern int extern int
brcmf_sdioh_request_word(struct sdioh_info *si, uint cmd_type, brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type,
uint rw, uint fnc, uint addr, uint rw, uint fnc, uint addr,
u32 *word, uint nbyte); u32 *word, uint nbyte);
/* read or write any buffer using cmd53 */ /* read or write any buffer using cmd53 */
extern int extern int
brcmf_sdioh_request_buffer(struct sdioh_info *si, uint pio_dma, brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,
uint fix_inc, uint rw, uint fnc_num, uint fix_inc, uint rw, uint fnc_num,
u32 addr, uint regwidth, u32 addr, uint regwidth,
u32 buflen, u8 *buffer, struct sk_buff *pkt); u32 buflen, u8 *buffer, struct sk_buff *pkt);
/* get cis data */ /* get cis data */
extern int extern int brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
brcmf_sdioh_cis_read(struct sdioh_info *si, uint fuc, u8 *cis, u32 length); u8 *cis, u32 length);
extern int extern int brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
brcmf_sdioh_cfg_read(struct sdioh_info *si, uint fuc, u32 addr, u8 *data); u32 addr, u8 *data);
extern int extern int brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fuc,
brcmf_sdioh_cfg_write(struct sdioh_info *si, uint fuc, u32 addr, u8 *data); u32 addr, u8 *data);
/* handle iovars */ /* handle iovars */
extern int brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name, extern int brcmf_sdioh_iovar_op(struct brcmf_sdio_dev *sdiodev,
void *params, int plen, void *arg, int len, bool set); const char *name, void *params, int plen,
void *arg, int len, bool set);
/* Issue abort to the specified function and clear controller as needed */ /* Issue abort to the specified function and clear controller as needed */
extern int brcmf_sdioh_abort(struct sdioh_info *si, uint fnc); extern int brcmf_sdioh_abort(struct brcmf_sdio_dev *sdiodev, uint fnc);
/* Watchdog timer interface for pm ops */ /* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,
......
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