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

staging: brcm80211: remove struct brcmf_sdio_card from brcmfmac

Use brcmf_sdio_dev as the unified structure to store information
of wifi dongle
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a493f4e1
...@@ -41,48 +41,40 @@ ...@@ -41,48 +41,40 @@
#define SDIOH_DATA_PIO 0 /* PIO mode */ #define SDIOH_DATA_PIO 0 /* PIO mode */
#define SDIOH_DATA_DMA 1 /* DMA mode */ #define SDIOH_DATA_DMA 1 /* DMA mode */
struct brcmf_sdio_card {
bool init_success; /* underlying driver successfully attached */
void *sdioh; /* handler for sdioh */
bool regfail; /* Save status of last
reg_read/reg_write call */
u32 sbwad; /* Save backplane window address */
};
/* Module parameters specific to each host-controller driver */ /* Module parameters specific to each host-controller driver */
module_param(sd_f2_blocksize, int, 0); module_param(sd_f2_blocksize, int, 0);
int int
brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, 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(card->sdioh, name, params, plen, arg, return brcmf_sdioh_iovar_op(sdiodev->sdioh, name, params, plen, arg,
len, set); len, set);
} }
int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card) int brcmf_sdcard_intr_enable(struct brcmf_sdio_dev *sdiodev)
{ {
return brcmf_sdioh_interrupt_set(card->sdioh, true); return brcmf_sdioh_interrupt_set(sdiodev->sdioh, true);
} }
int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card) int brcmf_sdcard_intr_disable(struct brcmf_sdio_dev *sdiodev)
{ {
return brcmf_sdioh_interrupt_set(card->sdioh, false); return brcmf_sdioh_interrupt_set(sdiodev->sdioh, false);
} }
int brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card, int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
void (*fn)(void *), void *argh) void (*fn)(void *), void *argh)
{ {
return brcmf_sdioh_interrupt_register(card->sdioh, fn, argh); return brcmf_sdioh_interrupt_register(sdiodev->sdioh, fn, argh);
} }
int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card) int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
{ {
return brcmf_sdioh_interrupt_deregister(card->sdioh); return brcmf_sdioh_interrupt_deregister(sdiodev->sdioh);
} }
u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
int *err) int *err)
{ {
int status; int status;
...@@ -93,7 +85,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, ...@@ -93,7 +85,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, 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(card->sdioh, fnc_num, addr, brcmf_sdioh_cfg_read(sdiodev->sdioh, 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));
...@@ -107,7 +99,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, ...@@ -107,7 +99,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
} }
void void
brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
u8 data, int *err) u8 data, int *err)
{ {
int status; int status;
...@@ -117,7 +109,7 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, ...@@ -117,7 +109,7 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, 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(card->sdioh, fnc_num, addr, brcmf_sdioh_cfg_write(sdiodev->sdioh, 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));
...@@ -128,13 +120,13 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, ...@@ -128,13 +120,13 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
__func__, fnc_num, addr, data)); __func__, fnc_num, addr, data));
} }
u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num, u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
u32 addr, int *err) u32 addr, int *err)
{ {
int status; int status;
u32 data = 0; u32 data = 0;
status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_READ, fnc_num, addr, &data, 4); SDIOH_READ, fnc_num, addr, &data, 4);
if (err) if (err)
...@@ -147,13 +139,13 @@ u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num, ...@@ -147,13 +139,13 @@ u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
} }
void void
brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num, brcmf_sdcard_cfg_write_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
u32 addr, u32 data, int *err) u32 addr, u32 data, int *err)
{ {
int status; int status;
status = status =
brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_WRITE, fnc_num, addr, &data, 4); SDIOH_WRITE, fnc_num, addr, &data, 4);
if (err) if (err)
...@@ -163,7 +155,7 @@ brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num, ...@@ -163,7 +155,7 @@ brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
__func__, fnc_num, addr, data)); __func__, fnc_num, addr, data));
} }
int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis, int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis,
uint length) uint length)
{ {
int status; int status;
...@@ -173,7 +165,7 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis, ...@@ -173,7 +165,7 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
bool ascii = func & ~0xf; bool ascii = func & ~0xf;
func &= 0x7; func &= 0x7;
status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length); status = brcmf_sdioh_cis_read(sdiodev->sdioh, func, cis, length);
if (ascii) { if (ascii) {
/* Move binary bits to tmp and format them /* Move binary bits to tmp and format them
...@@ -197,18 +189,18 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis, ...@@ -197,18 +189,18 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
} }
static int static int
brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address) brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
{ {
int err = 0; int err = 0;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
(address >> 8) & SBSDIO_SBADDRLOW_MASK, &err); (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
if (!err) if (!err)
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_SBADDRMID, SBSDIO_FUNC1_SBADDRMID,
(address >> 16) & SBSDIO_SBADDRMID_MASK, (address >> 16) & SBSDIO_SBADDRMID_MASK,
&err); &err);
if (!err) if (!err)
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_SBADDRHIGH, SBSDIO_FUNC1_SBADDRHIGH,
(address >> 24) & SBSDIO_SBADDRHIGH_MASK, (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
&err); &err);
...@@ -216,7 +208,7 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address) ...@@ -216,7 +208,7 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address)
return err; return err;
} }
u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size) u32 brcmf_sdcard_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size)
{ {
int status; int status;
u32 word = 0; u32 word = 0;
...@@ -224,21 +216,21 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size) ...@@ -224,21 +216,21 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
BRCMF_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr)); BRCMF_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));
if (bar0 != card->sbwad) { if (bar0 != sdiodev->sbwad) {
if (brcmf_sdcard_set_sbaddr_window(card, bar0)) if (brcmf_sdcard_set_sbaddr_window(sdiodev, bar0))
return 0xFFFFFFFF; return 0xFFFFFFFF;
card->sbwad = bar0; sdiodev->sbwad = bar0;
} }
addr &= SBSDIO_SB_OFT_ADDR_MASK; addr &= SBSDIO_SB_OFT_ADDR_MASK;
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(card->sdioh, SDIOH_CMD_TYPE_NORMAL, status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_READ, SDIO_FUNC_1, addr, &word, size); SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
card->regfail = (status != 0); sdiodev->regfail = (status != 0);
BRCMF_INFO(("u32data = 0x%x\n", word)); BRCMF_INFO(("u32data = 0x%x\n", word));
...@@ -252,7 +244,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size) ...@@ -252,7 +244,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
case sizeof(u32): case sizeof(u32):
return word; return word;
default: default:
card->regfail = true; sdiodev->regfail = true;
} }
} }
...@@ -263,7 +255,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size) ...@@ -263,7 +255,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, u32 brcmf_sdcard_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size,
u32 data) u32 data)
{ {
int status; int status;
...@@ -273,21 +265,21 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, ...@@ -273,21 +265,21 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
BRCMF_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n", BRCMF_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",
__func__, addr, size * 8, data)); __func__, addr, size * 8, data));
if (bar0 != card->sbwad) { if (bar0 != sdiodev->sbwad) {
err = brcmf_sdcard_set_sbaddr_window(card, bar0); err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
if (err) if (err)
return err; return err;
card->sbwad = bar0; sdiodev->sbwad = bar0;
} }
addr &= SBSDIO_SB_OFT_ADDR_MASK; addr &= SBSDIO_SB_OFT_ADDR_MASK;
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(card->sdioh, SDIOH_CMD_TYPE_NORMAL, brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size); SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
card->regfail = (status != 0); sdiodev->regfail = (status != 0);
if (status == 0) if (status == 0)
return 0; return 0;
...@@ -297,13 +289,13 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, ...@@ -297,13 +289,13 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card) bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev)
{ {
return card->regfail; return sdiodev->regfail;
} }
int int
brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, uint flags,
u8 *buf, uint nbytes, struct sk_buff *pkt, u8 *buf, uint nbytes, struct sk_buff *pkt,
void (*complete)(void *handle, int status, void (*complete)(void *handle, int status,
...@@ -323,12 +315,12 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, ...@@ -323,12 +315,12 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
if (flags & SDIO_REQ_ASYNC) if (flags & SDIO_REQ_ASYNC)
return -ENOTSUPP; return -ENOTSUPP;
if (bar0 != card->sbwad) { if (bar0 != sdiodev->sbwad) {
err = brcmf_sdcard_set_sbaddr_window(card, bar0); err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
if (err) if (err)
return err; return err;
card->sbwad = bar0; sdiodev->sbwad = bar0;
} }
addr &= SBSDIO_SB_OFT_ADDR_MASK; addr &= SBSDIO_SB_OFT_ADDR_MASK;
...@@ -338,14 +330,14 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, ...@@ -338,14 +330,14 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, 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(card->sdioh, SDIOH_DATA_PIO, status = brcmf_sdioh_request_buffer(sdiodev->sdioh, 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;
} }
int int
brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, void *pkt, uint flags, u8 *buf, uint nbytes, void *pkt,
void (*complete)(void *handle, int status, void (*complete)(void *handle, int status,
bool sync_waiting), bool sync_waiting),
...@@ -363,12 +355,12 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, ...@@ -363,12 +355,12 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
if (flags & SDIO_REQ_ASYNC) if (flags & SDIO_REQ_ASYNC)
return -ENOTSUPP; return -ENOTSUPP;
if (bar0 != card->sbwad) { if (bar0 != sdiodev->sbwad) {
err = brcmf_sdcard_set_sbaddr_window(card, bar0); err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
if (err) if (err)
return err; return err;
card->sbwad = bar0; sdiodev->sbwad = bar0;
} }
addr &= SBSDIO_SB_OFT_ADDR_MASK; addr &= SBSDIO_SB_OFT_ADDR_MASK;
...@@ -378,29 +370,29 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, ...@@ -378,29 +370,29 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, 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(card->sdioh, SDIOH_DATA_PIO, return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt); incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
} }
int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr, int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr,
u8 *buf, uint nbytes) u8 *buf, uint nbytes)
{ {
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(card->sdioh, SDIOH_DATA_PIO, return brcmf_sdioh_request_buffer(sdiodev->sdioh, 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_card *card, uint fn) int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
{ {
return brcmf_sdioh_abort(card->sdioh, fn); return brcmf_sdioh_abort(sdiodev->sdioh, fn);
} }
u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card) u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev)
{ {
return card->sbwad; return sdiodev->sbwad;
} }
int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
...@@ -408,28 +400,19 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -408,28 +400,19 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
u32 regs = 0; u32 regs = 0;
int ret = 0; int ret = 0;
sdiodev->card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC); sdiodev->sdioh = brcmf_sdioh_attach((void *)0);
if (sdiodev->card == NULL) { if (!sdiodev->sdioh) {
BRCMF_ERROR(("sdcard_attach: out of memory"));
ret = -ENOMEM;
goto out;
}
sdiodev->card->sdioh = brcmf_sdioh_attach((void *)0);
if (!sdiodev->card->sdioh) {
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
sdiodev->card->init_success = true;
regs = SI_ENUM_BASE; regs = SI_ENUM_BASE;
/* Report the BAR, to fix if needed */ /* Report the BAR, to fix if needed */
sdiodev->card->sbwad = SI_ENUM_BASE; sdiodev->sbwad = SI_ENUM_BASE;
/* try to attach to the target device */ /* try to attach to the target device */
sdiodev->bus = brcmf_sdbrcm_probe(0, 0, 0, 0, regs, sdiodev->card); sdiodev->bus = brcmf_sdbrcm_probe(0, 0, 0, 0, regs, sdiodev);
if (!sdiodev->bus) { if (!sdiodev->bus) {
BRCMF_ERROR(("%s: device attach failed\n", __func__)); BRCMF_ERROR(("%s: device attach failed\n", __func__));
ret = -ENODEV; ret = -ENODEV;
...@@ -451,13 +434,13 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev) ...@@ -451,13 +434,13 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
sdiodev->bus = NULL; sdiodev->bus = NULL;
} }
if (sdiodev->card) { if (sdiodev->sdioh) {
if (sdiodev->card->sdioh) brcmf_sdioh_detach(sdiodev->sdioh);
brcmf_sdioh_detach(sdiodev->card->sdioh); sdiodev->sdioh = NULL;
kfree(sdiodev->card);
sdiodev->card = NULL;
} }
sdiodev->sbwad = 0;
return 0; return 0;
} }
EXPORT_SYMBOL(brcmf_sdio_remove); EXPORT_SYMBOL(brcmf_sdio_remove);
......
...@@ -75,7 +75,4 @@ extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr); ...@@ -75,7 +75,4 @@ extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick); extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
u32 regsva, void *card);
extern void brcmf_sdbrcm_disconnect(void *ptr);
#endif /* _BRCMF_BUS_H_ */ #endif /* _BRCMF_BUS_H_ */
...@@ -611,7 +611,7 @@ struct chip_info { ...@@ -611,7 +611,7 @@ struct chip_info {
struct brcmf_bus { struct brcmf_bus {
struct brcmf_pub *drvr; struct brcmf_pub *drvr;
struct brcmf_sdio_card *card; /* Handle for sdio card calls */ struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
struct chip_info *ci; /* Chip info struct */ struct chip_info *ci; /* Chip info struct */
char *vars; /* Variables (from CIS and/or other) */ char *vars; /* Variables (from CIS and/or other) */
uint varsz; /* Size of variables buffer */ uint varsz; /* Size of variables buffer */
...@@ -908,9 +908,9 @@ r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar) ...@@ -908,9 +908,9 @@ r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar)
{ {
*retryvar = 0; *retryvar = 0;
do { do {
*regvar = brcmf_sdcard_reg_read(bus->card, *regvar = brcmf_sdcard_reg_read(bus->sdiodev,
bus->ci->buscorebase + reg_offset, sizeof(u32)); bus->ci->buscorebase + reg_offset, sizeof(u32));
} while (brcmf_sdcard_regfail(bus->card) && } while (brcmf_sdcard_regfail(bus->sdiodev) &&
(++(*retryvar) <= retry_limit)); (++(*retryvar) <= retry_limit));
if (*retryvar) { if (*retryvar) {
bus->regfails += (*retryvar-1); bus->regfails += (*retryvar-1);
...@@ -926,10 +926,10 @@ w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar) ...@@ -926,10 +926,10 @@ w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar)
{ {
*retryvar = 0; *retryvar = 0;
do { do {
brcmf_sdcard_reg_write(bus->card, brcmf_sdcard_reg_write(bus->sdiodev,
bus->ci->buscorebase + reg_offset, bus->ci->buscorebase + reg_offset,
sizeof(u32), regval); sizeof(u32), regval);
} while (brcmf_sdcard_regfail(bus->card) && } while (brcmf_sdcard_regfail(bus->sdiodev) &&
(++(*retryvar) <= retry_limit)); (++(*retryvar) <= retry_limit));
if (*retryvar) { if (*retryvar) {
bus->regfails += (*retryvar-1); bus->regfails += (*retryvar-1);
...@@ -961,10 +961,9 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter); ...@@ -961,10 +961,9 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter);
static void brcmf_sdbrcm_release(struct brcmf_bus *bus); static void brcmf_sdbrcm_release(struct brcmf_bus *bus);
static void brcmf_sdbrcm_release_malloc(struct brcmf_bus *bus); static void brcmf_sdbrcm_release_malloc(struct brcmf_bus *bus);
static bool brcmf_sdbrcm_chipmatch(u16 chipid); static bool brcmf_sdbrcm_chipmatch(u16 chipid);
static bool brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, static bool brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva);
u32 regsva); static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus);
static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card); static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus);
static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card);
static void brcmf_sdbrcm_release_dongle(struct brcmf_bus *bus); static void brcmf_sdbrcm_release_dongle(struct brcmf_bus *bus);
static uint brcmf_process_nvram_vars(char *varbuf, uint len); static uint brcmf_process_nvram_vars(char *varbuf, uint len);
...@@ -984,12 +983,12 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus); ...@@ -984,12 +983,12 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus);
static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus); static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus);
static void static void
brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase); brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_dev *sdiodev, u32 corebase);
static int brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs); static int brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs);
static void static void
brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase); brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_dev *sdiodev, u32 corebase);
static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus, static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus,
u32 drivestrength); u32 drivestrength);
...@@ -1031,14 +1030,15 @@ static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size) ...@@ -1031,14 +1030,15 @@ static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size)
static int brcmf_sdbrcm_set_siaddr_window(struct brcmf_bus *bus, u32 address) static int brcmf_sdbrcm_set_siaddr_window(struct brcmf_bus *bus, u32 address)
{ {
int err = 0; int err = 0;
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
(address >> 8) & SBSDIO_SBADDRLOW_MASK, &err); SBSDIO_FUNC1_SBADDRLOW,
(address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
if (!err) if (!err)
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_SBADDRMID, SBSDIO_FUNC1_SBADDRMID,
(address >> 16) & SBSDIO_SBADDRMID_MASK, &err); (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
if (!err) if (!err)
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_SBADDRHIGH, SBSDIO_FUNC1_SBADDRHIGH,
(address >> 24) & SBSDIO_SBADDRHIGH_MASK, (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
&err); &err);
...@@ -1050,13 +1050,11 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1050,13 +1050,11 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
{ {
int err; int err;
u8 clkctl, clkreq, devctl; u8 clkctl, clkreq, devctl;
struct brcmf_sdio_card *card;
unsigned long timeout; unsigned long timeout;
BRCMF_TRACE(("%s: Enter\n", __func__)); BRCMF_TRACE(("%s: Enter\n", __func__));
clkctl = 0; clkctl = 0;
card = bus->card;
if (on) { if (on) {
/* Request HT Avail */ /* Request HT Avail */
...@@ -1067,7 +1065,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1067,7 +1065,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
&& (bus->ci->chiprev == 0)) && (bus->ci->chiprev == 0))
clkreq |= SBSDIO_FORCE_ALP; clkreq |= SBSDIO_FORCE_ALP;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: HT Avail request error: %d\n", BRCMF_ERROR(("%s: HT Avail request error: %d\n",
...@@ -1084,7 +1082,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1084,7 +1082,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
} }
/* Check current status */ /* Check current status */
clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, clkctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err); SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: HT Avail read error: %d\n", BRCMF_ERROR(("%s: HT Avail read error: %d\n",
...@@ -1095,7 +1093,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1095,7 +1093,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
/* Go to pending and await interrupt if appropriate */ /* Go to pending and await interrupt if appropriate */
if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) { if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
/* Allow only clock-available interrupt */ /* Allow only clock-available interrupt */
devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, devctl = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err); SBSDIO_DEVICE_CTL, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: Devctl error setting CA:" BRCMF_ERROR(("%s: Devctl error setting CA:"
...@@ -1104,7 +1103,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1104,7 +1103,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
} }
devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err); SBSDIO_DEVICE_CTL, devctl, &err);
BRCMF_INFO(("CLKCTL: set PENDING\n")); BRCMF_INFO(("CLKCTL: set PENDING\n"));
bus->clkstate = CLK_PENDING; bus->clkstate = CLK_PENDING;
...@@ -1113,10 +1112,10 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1113,10 +1112,10 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
} else if (bus->clkstate == CLK_PENDING) { } else if (bus->clkstate == CLK_PENDING) {
/* Cancel CA-only interrupt filter */ /* Cancel CA-only interrupt filter */
devctl = devctl =
brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err); SBSDIO_DEVICE_CTL, &err);
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err); SBSDIO_DEVICE_CTL, devctl, &err);
} }
...@@ -1124,7 +1123,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1124,7 +1123,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
timeout = jiffies + timeout = jiffies +
msecs_to_jiffies(PMU_MAX_TRANSITION_DLY/1000); msecs_to_jiffies(PMU_MAX_TRANSITION_DLY/1000);
while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, clkctl = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FUNC1_CHIPCLKCSR,
&err); &err);
if (time_after(jiffies, timeout)) if (time_after(jiffies, timeout))
...@@ -1162,15 +1162,16 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) ...@@ -1162,15 +1162,16 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
if (bus->clkstate == CLK_PENDING) { if (bus->clkstate == CLK_PENDING) {
/* Cancel CA-only interrupt filter */ /* Cancel CA-only interrupt filter */
devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, devctl = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err); SBSDIO_DEVICE_CTL, &err);
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err); SBSDIO_DEVICE_CTL, devctl, &err);
} }
bus->clkstate = CLK_SDONLY; bus->clkstate = CLK_SDONLY;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
BRCMF_INFO(("CLKCTL: turned OFF\n")); BRCMF_INFO(("CLKCTL: turned OFF\n"));
if (err) { if (err) {
...@@ -1255,7 +1256,6 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok) ...@@ -1255,7 +1256,6 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok)
int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep) int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
{ {
struct brcmf_sdio_card *card = bus->card;
uint retries = 0; uint retries = 0;
BRCMF_INFO(("brcmf_sdbrcm_bussleep: request %s (currently %s)\n", BRCMF_INFO(("brcmf_sdbrcm_bussleep: request %s (currently %s)\n",
...@@ -1273,7 +1273,7 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep) ...@@ -1273,7 +1273,7 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
return -EBUSY; return -EBUSY;
/* Disable SDIO interrupts (no longer interested) */ /* Disable SDIO interrupts (no longer interested) */
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->sdiodev);
/* Make sure the controller has the bus up */ /* Make sure the controller has the bus up */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
...@@ -1288,13 +1288,13 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep) ...@@ -1288,13 +1288,13 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
/* Turn off our contribution to the HT clock request */ /* Turn off our contribution to the HT clock request */
brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FUNC1_CHIPCLKCSR,
SBSDIO_FORCE_HW_CLKREQ_OFF, NULL); SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
/* Isolate the bus */ /* Isolate the bus */
if (bus->ci->chip != BCM4329_CHIP_ID) { if (bus->ci->chip != BCM4329_CHIP_ID) {
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, SBSDIO_DEVICE_CTL,
SBSDIO_DEVCTL_PADS_ISO, NULL); SBSDIO_DEVCTL_PADS_ISO, NULL);
} }
...@@ -1305,14 +1305,14 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep) ...@@ -1305,14 +1305,14 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
} else { } else {
/* Waking up: bus power up is ok, set local state */ /* Waking up: bus power up is ok, set local state */
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
/* Force pad isolation off if possible /* Force pad isolation off if possible
(in case power never toggled) */ (in case power never toggled) */
if ((bus->ci->buscoretype == PCMCIA_CORE_ID) if ((bus->ci->buscoretype == PCMCIA_CORE_ID)
&& (bus->ci->buscorerev >= 10)) && (bus->ci->buscorerev >= 10))
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, 0, NULL); SBSDIO_DEVICE_CTL, 0, NULL);
/* Make sure the controller has the bus up */ /* Make sure the controller has the bus up */
...@@ -1338,7 +1338,7 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep) ...@@ -1338,7 +1338,7 @@ int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
/* Enable interrupts again */ /* Enable interrupts again */
if (bus->intr && (bus->drvr->busstate == BRCMF_BUS_DATA)) { if (bus->intr && (bus->drvr->busstate == BRCMF_BUS_DATA)) {
bus->intdis = false; bus->intdis = false;
brcmf_sdcard_intr_enable(bus->card); brcmf_sdcard_intr_enable(bus->sdiodev);
} }
} }
...@@ -1361,14 +1361,11 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, ...@@ -1361,14 +1361,11 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
u16 len, pad = 0; u16 len, pad = 0;
u32 swheader; u32 swheader;
uint retries = 0; uint retries = 0;
struct brcmf_sdio_card *card;
struct sk_buff *new; struct sk_buff *new;
int i; int i;
BRCMF_TRACE(("%s: Enter\n", __func__)); BRCMF_TRACE(("%s: Enter\n", __func__));
card = bus->card;
if (bus->drvr->dongle_reset) { if (bus->drvr->dongle_reset) {
ret = -EPERM; ret = -EPERM;
goto done; goto done;
...@@ -1453,7 +1450,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, ...@@ -1453,7 +1450,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
len = roundup(len, ALIGNMENT); len = roundup(len, ALIGNMENT);
do { do {
ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card), ret = brcmf_sdbrcm_send_buf(bus,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL); SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL);
bus->f2txdata++; bus->f2txdata++;
...@@ -1464,18 +1462,20 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, ...@@ -1464,18 +1462,20 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
"terminate frame.\n", __func__, ret)); "terminate frame.\n", __func__, ret));
bus->tx_sderrs++; bus->tx_sderrs++;
brcmf_sdcard_abort(card, SDIO_FUNC_2); brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
NULL); NULL);
bus->f1regdata++; bus->f1regdata++;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
u8 hi, lo; u8 hi, lo;
hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, hi = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCHI, SBSDIO_FUNC1_WFRAMEBCHI,
NULL); NULL);
lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, lo = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCLO, SBSDIO_FUNC1_WFRAMEBCLO,
NULL); NULL);
bus->f1regdata += 2; bus->f1regdata += 2;
...@@ -1647,7 +1647,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_bus *bus, uint maxframes) ...@@ -1647,7 +1647,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_bus *bus, uint maxframes)
offsetof(struct sdpcmd_regs, intstatus), offsetof(struct sdpcmd_regs, intstatus),
&retries); &retries);
bus->f2txdata++; bus->f2txdata++;
if (brcmf_sdcard_regfail(bus->card)) if (brcmf_sdcard_regfail(bus->sdiodev))
break; break;
if (intstatus & bus->hostintmask) if (intstatus & bus->hostintmask)
bus->ipend = true; bus->ipend = true;
...@@ -1669,7 +1669,6 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) ...@@ -1669,7 +1669,6 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
u16 len; u16 len;
u32 swheader; u32 swheader;
uint retries = 0; uint retries = 0;
struct brcmf_sdio_card *card = bus->card;
u8 doff = 0; u8 doff = 0;
int ret = -1; int ret = -1;
int i; int i;
...@@ -1769,7 +1768,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) ...@@ -1769,7 +1768,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
do { do {
bus->ctrl_frame_stat = false; bus->ctrl_frame_stat = false;
ret = brcmf_sdbrcm_send_buf(bus, ret = brcmf_sdbrcm_send_buf(bus,
brcmf_sdcard_cur_sbwad(card), SDIO_FUNC_2, brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2,
F2SYNC, frame, len, NULL, NULL, NULL); F2SYNC, frame, len, NULL, NULL, NULL);
if (ret < 0) { if (ret < 0) {
...@@ -1780,20 +1780,21 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) ...@@ -1780,20 +1780,21 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
__func__, ret)); __func__, ret));
bus->tx_sderrs++; bus->tx_sderrs++;
brcmf_sdcard_abort(card, SDIO_FUNC_2); brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL, SBSDIO_FUNC1_FRAMECTRL,
SFC_WF_TERM, NULL); SFC_WF_TERM, NULL);
bus->f1regdata++; bus->f1regdata++;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
u8 hi, lo; u8 hi, lo;
hi = brcmf_sdcard_cfg_read(card, hi = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1, SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCHI, SBSDIO_FUNC1_WFRAMEBCHI,
NULL); NULL);
lo = brcmf_sdcard_cfg_read(card, lo = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1, SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCLO, SBSDIO_FUNC1_WFRAMEBCLO,
NULL); NULL);
...@@ -2178,8 +2179,8 @@ brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data, ...@@ -2178,8 +2179,8 @@ brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data,
BRCMF_INFO(("%s: %s %d bytes at offset 0x%08x in window" BRCMF_INFO(("%s: %s %d bytes at offset 0x%08x in window"
" 0x%08x\n", __func__, (write ? "write" : "read"), " 0x%08x\n", __func__, (write ? "write" : "read"),
dsize, sdaddr, (address & SBSDIO_SBWINDOW_MASK))); dsize, sdaddr, (address & SBSDIO_SBWINDOW_MASK)));
bcmerror = bcmerror = brcmf_sdcard_rwdata(bus->sdiodev, write,
brcmf_sdcard_rwdata(bus->card, write, sdaddr, data, dsize); sdaddr, data, dsize);
if (bcmerror) { if (bcmerror) {
BRCMF_ERROR(("%s: membytes transfer failed\n", BRCMF_ERROR(("%s: membytes transfer failed\n",
__func__)); __func__));
...@@ -2205,9 +2206,10 @@ brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data, ...@@ -2205,9 +2206,10 @@ brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data,
xfer_done: xfer_done:
/* Return the window to backplane enumeration space for core access */ /* Return the window to backplane enumeration space for core access */
if (brcmf_sdbrcm_set_siaddr_window(bus, if (brcmf_sdbrcm_set_siaddr_window(bus,
brcmf_sdcard_cur_sbwad(bus->card))) brcmf_sdcard_cur_sbwad(
bus->sdiodev)))
BRCMF_ERROR(("%s: FAILED to set window back to 0x%x\n", BRCMF_ERROR(("%s: FAILED to set window back to 0x%x\n",
__func__, brcmf_sdcard_cur_sbwad(bus->card))); __func__, brcmf_sdcard_cur_sbwad(bus->sdiodev)));
return bcmerror; return bcmerror;
} }
...@@ -2615,9 +2617,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, ...@@ -2615,9 +2617,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
BRCMF_INTR(("%s: %s SDIO interrupts\n", __func__, BRCMF_INTR(("%s: %s SDIO interrupts\n", __func__,
bus->intr ? "enable" : "disable")); bus->intr ? "enable" : "disable"));
if (bus->intr) if (bus->intr)
brcmf_sdcard_intr_enable(bus->card); brcmf_sdcard_intr_enable(bus->sdiodev);
else else
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->sdiodev);
} }
break; break;
...@@ -2807,9 +2809,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, ...@@ -2807,9 +2809,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
addr = bus->ci->buscorebase + sd_ptr->offset; addr = bus->ci->buscorebase + sd_ptr->offset;
size = sd_ptr->func; size = sd_ptr->func;
int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr, int_val = (s32) brcmf_sdcard_reg_read(bus->sdiodev,
size); addr, size);
if (brcmf_sdcard_regfail(bus->card)) if (brcmf_sdcard_regfail(bus->sdiodev))
bcmerror = -EIO; bcmerror = -EIO;
memcpy(arg, &int_val, sizeof(s32)); memcpy(arg, &int_val, sizeof(s32));
break; break;
...@@ -2824,9 +2826,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, ...@@ -2824,9 +2826,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
addr = bus->ci->buscorebase + sd_ptr->offset; addr = bus->ci->buscorebase + sd_ptr->offset;
size = sd_ptr->func; size = sd_ptr->func;
brcmf_sdcard_reg_write(bus->card, addr, size, brcmf_sdcard_reg_write(bus->sdiodev, addr, size,
sd_ptr->value); sd_ptr->value);
if (brcmf_sdcard_regfail(bus->card)) if (brcmf_sdcard_regfail(bus->sdiodev))
bcmerror = -EIO; bcmerror = -EIO;
break; break;
} }
...@@ -2842,9 +2844,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, ...@@ -2842,9 +2844,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
addr = SI_ENUM_BASE + sdreg.offset; addr = SI_ENUM_BASE + sdreg.offset;
size = sdreg.func; size = sdreg.func;
int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr, int_val = (s32) brcmf_sdcard_reg_read(bus->sdiodev,
size); addr, size);
if (brcmf_sdcard_regfail(bus->card)) if (brcmf_sdcard_regfail(bus->sdiodev))
bcmerror = -EIO; bcmerror = -EIO;
memcpy(arg, &int_val, sizeof(s32)); memcpy(arg, &int_val, sizeof(s32));
break; break;
...@@ -2859,9 +2861,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, ...@@ -2859,9 +2861,9 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
addr = SI_ENUM_BASE + sdreg.offset; addr = SI_ENUM_BASE + sdreg.offset;
size = sdreg.func; size = sdreg.func;
brcmf_sdcard_reg_write(bus->card, addr, size, brcmf_sdcard_reg_write(bus->sdiodev, addr, size,
sdreg.value); sdreg.value);
if (brcmf_sdcard_regfail(bus->card)) if (brcmf_sdcard_regfail(bus->sdiodev))
bcmerror = -EIO; bcmerror = -EIO;
break; break;
} }
...@@ -2871,15 +2873,15 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, ...@@ -2871,15 +2873,15 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
*(char *)arg = 0; *(char *)arg = 0;
strcat(arg, "\nFunc 0\n"); strcat(arg, "\nFunc 0\n");
brcmf_sdcard_cis_read(bus->card, 0x10, brcmf_sdcard_cis_read(bus->sdiodev, 0x10,
(u8 *) arg + strlen(arg), (u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT); SBSDIO_CIS_SIZE_LIMIT);
strcat(arg, "\nFunc 1\n"); strcat(arg, "\nFunc 1\n");
brcmf_sdcard_cis_read(bus->card, 0x11, brcmf_sdcard_cis_read(bus->sdiodev, 0x11,
(u8 *) arg + strlen(arg), (u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT); SBSDIO_CIS_SIZE_LIMIT);
strcat(arg, "\nFunc 2\n"); strcat(arg, "\nFunc 2\n");
brcmf_sdcard_cis_read(bus->card, 0x12, brcmf_sdcard_cis_read(bus->sdiodev, 0x12,
(u8 *) arg + strlen(arg), (u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT); SBSDIO_CIS_SIZE_LIMIT);
break; break;
...@@ -3106,9 +3108,10 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter) ...@@ -3106,9 +3108,10 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
if (enter) { if (enter) {
bus->alp_only = true; bus->alp_only = true;
brcmf_sdbrcm_chip_disablecore(bus->card, bus->ci->armcorebase); brcmf_sdbrcm_chip_disablecore(bus->sdiodev,
bus->ci->armcorebase);
brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->ramcorebase); brcmf_sdbrcm_chip_resetcore(bus->sdiodev, bus->ci->ramcorebase);
/* Clear the top bit of memory */ /* Clear the top bit of memory */
if (bus->ramsize) { if (bus->ramsize) {
...@@ -3117,7 +3120,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter) ...@@ -3117,7 +3120,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
(u8 *)&zeros, 4); (u8 *)&zeros, 4);
} }
} else { } else {
regdata = brcmf_sdcard_reg_read(bus->card, regdata = brcmf_sdcard_reg_read(bus->sdiodev,
CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4); CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4);
regdata &= (SBTML_RESET | SBTML_REJ_MASK | regdata &= (SBTML_RESET | SBTML_REJ_MASK |
(SICF_CLOCK_EN << SBTML_SICF_SHIFT)); (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
...@@ -3137,7 +3140,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter) ...@@ -3137,7 +3140,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
w_sdreg32(bus, 0xFFFFFFFF, w_sdreg32(bus, 0xFFFFFFFF,
offsetof(struct sdpcmd_regs, intstatus), &retries); offsetof(struct sdpcmd_regs, intstatus), &retries);
brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->armcorebase); brcmf_sdbrcm_chip_resetcore(bus->sdiodev, bus->ci->armcorebase);
/* Allow HT Clock now that the ARM is running. */ /* Allow HT Clock now that the ARM is running. */
bus->alp_only = false; bus->alp_only = false;
...@@ -3181,14 +3184,14 @@ brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name, ...@@ -3181,14 +3184,14 @@ brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
/* Turn on clock in case SD command needs backplane */ /* Turn on clock in case SD command needs backplane */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
bcmerror = brcmf_sdcard_iovar_op(bus->card, name, params, plen, bcmerror = brcmf_sdcard_iovar_op(bus->sdiodev, name, params,
arg, len, set); plen, arg, len, set);
/* Similar check for blocksize change */ /* Similar check for blocksize change */
if (set && strcmp(name, "sd_blocksize") == 0) { if (set && strcmp(name, "sd_blocksize") == 0) {
s32 fnum = 2; s32 fnum = 2;
if (brcmf_sdcard_iovar_op if (brcmf_sdcard_iovar_op
(bus->card, "sd_blocksize", &fnum, sizeof(s32), (bus->sdiodev, "sd_blocksize", &fnum, sizeof(s32),
&bus->blocksize, sizeof(s32), &bus->blocksize, sizeof(s32),
false) != 0) { false) != 0) {
bus->blocksize = 0; bus->blocksize = 0;
...@@ -3278,10 +3281,10 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex) ...@@ -3278,10 +3281,10 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
bus->drvr->busstate = BRCMF_BUS_DOWN; bus->drvr->busstate = BRCMF_BUS_DOWN;
/* Force clocks on backplane to be sure F2 interrupt propagates */ /* Force clocks on backplane to be sure F2 interrupt propagates */
saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, saveclk = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err); SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (!err) { if (!err) {
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FUNC1_CHIPCLKCSR,
(saveclk | SBSDIO_FORCE_HT), &err); (saveclk | SBSDIO_FORCE_HT), &err);
} }
...@@ -3291,8 +3294,8 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex) ...@@ -3291,8 +3294,8 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
/* Turn off the bus (F2), free any pending packets */ /* Turn off the bus (F2), free any pending packets */
BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__)); BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->sdiodev);
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL); SDIO_FUNC_ENABLE_1, NULL);
/* Clear any pending interrupts now that F2 is disabled */ /* Clear any pending interrupts now that F2 is disabled */
...@@ -3339,7 +3342,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3339,7 +3342,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
/* try to download image and nvram to the dongle */ /* try to download image and nvram to the dongle */
if (drvr->busstate == BRCMF_BUS_DOWN) { if (drvr->busstate == BRCMF_BUS_DOWN) {
if (!(brcmf_sdbrcm_download_firmware(bus, bus->card))) if (!(brcmf_sdbrcm_download_firmware(bus, bus->sdiodev)))
return -1; return -1;
} }
...@@ -3360,10 +3363,10 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3360,10 +3363,10 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
/* Force clocks on backplane to be sure F2 interrupt propagates */ /* Force clocks on backplane to be sure F2 interrupt propagates */
saveclk = saveclk =
brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err); SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (!err) { if (!err) {
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FUNC1_CHIPCLKCSR,
(saveclk | SBSDIO_FORCE_HT), &err); (saveclk | SBSDIO_FORCE_HT), &err);
} }
...@@ -3378,13 +3381,13 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3378,13 +3381,13 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries); offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries);
enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2); enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, enable, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx,
NULL); enable, NULL);
timeout = jiffies + msecs_to_jiffies(BRCMF_WAIT_F2RDY); timeout = jiffies + msecs_to_jiffies(BRCMF_WAIT_F2RDY);
ready = 0; ready = 0;
while (enable != ready) { while (enable != ready) {
ready = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_0, ready = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_0,
SDIO_CCCR_IORx, NULL); SDIO_CCCR_IORx, NULL);
if (time_after(jiffies, timeout)) if (time_after(jiffies, timeout))
break; break;
...@@ -3403,8 +3406,8 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3403,8 +3406,8 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
w_sdreg32(bus, bus->hostintmask, w_sdreg32(bus, bus->hostintmask,
offsetof(struct sdpcmd_regs, hostintmask), &retries); offsetof(struct sdpcmd_regs, hostintmask), &retries);
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_WATERMARK, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
(u8) watermark, &err); SBSDIO_WATERMARK, (u8) watermark, &err);
/* Set bus state according to enable result */ /* Set bus state according to enable result */
drvr->busstate = BRCMF_BUS_DATA; drvr->busstate = BRCMF_BUS_DATA;
...@@ -3413,10 +3416,10 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3413,10 +3416,10 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
if (bus->intr) { if (bus->intr) {
BRCMF_INTR(("%s: enable SDIO device interrupts\n", BRCMF_INTR(("%s: enable SDIO device interrupts\n",
__func__)); __func__));
brcmf_sdcard_intr_enable(bus->card); brcmf_sdcard_intr_enable(bus->sdiodev);
} else { } else {
BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__)); BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->sdiodev);
} }
} }
...@@ -3424,13 +3427,13 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3424,13 +3427,13 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
else { else {
/* Disable F2 again */ /* Disable F2 again */
enable = SDIO_FUNC_ENABLE_1; enable = SDIO_FUNC_ENABLE_1;
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0,
enable, NULL); SDIO_CCCR_IOEx, enable, NULL);
} }
/* Restore previous clock setting */ /* Restore previous clock setting */
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
saveclk, &err); SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err);
#if defined(OOB_INTR_ONLY) #if defined(OOB_INTR_ONLY)
/* Host registration for OOB interrupt */ /* Host registration for OOB interrupt */
...@@ -3459,7 +3462,6 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) ...@@ -3459,7 +3462,6 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx) static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
{ {
struct brcmf_sdio_card *card = bus->card;
uint retries = 0; uint retries = 0;
u16 lastrbc; u16 lastrbc;
u8 hi, lo; u8 hi, lo;
...@@ -3470,17 +3472,18 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx) ...@@ -3470,17 +3472,18 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
(rtx ? ", send NAK" : ""))); (rtx ? ", send NAK" : "")));
if (abort) if (abort)
brcmf_sdcard_abort(card, SDIO_FUNC_2); brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL,
SFC_RF_TERM, &err); SFC_RF_TERM, &err);
bus->f1regdata++; bus->f1regdata++;
/* Wait until the packet has been flushed (device/FIFO stable) */ /* Wait until the packet has been flushed (device/FIFO stable) */
for (lastrbc = retries = 0xffff; retries > 0; retries--) { for (lastrbc = retries = 0xffff; retries > 0; retries--) {
hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, hi = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_RFRAMEBCHI, NULL); SBSDIO_FUNC1_RFRAMEBCHI, NULL);
lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, lo = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_RFRAMEBCLO, NULL); SBSDIO_FUNC1_RFRAMEBCLO, NULL);
bus->f1regdata += 2; bus->f1regdata += 2;
...@@ -3516,14 +3519,13 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx) ...@@ -3516,14 +3519,13 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
bus->nextlen = 0; bus->nextlen = 0;
/* If we can't reach the device, signal failure */ /* If we can't reach the device, signal failure */
if (err || brcmf_sdcard_regfail(card)) if (err || brcmf_sdcard_regfail(bus->sdiodev))
bus->drvr->busstate = BRCMF_BUS_DOWN; bus->drvr->busstate = BRCMF_BUS_DOWN;
} }
static void static void
brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff) brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
{ {
struct brcmf_sdio_card *card = bus->card;
uint rdlen, pad; uint rdlen, pad;
int sdret; int sdret;
...@@ -3590,7 +3592,8 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff) ...@@ -3590,7 +3592,8 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
} }
/* Read remainder of frame body into the rxctl buffer */ /* Read remainder of frame body into the rxctl buffer */
sdret = brcmf_sdcard_recv_buf(card, brcmf_sdcard_cur_sbwad(card), sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, SDIO_FUNC_2,
F2SYNC, (bus->rxctl + firstread), rdlen, F2SYNC, (bus->rxctl + firstread), rdlen,
NULL, NULL, NULL); NULL, NULL, NULL);
...@@ -3753,14 +3756,14 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq) ...@@ -3753,14 +3756,14 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
* packet and and copy into the chain. * packet and and copy into the chain.
*/ */
if (usechain) { if (usechain) {
errcode = brcmf_sdcard_recv_buf(bus->card, errcode = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(bus->card), brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, SDIO_FUNC_2,
F2SYNC, (u8 *) pfirst->data, dlen, F2SYNC, (u8 *) pfirst->data, dlen,
pfirst, NULL, NULL); pfirst, NULL, NULL);
} else if (bus->dataptr) { } else if (bus->dataptr) {
errcode = brcmf_sdcard_recv_buf(bus->card, errcode = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(bus->card), brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, SDIO_FUNC_2,
F2SYNC, bus->dataptr, dlen, F2SYNC, bus->dataptr, dlen,
NULL, NULL, NULL); NULL, NULL, NULL);
...@@ -4029,8 +4032,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq) ...@@ -4029,8 +4032,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
static uint static uint
brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished) brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
{ {
struct brcmf_sdio_card *card = bus->card;
u16 len, check; /* Extracted hardware header fields */ u16 len, check; /* Extracted hardware header fields */
u8 chan, seq, doff; /* Extracted software header fields */ u8 chan, seq, doff; /* Extracted software header fields */
u8 fcbits; /* Extracted fcbits from software header */ u8 fcbits; /* Extracted fcbits from software header */
...@@ -4135,8 +4136,10 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished) ...@@ -4135,8 +4136,10 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
} }
rxbuf = bus->rxctl; rxbuf = bus->rxctl;
/* Read the entire frame */ /* Read the entire frame */
sdret = brcmf_sdcard_recv_buf(card, sdret = brcmf_sdcard_recv_buf(
brcmf_sdcard_cur_sbwad(card), bus->sdiodev,
brcmf_sdcard_cur_sbwad(
bus->sdiodev),
SDIO_FUNC_2, F2SYNC, SDIO_FUNC_2, F2SYNC,
rxbuf, rdlen, rxbuf, rdlen,
NULL, NULL, NULL); NULL, NULL, NULL);
...@@ -4176,8 +4179,9 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished) ...@@ -4176,8 +4179,9 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
PKTALIGN(pkt, rdlen, BRCMF_SDALIGN); PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
rxbuf = (u8 *) (pkt->data); rxbuf = (u8 *) (pkt->data);
/* Read the entire frame */ /* Read the entire frame */
sdret = brcmf_sdcard_recv_buf(card, sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(card), brcmf_sdcard_cur_sbwad(
bus->sdiodev),
SDIO_FUNC_2, F2SYNC, SDIO_FUNC_2, F2SYNC,
rxbuf, rdlen, rxbuf, rdlen,
pkt, NULL, NULL); pkt, NULL, NULL);
...@@ -4360,8 +4364,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished) ...@@ -4360,8 +4364,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
break; break;
/* Read frame header (hardware and software) */ /* Read frame header (hardware and software) */
sdret = brcmf_sdcard_recv_buf(card, sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(card), brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread, SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,
NULL, NULL, NULL); NULL, NULL, NULL);
bus->f2rxhdrs++; bus->f2rxhdrs++;
...@@ -4517,8 +4521,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished) ...@@ -4517,8 +4521,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
PKTALIGN(pkt, rdlen, BRCMF_SDALIGN); PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
/* Read the remaining frame data */ /* Read the remaining frame data */
sdret = brcmf_sdcard_recv_buf(card, sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(card), brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, ((u8 *) (pkt->data)), SDIO_FUNC_2, F2SYNC, ((u8 *) (pkt->data)),
rdlen, pkt, NULL, NULL); rdlen, pkt, NULL, NULL);
bus->f2rxdata++; bus->f2rxdata++;
...@@ -4694,7 +4698,6 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_bus *bus) ...@@ -4694,7 +4698,6 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_bus *bus)
static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
{ {
struct brcmf_sdio_card *card = bus->card;
u32 intstatus, newstatus = 0; u32 intstatus, newstatus = 0;
uint retries = 0; uint retries = 0;
uint rxlimit = brcmf_rxbound; /* Rx frames to read before resched */ uint rxlimit = brcmf_rxbound; /* Rx frames to read before resched */
...@@ -4717,7 +4720,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4717,7 +4720,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
#ifdef BCMDBG #ifdef BCMDBG
/* Check for inconsistent device control */ /* Check for inconsistent device control */
devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, devctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err); SBSDIO_DEVICE_CTL, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: error reading DEVCTL: %d\n", BRCMF_ERROR(("%s: error reading DEVCTL: %d\n",
...@@ -4727,7 +4730,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4727,7 +4730,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
#endif /* BCMDBG */ #endif /* BCMDBG */
/* Read CSR, if clock on switch to AVAIL, else ignore */ /* Read CSR, if clock on switch to AVAIL, else ignore */
clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, clkctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err); SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: error reading CSR: %d\n", __func__, BRCMF_ERROR(("%s: error reading CSR: %d\n", __func__,
...@@ -4739,7 +4742,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4739,7 +4742,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
devctl, clkctl)); devctl, clkctl));
if (SBSDIO_HTAV(clkctl)) { if (SBSDIO_HTAV(clkctl)) {
devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, devctl = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err); SBSDIO_DEVICE_CTL, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: error reading DEVCTL: %d\n", BRCMF_ERROR(("%s: error reading DEVCTL: %d\n",
...@@ -4747,7 +4751,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4747,7 +4751,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
bus->drvr->busstate = BRCMF_BUS_DOWN; bus->drvr->busstate = BRCMF_BUS_DOWN;
} }
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err); SBSDIO_DEVICE_CTL, devctl, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: error writing DEVCTL: %d\n", BRCMF_ERROR(("%s: error writing DEVCTL: %d\n",
...@@ -4773,7 +4777,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4773,7 +4777,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
r_sdreg32(bus, &newstatus, r_sdreg32(bus, &newstatus,
offsetof(struct sdpcmd_regs, intstatus), &retries); offsetof(struct sdpcmd_regs, intstatus), &retries);
bus->f1regdata++; bus->f1regdata++;
if (brcmf_sdcard_regfail(bus->card)) if (brcmf_sdcard_regfail(bus->sdiodev))
newstatus = 0; newstatus = 0;
newstatus &= bus->hostintmask; newstatus &= bus->hostintmask;
bus->fcstate = !!(newstatus & I_HMB_FC_STATE); bus->fcstate = !!(newstatus & I_HMB_FC_STATE);
...@@ -4854,18 +4858,19 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4854,18 +4858,19 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
* or clock availability. (Allows tx loop to check ipend if desired.) * or clock availability. (Allows tx loop to check ipend if desired.)
* (Unless register access seems hosed, as we may not be able to ACK...) * (Unless register access seems hosed, as we may not be able to ACK...)
*/ */
if (bus->intr && bus->intdis && !brcmf_sdcard_regfail(card)) { if (bus->intr && bus->intdis && !brcmf_sdcard_regfail(bus->sdiodev)) {
BRCMF_INTR(("%s: enable SDIO interrupts, rxdone %d" BRCMF_INTR(("%s: enable SDIO interrupts, rxdone %d"
" framecnt %d\n", __func__, rxdone, framecnt)); " framecnt %d\n", __func__, rxdone, framecnt));
bus->intdis = false; bus->intdis = false;
brcmf_sdcard_intr_enable(card); brcmf_sdcard_intr_enable(bus->sdiodev);
} }
if (DATAOK(bus) && bus->ctrl_frame_stat && if (DATAOK(bus) && bus->ctrl_frame_stat &&
(bus->clkstate == CLK_AVAIL)) { (bus->clkstate == CLK_AVAIL)) {
int ret, i; int ret, i;
ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card), ret = brcmf_sdbrcm_send_buf(bus,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, (u8 *) bus->ctrl_frame_buf, SDIO_FUNC_2, F2SYNC, (u8 *) bus->ctrl_frame_buf,
(u32) bus->ctrl_frame_len, NULL, NULL, NULL); (u32) bus->ctrl_frame_len, NULL, NULL, NULL);
...@@ -4876,19 +4881,21 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4876,19 +4881,21 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
"terminate frame.\n", __func__, ret)); "terminate frame.\n", __func__, ret));
bus->tx_sderrs++; bus->tx_sderrs++;
brcmf_sdcard_abort(card, SDIO_FUNC_2); brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
NULL); NULL);
bus->f1regdata++; bus->f1regdata++;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
u8 hi, lo; u8 hi, lo;
hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, hi = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCHI, SBSDIO_FUNC1_WFRAMEBCHI,
NULL); NULL);
lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, lo = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCLO, SBSDIO_FUNC1_WFRAMEBCLO,
NULL); NULL);
bus->f1regdata += 2; bus->f1regdata += 2;
...@@ -4918,10 +4925,10 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4918,10 +4925,10 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
/* On failed register access, all bets are off: /* On failed register access, all bets are off:
no resched or interrupts */ no resched or interrupts */
if ((bus->drvr->busstate == BRCMF_BUS_DOWN) || if ((bus->drvr->busstate == BRCMF_BUS_DOWN) ||
brcmf_sdcard_regfail(card)) { brcmf_sdcard_regfail(bus->sdiodev)) {
BRCMF_ERROR(("%s: failed backplane access over SDIO, halting " BRCMF_ERROR(("%s: failed backplane access over SDIO, halting "
"operation %d\n", __func__, "operation %d\n", __func__,
brcmf_sdcard_regfail(card))); brcmf_sdcard_regfail(bus->sdiodev)));
bus->drvr->busstate = BRCMF_BUS_DOWN; bus->drvr->busstate = BRCMF_BUS_DOWN;
bus->intstatus = 0; bus->intstatus = 0;
} else if (bus->clkstate == CLK_PENDING) { } else if (bus->clkstate == CLK_PENDING) {
...@@ -4951,7 +4958,6 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) ...@@ -4951,7 +4958,6 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
void brcmf_sdbrcm_isr(void *arg) void brcmf_sdbrcm_isr(void *arg)
{ {
struct brcmf_bus *bus = (struct brcmf_bus *) arg; struct brcmf_bus *bus = (struct brcmf_bus *) arg;
struct brcmf_sdio_card *card;
BRCMF_TRACE(("%s: Enter\n", __func__)); BRCMF_TRACE(("%s: Enter\n", __func__));
...@@ -4959,7 +4965,6 @@ void brcmf_sdbrcm_isr(void *arg) ...@@ -4959,7 +4965,6 @@ void brcmf_sdbrcm_isr(void *arg)
BRCMF_ERROR(("%s : bus is null pointer , exit\n", __func__)); BRCMF_ERROR(("%s : bus is null pointer , exit\n", __func__));
return; return;
} }
card = bus->card;
if (bus->drvr->busstate == BRCMF_BUS_DOWN) { if (bus->drvr->busstate == BRCMF_BUS_DOWN) {
BRCMF_ERROR(("%s : bus is down. we have nothing to do\n", BRCMF_ERROR(("%s : bus is down. we have nothing to do\n",
...@@ -4982,7 +4987,7 @@ void brcmf_sdbrcm_isr(void *arg) ...@@ -4982,7 +4987,7 @@ void brcmf_sdbrcm_isr(void *arg)
else else
BRCMF_ERROR(("brcmf_sdbrcm_isr() w/o interrupt configured!\n")); BRCMF_ERROR(("brcmf_sdbrcm_isr() w/o interrupt configured!\n"));
brcmf_sdcard_intr_disable(card); brcmf_sdcard_intr_disable(bus->sdiodev);
bus->intdis = true; bus->intdis = true;
#if defined(SDIO_ISR_THREAD) #if defined(SDIO_ISR_THREAD)
...@@ -5287,7 +5292,7 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr) ...@@ -5287,7 +5292,7 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
if (!bus->dpc_sched) { if (!bus->dpc_sched) {
u8 devpend; u8 devpend;
devpend = brcmf_sdcard_cfg_read(bus->card, devpend = brcmf_sdcard_cfg_read(bus->sdiodev,
SDIO_FUNC_0, SDIO_CCCR_INTx, SDIO_FUNC_0, SDIO_CCCR_INTx,
NULL); NULL);
intstatus = intstatus =
...@@ -5301,7 +5306,7 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr) ...@@ -5301,7 +5306,7 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
bus->pollcnt++; bus->pollcnt++;
bus->ipend = true; bus->ipend = true;
if (bus->intr) if (bus->intr)
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->sdiodev);
bus->dpc_sched = true; bus->dpc_sched = true;
brcmf_sdbrcm_sched_dpc(bus); brcmf_sdbrcm_sched_dpc(bus);
...@@ -5429,7 +5434,7 @@ static bool brcmf_sdbrcm_chipmatch(u16 chipid) ...@@ -5429,7 +5434,7 @@ static bool brcmf_sdbrcm_chipmatch(u16 chipid)
} }
void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
u32 regsva, void *card) u32 regsva, struct brcmf_sdio_dev *sdiodev)
{ {
int ret; int ret;
struct brcmf_bus *bus; struct brcmf_bus *bus;
...@@ -5467,14 +5472,14 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, ...@@ -5467,14 +5472,14 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
__func__)); __func__));
goto fail; goto fail;
} }
bus->card = card; bus->sdiodev = sdiodev;
bus->bus = BRCMF_BUS; bus->bus = BRCMF_BUS;
bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1; bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
bus->usebufpool = false; /* Use bufpool if allocated, bus->usebufpool = false; /* Use bufpool if allocated,
else use locally malloced rxbuf */ else use locally malloced rxbuf */
/* attempt to attach to the dongle */ /* attempt to attach to the dongle */
if (!(brcmf_sdbrcm_probe_attach(bus, card, regsva))) { if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) {
BRCMF_ERROR(("%s: brcmf_sdbrcm_probe_attach failed\n", BRCMF_ERROR(("%s: brcmf_sdbrcm_probe_attach failed\n",
__func__)); __func__));
goto fail; goto fail;
...@@ -5536,13 +5541,13 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, ...@@ -5536,13 +5541,13 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
} }
/* Allocate buffers */ /* Allocate buffers */
if (!(brcmf_sdbrcm_probe_malloc(bus, card))) { if (!(brcmf_sdbrcm_probe_malloc(bus))) {
BRCMF_ERROR(("%s: brcmf_sdbrcm_probe_malloc failed\n", BRCMF_ERROR(("%s: brcmf_sdbrcm_probe_malloc failed\n",
__func__)); __func__));
goto fail; goto fail;
} }
if (!(brcmf_sdbrcm_probe_init(bus, card))) { if (!(brcmf_sdbrcm_probe_init(bus))) {
BRCMF_ERROR(("%s: brcmf_sdbrcm_probe_init failed\n", __func__)); BRCMF_ERROR(("%s: brcmf_sdbrcm_probe_init failed\n", __func__));
goto fail; goto fail;
} }
...@@ -5550,8 +5555,8 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, ...@@ -5550,8 +5555,8 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
/* Register interrupt callback, but mask it (not operational yet). */ /* Register interrupt callback, but mask it (not operational yet). */
BRCMF_INTR(("%s: disable SDIO interrupts (not interested yet)\n", BRCMF_INTR(("%s: disable SDIO interrupts (not interested yet)\n",
__func__)); __func__));
brcmf_sdcard_intr_disable(card); brcmf_sdcard_intr_disable(bus->sdiodev);
ret = brcmf_sdcard_intr_reg(card, brcmf_sdbrcm_isr, bus); ret = brcmf_sdcard_intr_reg(bus->sdiodev, brcmf_sdbrcm_isr, bus);
if (ret != 0) { if (ret != 0) {
BRCMF_ERROR(("%s: FAILED: sdcard_intr_reg returned %d\n", BRCMF_ERROR(("%s: FAILED: sdcard_intr_reg returned %d\n",
__func__, ret)); __func__, ret));
...@@ -5584,7 +5589,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, ...@@ -5584,7 +5589,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
} }
static bool static bool
brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva) brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
{ {
u8 clkctl = 0; u8 clkctl = 0;
int err = 0; int err = 0;
...@@ -5600,7 +5605,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva) ...@@ -5600,7 +5605,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva)
#ifdef BCMDBG #ifdef BCMDBG
printk(KERN_DEBUG "F1 signature read @0x18000000=0x%4x\n", printk(KERN_DEBUG "F1 signature read @0x18000000=0x%4x\n",
brcmf_sdcard_reg_read(bus->card, SI_ENUM_BASE, 4)); brcmf_sdcard_reg_read(bus->sdiodev, SI_ENUM_BASE, 4));
#endif /* BCMDBG */ #endif /* BCMDBG */
...@@ -5609,11 +5614,12 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva) ...@@ -5609,11 +5614,12 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva)
* programs PLL control regs * programs PLL control regs
*/ */
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
BRCMF_INIT_CLKCTL1, &err); SBSDIO_FUNC1_CHIPCLKCSR,
BRCMF_INIT_CLKCTL1, &err);
if (!err) if (!err)
clkctl = clkctl =
brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err); SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) { if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
...@@ -5639,7 +5645,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva) ...@@ -5639,7 +5645,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva)
/* Get info on the ARM and SOCRAM cores... */ /* Get info on the ARM and SOCRAM cores... */
if (!BRCMF_NOPMU(bus)) { if (!BRCMF_NOPMU(bus)) {
brcmf_sdcard_reg_read(bus->card, brcmf_sdcard_reg_read(bus->sdiodev,
CORE_SB(bus->ci->armcorebase, sbidhigh), 4); CORE_SB(bus->ci->armcorebase, sbidhigh), 4);
bus->orig_ramsize = bus->ci->ramsize; bus->orig_ramsize = bus->ci->ramsize;
if (!(bus->orig_ramsize)) { if (!(bus->orig_ramsize)) {
...@@ -5658,8 +5664,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva) ...@@ -5658,8 +5664,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva)
/* Set core control so an SDIO reset does a backplane reset */ /* Set core control so an SDIO reset does a backplane reset */
reg_addr = bus->ci->buscorebase + reg_addr = bus->ci->buscorebase +
offsetof(struct sdpcmd_regs, corecontrol); offsetof(struct sdpcmd_regs, corecontrol);
reg_val = brcmf_sdcard_reg_read(bus->card, reg_addr, sizeof(u32)); reg_val = brcmf_sdcard_reg_read(bus->sdiodev, reg_addr, sizeof(u32));
brcmf_sdcard_reg_write(bus->card, reg_addr, sizeof(u32), brcmf_sdcard_reg_write(bus->sdiodev, reg_addr, sizeof(u32),
reg_val | CC_BPRESEN); reg_val | CC_BPRESEN);
brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN); brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN);
...@@ -5680,7 +5686,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva) ...@@ -5680,7 +5686,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva)
return false; return false;
} }
static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card) static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus)
{ {
BRCMF_TRACE(("%s: Enter\n", __func__)); BRCMF_TRACE(("%s: Enter\n", __func__));
...@@ -5720,7 +5726,7 @@ static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card) ...@@ -5720,7 +5726,7 @@ static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card)
return false; return false;
} }
static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card) static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
{ {
s32 fnum; s32 fnum;
...@@ -5731,7 +5737,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card) ...@@ -5731,7 +5737,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card)
#endif /* SDTEST */ #endif /* SDTEST */
/* Disable F2 to clear any intermediate frame state on the dongle */ /* Disable F2 to clear any intermediate frame state on the dongle */
brcmf_sdcard_cfg_write(card, SDIO_FUNC_0, SDIO_CCCR_IOEx, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL); SDIO_FUNC_ENABLE_1, NULL);
bus->drvr->busstate = BRCMF_BUS_DOWN; bus->drvr->busstate = BRCMF_BUS_DOWN;
...@@ -5739,8 +5745,8 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card) ...@@ -5739,8 +5745,8 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card)
bus->rxflow = false; bus->rxflow = false;
/* Done with backplane-dependent accesses, can drop clock... */ /* Done with backplane-dependent accesses, can drop clock... */
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, 0, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
NULL); SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
/* ...and initialize clock/power states */ /* ...and initialize clock/power states */
bus->clkstate = CLK_SDONLY; bus->clkstate = CLK_SDONLY;
...@@ -5749,8 +5755,9 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card) ...@@ -5749,8 +5755,9 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card)
/* Query the F2 block size, set roundup accordingly */ /* Query the F2 block size, set roundup accordingly */
fnum = 2; fnum = 2;
if (brcmf_sdcard_iovar_op(card, "sd_blocksize", &fnum, sizeof(s32), if (brcmf_sdcard_iovar_op(bus->sdiodev, "sd_blocksize", &fnum,
&bus->blocksize, sizeof(s32), false) != 0) { sizeof(s32), &bus->blocksize,
sizeof(s32), false) != 0) {
bus->blocksize = 0; bus->blocksize = 0;
BRCMF_ERROR(("%s: fail on %s get\n", __func__, "sd_blocksize")); BRCMF_ERROR(("%s: fail on %s get\n", __func__, "sd_blocksize"));
} else { } else {
...@@ -5761,7 +5768,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card) ...@@ -5761,7 +5768,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card)
/* Query if bus module supports packet chaining, /* Query if bus module supports packet chaining,
default to use if supported */ default to use if supported */
if (brcmf_sdcard_iovar_op(card, "sd_rxchain", NULL, 0, if (brcmf_sdcard_iovar_op(bus->sdiodev, "sd_rxchain", NULL, 0,
&bus->sd_rxchain, sizeof(s32), &bus->sd_rxchain, sizeof(s32),
false) != 0) false) != 0)
bus->sd_rxchain = false; bus->sd_rxchain = false;
...@@ -5797,8 +5804,8 @@ static void brcmf_sdbrcm_release(struct brcmf_bus *bus) ...@@ -5797,8 +5804,8 @@ static void brcmf_sdbrcm_release(struct brcmf_bus *bus)
if (bus) { if (bus) {
/* De-register interrupt handler */ /* De-register interrupt handler */
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->sdiodev);
brcmf_sdcard_intr_dereg(bus->card); brcmf_sdcard_intr_dereg(bus->sdiodev);
if (bus->drvr) { if (bus->drvr) {
brcmf_detach(bus->drvr); brcmf_detach(bus->drvr);
...@@ -6090,7 +6097,7 @@ brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn, uint flags, ...@@ -6090,7 +6097,7 @@ brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn, uint flags,
void *handle) void *handle)
{ {
return brcmf_sdcard_send_buf return brcmf_sdcard_send_buf
(bus->card, addr, fn, flags, buf, nbytes, pkt, complete, (bus->sdiodev, addr, fn, flags, buf, nbytes, pkt, complete,
handle); handle);
} }
...@@ -6129,10 +6136,9 @@ int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag) ...@@ -6129,10 +6136,9 @@ int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag)
/* Turn on WLAN */ /* Turn on WLAN */
/* Attempt to re-attach & download */ /* Attempt to re-attach & download */
if (brcmf_sdbrcm_probe_attach(bus, bus->card, if (brcmf_sdbrcm_probe_attach(bus, SI_ENUM_BASE)) {
SI_ENUM_BASE)) {
/* Attempt to download binary to the dongle */ /* Attempt to download binary to the dongle */
if (brcmf_sdbrcm_probe_init(bus, bus->card)) { if (brcmf_sdbrcm_probe_init(bus)) {
/* Re-init bus, enable F2 transfer */ /* Re-init bus, enable F2 transfer */
brcmf_sdbrcm_bus_init(bus->drvr, false); brcmf_sdbrcm_bus_init(bus->drvr, false);
...@@ -6157,7 +6163,7 @@ int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag) ...@@ -6157,7 +6163,7 @@ int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag)
} }
static int static int
brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card, brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_dev *sdiodev,
struct chip_info *ci, u32 regs) struct chip_info *ci, u32 regs)
{ {
u32 regdata; u32 regdata;
...@@ -6169,7 +6175,7 @@ brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card, ...@@ -6169,7 +6175,7 @@ brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card,
* other ways of recognition should be added here. * other ways of recognition should be added here.
*/ */
ci->cccorebase = regs; ci->cccorebase = regs;
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_CC_REG(ci->cccorebase, chipid), 4); CORE_CC_REG(ci->cccorebase, chipid), 4);
ci->chip = regdata & CID_ID_MASK; ci->chip = regdata & CID_ID_MASK;
ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT;
...@@ -6191,15 +6197,15 @@ brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card, ...@@ -6191,15 +6197,15 @@ brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card,
return -ENODEV; return -ENODEV;
} }
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(ci->cccorebase, sbidhigh), 4); CORE_SB(ci->cccorebase, sbidhigh), 4);
ci->ccrev = SBCOREREV(regdata); ci->ccrev = SBCOREREV(regdata);
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_CC_REG(ci->cccorebase, pmucapabilities), 4); CORE_CC_REG(ci->cccorebase, pmucapabilities), 4);
ci->pmurev = regdata & PCAP_REV_MASK; ci->pmurev = regdata & PCAP_REV_MASK;
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(ci->buscorebase, sbidhigh), 4); CORE_SB(ci->buscorebase, sbidhigh), 4);
ci->buscorerev = SBCOREREV(regdata); ci->buscorerev = SBCOREREV(regdata);
ci->buscoretype = (regdata & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT; ci->buscoretype = (regdata & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
...@@ -6209,87 +6215,87 @@ brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card, ...@@ -6209,87 +6215,87 @@ brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card,
ci->buscorerev, ci->buscoretype)); ci->buscorerev, ci->buscoretype));
/* get chipcommon capabilites */ /* get chipcommon capabilites */
ci->cccaps = brcmf_sdcard_reg_read(card, ci->cccaps = brcmf_sdcard_reg_read(sdiodev,
CORE_CC_REG(ci->cccorebase, capabilities), 4); CORE_CC_REG(ci->cccorebase, capabilities), 4);
return 0; return 0;
} }
static void static void
brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase) brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_dev *sdiodev, u32 corebase)
{ {
u32 regdata; u32 regdata;
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatelow), 4); CORE_SB(corebase, sbtmstatelow), 4);
if (regdata & SBTML_RESET) if (regdata & SBTML_RESET)
return; return;
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatelow), 4); CORE_SB(corebase, sbtmstatelow), 4);
if ((regdata & (SICF_CLOCK_EN << SBTML_SICF_SHIFT)) != 0) { if ((regdata & (SICF_CLOCK_EN << SBTML_SICF_SHIFT)) != 0) {
/* /*
* set target reject and spin until busy is clear * set target reject and spin until busy is clear
* (preserve core-specific bits) * (preserve core-specific bits)
*/ */
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatelow), 4); CORE_SB(corebase, sbtmstatelow), 4);
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4, brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow),
regdata | SBTML_REJ); 4, regdata | SBTML_REJ);
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatelow), 4); CORE_SB(corebase, sbtmstatelow), 4);
udelay(1); udelay(1);
SPINWAIT((brcmf_sdcard_reg_read(card, SPINWAIT((brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatehigh), 4) & CORE_SB(corebase, sbtmstatehigh), 4) &
SBTMH_BUSY), 100000); SBTMH_BUSY), 100000);
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatehigh), 4); CORE_SB(corebase, sbtmstatehigh), 4);
if (regdata & SBTMH_BUSY) if (regdata & SBTMH_BUSY)
BRCMF_ERROR(("%s: ARM core still busy\n", __func__)); BRCMF_ERROR(("%s: ARM core still busy\n", __func__));
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbidlow), 4); CORE_SB(corebase, sbidlow), 4);
if (regdata & SBIDL_INIT) { if (regdata & SBIDL_INIT) {
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbimstate), 4) | CORE_SB(corebase, sbimstate), 4) |
SBIM_RJ; SBIM_RJ;
brcmf_sdcard_reg_write(card, brcmf_sdcard_reg_write(sdiodev,
CORE_SB(corebase, sbimstate), 4, CORE_SB(corebase, sbimstate), 4,
regdata); regdata);
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbimstate), 4); CORE_SB(corebase, sbimstate), 4);
udelay(1); udelay(1);
SPINWAIT((brcmf_sdcard_reg_read(card, SPINWAIT((brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbimstate), 4) & CORE_SB(corebase, sbimstate), 4) &
SBIM_BY), 100000); SBIM_BY), 100000);
} }
/* set reset and reject while enabling the clocks */ /* set reset and reject while enabling the clocks */
brcmf_sdcard_reg_write(card, brcmf_sdcard_reg_write(sdiodev,
CORE_SB(corebase, sbtmstatelow), 4, CORE_SB(corebase, sbtmstatelow), 4,
(((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) | (((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) |
SBTML_REJ | SBTML_RESET)); SBTML_REJ | SBTML_RESET));
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbtmstatelow), 4); CORE_SB(corebase, sbtmstatelow), 4);
udelay(10); udelay(10);
/* clear the initiator reject bit */ /* clear the initiator reject bit */
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbidlow), 4); CORE_SB(corebase, sbidlow), 4);
if (regdata & SBIDL_INIT) { if (regdata & SBIDL_INIT) {
regdata = brcmf_sdcard_reg_read(card, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbimstate), 4) & CORE_SB(corebase, sbimstate), 4) &
~SBIM_RJ; ~SBIM_RJ;
brcmf_sdcard_reg_write(card, brcmf_sdcard_reg_write(sdiodev,
CORE_SB(corebase, sbimstate), 4, CORE_SB(corebase, sbimstate), 4,
regdata); regdata);
} }
} }
/* leave reset and reject asserted */ /* leave reset and reject asserted */
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4, brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4,
(SBTML_REJ | SBTML_RESET)); (SBTML_REJ | SBTML_RESET));
udelay(1); udelay(1);
} }
...@@ -6315,8 +6321,8 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -6315,8 +6321,8 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
/* bus/core/clk setup for register access */ /* bus/core/clk setup for register access */
/* Try forcing SDIO core to do ALPAvail request only */ /* Try forcing SDIO core to do ALPAvail request only */
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
clkset, &err); SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
if (err) { if (err) {
BRCMF_ERROR(("%s: error writing for HT off\n", __func__)); BRCMF_ERROR(("%s: error writing for HT off\n", __func__));
goto fail; goto fail;
...@@ -6324,11 +6330,11 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -6324,11 +6330,11 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
/* If register supported, wait for ALPAvail and then force ALP */ /* If register supported, wait for ALPAvail and then force ALP */
/* This may take up to 15 milliseconds */ /* This may take up to 15 milliseconds */
clkval = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, clkval = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, NULL); SBSDIO_FUNC1_CHIPCLKCSR, NULL);
if ((clkval & ~SBSDIO_AVBITS) == clkset) { if ((clkval & ~SBSDIO_AVBITS) == clkset) {
SPINWAIT(((clkval = SPINWAIT(((clkval =
brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FUNC1_CHIPCLKCSR,
NULL)), NULL)),
!SBSDIO_ALPAV(clkval)), !SBSDIO_ALPAV(clkval)),
...@@ -6341,7 +6347,7 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -6341,7 +6347,7 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
} }
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | clkset = SBSDIO_FORCE_HW_CLKREQ_OFF |
SBSDIO_FORCE_ALP; SBSDIO_FORCE_ALP;
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FUNC1_CHIPCLKCSR,
clkset, &err); clkset, &err);
udelay(65); udelay(65);
...@@ -6353,10 +6359,10 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -6353,10 +6359,10 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
} }
/* Also, disable the extra SDIO pull-ups */ /* Also, disable the extra SDIO pull-ups */
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_SDIOPULLUP, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
0, NULL); SBSDIO_FUNC1_SDIOPULLUP, 0, NULL);
err = brcmf_sdbrcm_chip_recognition(bus->card, ci, regs); err = brcmf_sdbrcm_chip_recognition(bus->sdiodev, ci, regs);
if (err) if (err)
goto fail; goto fail;
...@@ -6364,24 +6370,24 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -6364,24 +6370,24 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
* Make sure any on-chip ARM is off (in case strapping is wrong), * Make sure any on-chip ARM is off (in case strapping is wrong),
* or downloaded code was already running. * or downloaded code was already running.
*/ */
brcmf_sdbrcm_chip_disablecore(bus->card, ci->armcorebase); brcmf_sdbrcm_chip_disablecore(bus->sdiodev, ci->armcorebase);
brcmf_sdcard_reg_write(bus->card, brcmf_sdcard_reg_write(bus->sdiodev,
CORE_CC_REG(ci->cccorebase, gpiopullup), 4, 0); CORE_CC_REG(ci->cccorebase, gpiopullup), 4, 0);
brcmf_sdcard_reg_write(bus->card, brcmf_sdcard_reg_write(bus->sdiodev,
CORE_CC_REG(ci->cccorebase, gpiopulldown), 4, 0); CORE_CC_REG(ci->cccorebase, gpiopulldown), 4, 0);
/* Disable F2 to clear any intermediate frame state on the dongle */ /* Disable F2 to clear any intermediate frame state on the dongle */
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL); SDIO_FUNC_ENABLE_1, NULL);
/* WAR: cmd52 backplane read so core HW will drop ALPReq */ /* WAR: cmd52 backplane read so core HW will drop ALPReq */
clkval = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, clkval = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
0, NULL); 0, NULL);
/* Done with backplane-dependent accesses, can drop clock... */ /* Done with backplane-dependent accesses, can drop clock... */
brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
0, NULL); SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
bus->ci = ci; bus->ci = ci;
return 0; return 0;
...@@ -6392,7 +6398,7 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -6392,7 +6398,7 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
} }
static void static void
brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase) brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_dev *sdiodev, u32 corebase)
{ {
u32 regdata; u32 regdata;
...@@ -6400,37 +6406,38 @@ brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase) ...@@ -6400,37 +6406,38 @@ brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase)
* Must do the disable sequence first to work for * Must do the disable sequence first to work for
* arbitrary current core state. * arbitrary current core state.
*/ */
brcmf_sdbrcm_chip_disablecore(card, corebase); brcmf_sdbrcm_chip_disablecore(sdiodev, corebase);
/* /*
* Now do the initialization sequence. * Now do the initialization sequence.
* set reset while enabling the clock and * set reset while enabling the clock and
* forcing them on throughout the core * forcing them on throughout the core
*/ */
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4, brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4,
((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) | ((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) |
SBTML_RESET); SBTML_RESET);
udelay(1); udelay(1);
regdata = brcmf_sdcard_reg_read(card, CORE_SB(corebase, sbtmstatehigh), regdata = brcmf_sdcard_reg_read(sdiodev,
4); CORE_SB(corebase, sbtmstatehigh), 4);
if (regdata & SBTMH_SERR) if (regdata & SBTMH_SERR)
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatehigh), brcmf_sdcard_reg_write(sdiodev,
4, 0); CORE_SB(corebase, sbtmstatehigh), 4, 0);
regdata = brcmf_sdcard_reg_read(card, CORE_SB(corebase, sbimstate), 4); regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbimstate), 4);
if (regdata & (SBIM_IBE | SBIM_TO)) if (regdata & (SBIM_IBE | SBIM_TO))
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbimstate), 4, brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbimstate), 4,
regdata & ~(SBIM_IBE | SBIM_TO)); regdata & ~(SBIM_IBE | SBIM_TO));
/* clear reset and allow it to propagate throughout the core */ /* clear reset and allow it to propagate throughout the core */
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4, brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4,
(SICF_FGC << SBTML_SICF_SHIFT) | (SICF_FGC << SBTML_SICF_SHIFT) |
(SICF_CLOCK_EN << SBTML_SICF_SHIFT)); (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
udelay(1); udelay(1);
/* leave clock enabled */ /* leave clock enabled */
brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4, brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4,
(SICF_CLOCK_EN << SBTML_SICF_SHIFT)); (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
udelay(1); udelay(1);
} }
...@@ -6524,15 +6531,15 @@ static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus, ...@@ -6524,15 +6531,15 @@ static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus,
} }
} }
brcmf_sdcard_reg_write(bus->card, brcmf_sdcard_reg_write(bus->sdiodev,
CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr), CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr),
4, 1); 4, 1);
cc_data_temp = brcmf_sdcard_reg_read(bus->card, cc_data_temp = brcmf_sdcard_reg_read(bus->sdiodev,
CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr), 4); CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr), 4);
cc_data_temp &= ~str_mask; cc_data_temp &= ~str_mask;
drivestrength_sel <<= str_shift; drivestrength_sel <<= str_shift;
cc_data_temp |= drivestrength_sel; cc_data_temp |= drivestrength_sel;
brcmf_sdcard_reg_write(bus->card, brcmf_sdcard_reg_write(bus->sdiodev,
CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr), CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr),
4, cc_data_temp); 4, cc_data_temp);
......
...@@ -116,9 +116,6 @@ ...@@ -116,9 +116,6 @@
#define SUCCESS 0 #define SUCCESS 0
#define ERROR 1 #define ERROR 1
/* forward declarations */
struct brcmf_sdio_card;
struct brcmf_sdreg { struct brcmf_sdreg {
int func; int func;
int offset; int offset;
...@@ -158,20 +155,22 @@ struct brcmf_sdmmc_instance { ...@@ -158,20 +155,22 @@ 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;
struct brcmf_sdio_card *card; void *sdioh; /* sdioh handler */
u32 sbwad; /* Save backplane window address */
bool regfail; /* status of last reg_r/w call */
void *bus; void *bus;
}; };
/* Enable/disable SD interrupt */ /* Enable/disable SD interrupt */
extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card); extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card); extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_dev *sdiodev);
/* Register/deregister device interrupt handler. */ /* Register/deregister device interrupt handler. */
extern int extern int
brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card, brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
void (*fn)(void *), void *argh); void (*fn)(void *), void *argh);
extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card); extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev);
/* 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
...@@ -179,17 +178,17 @@ extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card); ...@@ -179,17 +178,17 @@ extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card);
* 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(struct brcmf_sdio_card *card, uint func, extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint func,
u32 addr, int *err); u32 addr, int *err);
extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint func, extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint func,
u32 addr, u8 data, int *err); u32 addr, u8 data, int *err);
/* Read/Write 4bytes from/to cfg space */ /* Read/Write 4bytes from/to cfg space */
extern u32 extern u32
brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num, brcmf_sdcard_cfg_read_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
u32 addr, int *err); u32 addr, int *err);
extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_dev *sdiodev,
uint fnc_num, u32 addr, uint fnc_num, u32 addr,
u32 data, int *err); u32 data, int *err);
...@@ -200,7 +199,7 @@ extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, ...@@ -200,7 +199,7 @@ extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card,
* 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(struct brcmf_sdio_card *card, uint func, extern int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
u8 *cis, uint length); 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.
...@@ -209,14 +208,14 @@ extern int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, ...@@ -209,14 +208,14 @@ extern int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func,
* data: data for register write * data: data for register write
*/ */
extern u32 extern u32
brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size); brcmf_sdcard_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size);
extern u32 extern u32
brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, brcmf_sdcard_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size,
u32 data); u32 data);
/* Indicate if last reg read/write failed */ /* Indicate if last reg read/write failed */
extern bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card); extern bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev);
/* Buffer transfer to/from device (client) core via cmd53. /* Buffer transfer to/from device (client) core via cmd53.
* fn: function number * fn: function number
...@@ -231,13 +230,13 @@ extern bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card); ...@@ -231,13 +230,13 @@ extern bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card);
* NOTE: Async operation is not currently supported. * NOTE: Async operation is not currently supported.
*/ */
extern int extern int
brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, void *pkt, uint flags, u8 *buf, uint nbytes, void *pkt,
void (*complete)(void *handle, int status, void (*complete)(void *handle, int status,
bool sync_waiting), bool sync_waiting),
void *handle); void *handle);
extern int extern int
brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt, uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt,
void (*complete)(void *handle, int status, void (*complete)(void *handle, int status,
bool sync_waiting), bool sync_waiting),
...@@ -262,16 +261,16 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, ...@@ -262,16 +261,16 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, 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(struct brcmf_sdio_card *card, uint rw, u32 addr, extern int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw,
u8 *buf, uint nbytes); u32 addr, u8 *buf, uint nbytes);
/* Issue an abort to the specified function */ /* Issue an abort to the specified function */
extern int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn); extern int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
/* Miscellaneous knob tweaker. */ /* Miscellaneous knob tweaker. */
extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name, extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev,
void *params, int plen, void *arg, int len, const char *name, void *params, int plen,
bool set); void *arg, int len, bool set);
/* helper functions */ /* helper functions */
...@@ -286,7 +285,7 @@ extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev); ...@@ -286,7 +285,7 @@ extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev); extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev);
/* Function to return current window addr */ /* Function to return current window addr */
extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card); extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
/* Allocate/init/free per-OS private data */ /* Allocate/init/free per-OS private data */
extern int brcmf_sdioh_osinit(struct sdioh_info *sd); extern int brcmf_sdioh_osinit(struct sdioh_info *sd);
...@@ -355,4 +354,7 @@ extern uint sd_f2_blocksize; ...@@ -355,4 +354,7 @@ extern uint sd_f2_blocksize;
extern struct brcmf_sdmmc_instance *gInstance; extern struct brcmf_sdmmc_instance *gInstance;
extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
u32 regsva, struct brcmf_sdio_dev *sdiodev);
extern void brcmf_sdbrcm_disconnect(void *ptr);
#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