typedef struct dhd_bus {
struct brcmf_pub *dhd;
- struct brcmf_sdio *sdh; /* Handle for sdio card calls */
+ struct brcmf_sdio_card *card; /* Handle for sdio card calls */
struct chip_info *ci; /* Chip info struct */
char *vars; /* Variables (from CIS and/or other) */
uint varsz; /* Size of variables buffer */
retryvar = 0; \
do { \
regvar = R_REG(regaddr); \
- } while (brcmf_sdcard_regfail(bus->sdh) && \
+ } while (brcmf_sdcard_regfail(bus->card) && \
(++retryvar <= retry_limit)); \
if (retryvar) { \
bus->regfails += (retryvar-1); \
retryvar = 0; \
do { \
W_REG(regaddr, regval); \
- } while (brcmf_sdcard_regfail(bus->sdh) && \
+ } while (brcmf_sdcard_regfail(bus->card) && \
(++retryvar <= retry_limit)); \
if (retryvar) { \
bus->regfails += (retryvar-1); \
static void brcmf_sdbrcm_release_malloc(dhd_bus_t *bus);
static void brcmf_sdbrcm_disconnect(void *ptr);
static bool brcmf_sdbrcm_chipmatch(u16 chipid);
-static bool brcmf_sdbrcm_probe_attach(dhd_bus_t *bus, void *sdh,
+static bool brcmf_sdbrcm_probe_attach(dhd_bus_t *bus, void *card,
void *regsva, u16 devid);
-static bool brcmf_sdbrcm_probe_malloc(dhd_bus_t *bus, void *sdh);
-static bool brcmf_sdbrcm_probe_init(dhd_bus_t *bus, void *sdh);
+static bool brcmf_sdbrcm_probe_malloc(dhd_bus_t *bus, void *card);
+static bool brcmf_sdbrcm_probe_init(dhd_bus_t *bus, void *card);
static void brcmf_sdbrcm_release_dongle(dhd_bus_t *bus);
static uint brcmf_process_nvram_vars(char *varbuf, uint len);
struct sk_buff *pkt,
brcmf_sdio_cmplt_fn_t complete, void *handle);
-static bool brcmf_sdbrcm_download_firmware(struct dhd_bus *bus, void *sdh);
+static bool brcmf_sdbrcm_download_firmware(struct dhd_bus *bus, void *card);
static int _brcmf_sdbrcm_download_firmware(struct dhd_bus *bus);
static int brcmf_sdbrcm_download_code_file(struct dhd_bus *bus);
static int brcmf_sdbrcm_download_nvram(struct dhd_bus *bus);
-static void brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio *sdh, u32 corebase);
+
+static void
+brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase);
+
static int brcmf_sdbrcm_chip_attach(struct dhd_bus *bus, void *regs);
-static void brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio *sdh, u32 corebase);
+
+static void
+brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase);
+
static void brcmf_sdbrcm_sdiod_drive_strength_init(struct dhd_bus *bus,
u32 drivestrength);
static void brcmf_sdbrcm_chip_detach(struct dhd_bus *bus);
static int brcmf_sdbrcm_set_siaddr_window(dhd_bus_t *bus, u32 address)
{
int err = 0;
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
(address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
if (!err)
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_SBADDRMID,
(address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
if (!err)
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_SBADDRHIGH,
(address >> 24) & SBSDIO_SBADDRHIGH_MASK,
&err);
{
int err;
u8 clkctl, clkreq, devctl;
- struct brcmf_sdio *sdh;
+ struct brcmf_sdio_card *card;
DHD_TRACE(("%s: Enter\n", __func__));
clkctl = 0;
- sdh = bus->sdh;
+ card = bus->card;
if (on) {
/* Request HT Avail */
&& (bus->ci->chiprev == 0))
clkreq |= SBSDIO_FORCE_ALP;
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
if (err) {
DHD_ERROR(("%s: HT Avail request error: %d\n",
}
/* Check current status */
- clkctl = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (err) {
DHD_ERROR(("%s: HT Avail read error: %d\n",
/* Go to pending and await interrupt if appropriate */
if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
/* Allow only clock-available interrupt */
- devctl = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err);
if (err) {
DHD_ERROR(("%s: Devctl error setting CA: %d\n",
}
devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err);
DHD_INFO(("CLKCTL: set PENDING\n"));
bus->clkstate = CLK_PENDING;
} else if (bus->clkstate == CLK_PENDING) {
/* Cancel CA-only interrupt filter */
devctl =
- brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err);
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err);
}
/* Otherwise, wait here (polling) for HT Avail */
if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
BRCMF_SPINWAIT_SLEEP(sdioh_spinwait_sleep,
- ((clkctl =
- brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
- SBSDIO_FUNC1_CHIPCLKCSR,
- &err)),
- !SBSDIO_CLKAV(clkctl, bus->alp_only)),
- PMU_MAX_TRANSITION_DLY);
+ ((clkctl =
+ brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
+ SBSDIO_FUNC1_CHIPCLKCSR,
+ &err)),
+ !SBSDIO_CLKAV(clkctl, bus->alp_only)),
+ PMU_MAX_TRANSITION_DLY);
}
if (err) {
DHD_ERROR(("%s: HT Avail request error: %d\n",
if (bus->clkstate == CLK_PENDING) {
/* Cancel CA-only interrupt filter */
- devctl = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err);
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err);
}
bus->clkstate = CLK_SDONLY;
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
DHD_INFO(("CLKCTL: turned OFF\n"));
if (err) {
int brcmf_sdbrcm_bussleep(dhd_bus_t *bus, bool sleep)
{
- struct brcmf_sdio *sdh = bus->sdh;
+ struct brcmf_sdio_card *card = bus->card;
struct sdpcmd_regs *regs = bus->regs;
uint retries = 0;
return -EBUSY;
/* Disable SDIO interrupts (no longer interested) */
- brcmf_sdcard_intr_disable(bus->sdh);
+ brcmf_sdcard_intr_disable(bus->card);
/* Make sure the controller has the bus up */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
/* Turn off our contribution to the HT clock request */
brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR,
SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
/* Isolate the bus */
if (bus->ci->chip != BCM4329_CHIP_ID
&& bus->ci->chip != BCM4319_CHIP_ID) {
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL,
SBSDIO_DEVCTL_PADS_ISO, NULL);
}
} else {
/* Waking up: bus power up is ok, set local state */
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
/* Force pad isolation off if possible
(in case power never toggled) */
if ((bus->ci->buscoretype == PCMCIA_CORE_ID)
&& (bus->ci->buscorerev >= 10))
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, 0, NULL);
/* Make sure the controller has the bus up */
/* Enable interrupts again */
if (bus->intr && (bus->dhd->busstate == DHD_BUS_DATA)) {
bus->intdis = false;
- brcmf_sdcard_intr_enable(bus->sdh);
+ brcmf_sdcard_intr_enable(bus->card);
}
}
u16 len, pad = 0;
u32 swheader;
uint retries = 0;
- struct brcmf_sdio *sdh;
+ struct brcmf_sdio_card *card;
struct sk_buff *new;
int i;
DHD_TRACE(("%s: Enter\n", __func__));
- sdh = bus->sdh;
+ card = bus->card;
if (bus->dhd->dongle_reset) {
ret = -EPERM;
}
do {
- ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(sdh),
+ ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card),
SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL);
bus->f2txdata++;
ASSERT(ret != -BCME_PENDING);
"terminate frame.\n", __func__, ret));
bus->tx_sderrs++;
- brcmf_sdcard_abort(sdh, SDIO_FUNC_2);
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
NULL);
bus->f1regdata++;
for (i = 0; i < 3; i++) {
u8 hi, lo;
- hi = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCHI,
NULL);
- lo = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCLO,
NULL);
bus->f1regdata += 2;
/* Check device status, signal pending interrupt */
R_SDREG(intstatus, ®s->intstatus, retries);
bus->f2txdata++;
- if (brcmf_sdcard_regfail(bus->sdh))
+ if (brcmf_sdcard_regfail(bus->card))
break;
if (intstatus & bus->hostintmask)
bus->ipend = true;
u16 len;
u32 swheader;
uint retries = 0;
- struct brcmf_sdio *sdh = bus->sdh;
+ struct brcmf_sdio_card *card = bus->card;
u8 doff = 0;
int ret = -1;
int i;
do {
bus->ctrl_frame_stat = false;
ret = brcmf_sdbrcm_send_buf(bus,
- brcmf_sdcard_cur_sbwad(sdh), SDIO_FUNC_2,
+ brcmf_sdcard_cur_sbwad(card), SDIO_FUNC_2,
F2SYNC, frame, len, NULL, NULL, NULL);
ASSERT(ret != -BCME_PENDING);
__func__, ret));
bus->tx_sderrs++;
- brcmf_sdcard_abort(sdh, SDIO_FUNC_2);
+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL,
SFC_WF_TERM, NULL);
bus->f1regdata++;
for (i = 0; i < 3; i++) {
u8 hi, lo;
- hi = brcmf_sdcard_cfg_read(sdh,
+ hi = brcmf_sdcard_cfg_read(card,
SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCHI,
NULL);
- lo = brcmf_sdcard_cfg_read(sdh,
+ lo = brcmf_sdcard_cfg_read(card,
SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCLO,
NULL);
#ifdef BCMDBG
brcmu_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",
bus->dpc_sched,
- (brcmf_sdcard_intr_pending(bus->sdh) ? " " : " not "));
+ (brcmf_sdcard_intr_pending(bus->card) ? " " : " not "));
brcmu_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize,
bus->roundup);
#endif /* BCMDBG */
__func__, (write ? "write" : "read"), dsize,
sdaddr, (address & SBSDIO_SBWINDOW_MASK)));
bcmerror =
- brcmf_sdcard_rwdata(bus->sdh, write, sdaddr, data, dsize);
+ brcmf_sdcard_rwdata(bus->card, write, sdaddr, data, dsize);
if (bcmerror) {
DHD_ERROR(("%s: membytes transfer failed\n", __func__));
break;
xfer_done:
/* Return the window to backplane enumeration space for core access */
if (brcmf_sdbrcm_set_siaddr_window(bus,
- brcmf_sdcard_cur_sbwad(bus->sdh))) {
+ brcmf_sdcard_cur_sbwad(bus->card))) {
DHD_ERROR(("%s: FAILED to set window back to 0x%x\n",
- __func__, brcmf_sdcard_cur_sbwad(bus->sdh)));
+ __func__, brcmf_sdcard_cur_sbwad(bus->card)));
}
return bcmerror;
if (bus->intr) {
DHD_INTR(("%s: enable SDIO device interrupts\n",
__func__));
- brcmf_sdcard_intr_enable(bus->sdh);
+ brcmf_sdcard_intr_enable(bus->card);
} else {
DHD_INTR(("%s: disable SDIO interrupts\n",
__func__));
- brcmf_sdcard_intr_disable(bus->sdh);
+ brcmf_sdcard_intr_disable(bus->card);
}
}
break;
addr = (unsigned long)bus->regs + sd_ptr->offset;
size = sd_ptr->func;
- int_val = (s32) brcmf_sdcard_reg_read(bus->sdh, addr,
+ int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr,
size);
- if (brcmf_sdcard_regfail(bus->sdh))
+ if (brcmf_sdcard_regfail(bus->card))
bcmerror = -EIO;
memcpy(arg, &int_val, sizeof(s32));
break;
addr = (unsigned long)bus->regs + sd_ptr->offset;
size = sd_ptr->func;
- brcmf_sdcard_reg_write(bus->sdh, addr, size,
+ brcmf_sdcard_reg_write(bus->card, addr, size,
sd_ptr->value);
- if (brcmf_sdcard_regfail(bus->sdh))
+ if (brcmf_sdcard_regfail(bus->card))
bcmerror = -EIO;
break;
}
addr = SI_ENUM_BASE + sdreg.offset;
size = sdreg.func;
- int_val = (s32) brcmf_sdcard_reg_read(bus->sdh, addr,
+ int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr,
size);
- if (brcmf_sdcard_regfail(bus->sdh))
+ if (brcmf_sdcard_regfail(bus->card))
bcmerror = -EIO;
memcpy(arg, &int_val, sizeof(s32));
break;
addr = SI_ENUM_BASE + sdreg.offset;
size = sdreg.func;
- brcmf_sdcard_reg_write(bus->sdh, addr, size,
+ brcmf_sdcard_reg_write(bus->card, addr, size,
sdreg.value);
- if (brcmf_sdcard_regfail(bus->sdh))
+ if (brcmf_sdcard_regfail(bus->card))
bcmerror = -EIO;
break;
}
*(char *)arg = 0;
strcat(arg, "\nFunc 0\n");
- brcmf_sdcard_cis_read(bus->sdh, 0x10,
+ brcmf_sdcard_cis_read(bus->card, 0x10,
(u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT);
strcat(arg, "\nFunc 1\n");
- brcmf_sdcard_cis_read(bus->sdh, 0x11,
+ brcmf_sdcard_cis_read(bus->card, 0x11,
(u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT);
strcat(arg, "\nFunc 2\n");
- brcmf_sdcard_cis_read(bus->sdh, 0x12,
+ brcmf_sdcard_cis_read(bus->card, 0x12,
(u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT);
break;
if (enter) {
bus->alp_only = true;
- brcmf_sdbrcm_chip_disablecore(bus->sdh, bus->ci->armcorebase);
+ brcmf_sdbrcm_chip_disablecore(bus->card, bus->ci->armcorebase);
- brcmf_sdbrcm_chip_resetcore(bus->sdh, bus->ci->ramcorebase);
+ brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->ramcorebase);
/* Clear the top bit of memory */
if (bus->ramsize) {
(u8 *)&zeros, 4);
}
} else {
- regdata = brcmf_sdcard_reg_read(bus->sdh,
+ regdata = brcmf_sdcard_reg_read(bus->card,
CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4);
regdata &= (SBTML_RESET | SBTML_REJ_MASK |
(SICF_CLOCK_EN << SBTML_SICF_SHIFT));
W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries);
- brcmf_sdbrcm_chip_resetcore(bus->sdh, bus->ci->armcorebase);
+ brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->armcorebase);
/* Allow HT Clock now that the ARM is running. */
bus->alp_only = false;
/* Turn on clock in case SD command needs backplane */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
- bcmerror = brcmf_sdcard_iovar_op(bus->sdh, name, params, plen,
+ bcmerror = brcmf_sdcard_iovar_op(bus->card, name, params, plen,
arg, len, set);
/* Similar check for blocksize change */
if (set && strcmp(name, "sd_blocksize") == 0) {
s32 fnum = 2;
if (brcmf_sdcard_iovar_op
- (bus->sdh, "sd_blocksize", &fnum, sizeof(s32),
+ (bus->card, "sd_blocksize", &fnum, sizeof(s32),
&bus->blocksize, sizeof(s32),
false) != 0) {
bus->blocksize = 0;
bus->dhd->busstate = DHD_BUS_DOWN;
/* Force clocks on backplane to be sure F2 interrupt propagates */
- saveclk = brcmf_sdcard_cfg_read(bus->sdh, SDIO_FUNC_1,
+ saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (!err) {
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR,
(saveclk | SBSDIO_FORCE_HT), &err);
}
/* Turn off the bus (F2), free any pending packets */
DHD_INTR(("%s: disable SDIO interrupts\n", __func__));
- brcmf_sdcard_intr_disable(bus->sdh);
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_0, SDIO_CCCR_IOEx,
+ brcmf_sdcard_intr_disable(bus->card);
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL);
/* Clear any pending interrupts now that F2 is disabled */
/* try to download image and nvram to the dongle */
if (dhdp->busstate == DHD_BUS_DOWN) {
- if (!(brcmf_sdbrcm_download_firmware(bus, bus->sdh)))
+ if (!(brcmf_sdbrcm_download_firmware(bus, bus->card)))
return -1;
}
/* Force clocks on backplane to be sure F2 interrupt propagates */
saveclk =
- brcmf_sdcard_cfg_read(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (!err) {
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR,
(saveclk | SBSDIO_FORCE_HT), &err);
}
&bus->regs->tosbmailboxdata, retries);
enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_0, SDIO_CCCR_IOEx, enable,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, enable,
NULL);
/* Give the dongle some time to do its thing and set IOR2 */
ready = 0;
while (ready != enable && !brcmf_timeout_expired(&tmo))
- ready =
- brcmf_sdcard_cfg_read(bus->sdh, SDIO_FUNC_0, SDIO_CCCR_IORx,
- NULL);
+ ready = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_0,
+ SDIO_CCCR_IORx, NULL);
DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
__func__, enable, ready, tmo.elapsed));
(unsigned int *)CORE_BUS_REG(bus->ci->buscorebase,
hostintmask), retries);
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_WATERMARK,
(u8) watermark, &err);
/* Set bus state according to enable result */
if (bus->intr) {
DHD_INTR(("%s: enable SDIO device interrupts\n",
__func__));
- brcmf_sdcard_intr_enable(bus->sdh);
+ brcmf_sdcard_intr_enable(bus->card);
} else {
DHD_INTR(("%s: disable SDIO interrupts\n", __func__));
- brcmf_sdcard_intr_disable(bus->sdh);
+ brcmf_sdcard_intr_disable(bus->card);
}
}
else {
/* Disable F2 again */
enable = SDIO_FUNC_ENABLE_1;
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_0, SDIO_CCCR_IOEx,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
enable, NULL);
}
/* Restore previous clock setting */
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
saveclk, &err);
#if defined(OOB_INTR_ONLY)
static void brcmf_sdbrcm_rxfail(dhd_bus_t *bus, bool abort, bool rtx)
{
- struct brcmf_sdio *sdh = bus->sdh;
+ struct brcmf_sdio_card *card = bus->card;
struct sdpcmd_regs *regs = bus->regs;
uint retries = 0;
u16 lastrbc;
(rtx ? ", send NAK" : "")));
if (abort)
- brcmf_sdcard_abort(sdh, SDIO_FUNC_2);
+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
SFC_RF_TERM, &err);
bus->f1regdata++;
/* Wait until the packet has been flushed (device/FIFO stable) */
for (lastrbc = retries = 0xffff; retries > 0; retries--) {
- hi = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_RFRAMEBCHI, NULL);
- lo = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_RFRAMEBCLO, NULL);
bus->f1regdata += 2;
bus->nextlen = 0;
/* If we can't reach the device, signal failure */
- if (err || brcmf_sdcard_regfail(sdh))
+ if (err || brcmf_sdcard_regfail(card))
bus->dhd->busstate = DHD_BUS_DOWN;
}
static void
brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
{
- struct brcmf_sdio *sdh = bus->sdh;
+ struct brcmf_sdio_card *card = bus->card;
uint rdlen, pad;
int sdret;
}
/* Read remainder of frame body into the rxctl buffer */
- sdret = brcmf_sdcard_recv_buf(sdh, brcmf_sdcard_cur_sbwad(sdh),
+ sdret = brcmf_sdcard_recv_buf(card, brcmf_sdcard_cur_sbwad(card),
SDIO_FUNC_2,
F2SYNC, (bus->rxctl + firstread), rdlen,
NULL, NULL, NULL);
* packet and and copy into the chain.
*/
if (usechain) {
- errcode = brcmf_sdcard_recv_buf(bus->sdh,
- brcmf_sdcard_cur_sbwad(bus->sdh),
+ errcode = brcmf_sdcard_recv_buf(bus->card,
+ brcmf_sdcard_cur_sbwad(bus->card),
SDIO_FUNC_2,
F2SYNC, (u8 *) pfirst->data, dlen,
pfirst, NULL, NULL);
} else if (bus->dataptr) {
- errcode = brcmf_sdcard_recv_buf(bus->sdh,
- brcmf_sdcard_cur_sbwad(bus->sdh),
+ errcode = brcmf_sdcard_recv_buf(bus->card,
+ brcmf_sdcard_cur_sbwad(bus->card),
SDIO_FUNC_2,
F2SYNC, bus->dataptr, dlen,
NULL, NULL, NULL);
static uint
brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
{
- struct brcmf_sdio *sdh = bus->sdh;
+ struct brcmf_sdio_card *card = bus->card;
u16 len, check; /* Extracted hardware header fields */
u8 chan, seq, doff; /* Extracted software header fields */
ASSERT(bus->rxctl >= bus->rxbuf);
rxbuf = bus->rxctl;
/* Read the entire frame */
- sdret = brcmf_sdcard_recv_buf(sdh,
- brcmf_sdcard_cur_sbwad(sdh),
- SDIO_FUNC_2, F2SYNC,
- rxbuf, rdlen,
- NULL, NULL, NULL);
+ sdret = brcmf_sdcard_recv_buf(card,
+ brcmf_sdcard_cur_sbwad(card),
+ SDIO_FUNC_2, F2SYNC,
+ rxbuf, rdlen,
+ NULL, NULL, NULL);
bus->f2rxdata++;
ASSERT(sdret != -BCME_PENDING);
PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
rxbuf = (u8 *) (pkt->data);
/* Read the entire frame */
- sdret = brcmf_sdcard_recv_buf(sdh,
- brcmf_sdcard_cur_sbwad(sdh),
+ sdret = brcmf_sdcard_recv_buf(card,
+ brcmf_sdcard_cur_sbwad(card),
SDIO_FUNC_2, F2SYNC,
rxbuf, rdlen,
pkt, NULL, NULL);
break;
/* Read frame header (hardware and software) */
- sdret = brcmf_sdcard_recv_buf(sdh, brcmf_sdcard_cur_sbwad(sdh),
+ sdret = brcmf_sdcard_recv_buf(card,
+ brcmf_sdcard_cur_sbwad(card),
SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,
NULL, NULL, NULL);
bus->f2rxhdrs++;
PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
/* Read the remaining frame data */
- sdret = brcmf_sdcard_recv_buf(sdh, brcmf_sdcard_cur_sbwad(sdh),
+ sdret = brcmf_sdcard_recv_buf(card,
+ brcmf_sdcard_cur_sbwad(card),
SDIO_FUNC_2, F2SYNC, ((u8 *) (pkt->data)),
rdlen, pkt, NULL, NULL);
bus->f2rxdata++;
static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus)
{
- struct brcmf_sdio *sdh = bus->sdh;
+ struct brcmf_sdio_card *card = bus->card;
struct sdpcmd_regs *regs = bus->regs;
u32 intstatus, newstatus = 0;
uint retries = 0;
#ifdef BCMDBG
/* Check for inconsistent device control */
- devctl = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err);
if (err) {
DHD_ERROR(("%s: error reading DEVCTL: %d\n",
#endif /* BCMDBG */
/* Read CSR, if clock on switch to AVAIL, else ignore */
- clkctl = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (err) {
DHD_ERROR(("%s: error reading CSR: %d\n", __func__,
clkctl));
if (SBSDIO_HTAV(clkctl)) {
- devctl = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, &err);
if (err) {
DHD_ERROR(("%s: error reading DEVCTL: %d\n",
bus->dhd->busstate = DHD_BUS_DOWN;
}
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_DEVICE_CTL, devctl, &err);
if (err) {
DHD_ERROR(("%s: error writing DEVCTL: %d\n",
bus->ipend = false;
R_SDREG(newstatus, ®s->intstatus, retries);
bus->f1regdata++;
- if (brcmf_sdcard_regfail(bus->sdh))
+ if (brcmf_sdcard_regfail(bus->card))
newstatus = 0;
newstatus &= bus->hostintmask;
bus->fcstate = !!(newstatus & I_HMB_FC_STATE);
* or clock availability. (Allows tx loop to check ipend if desired.)
* (Unless register access seems hosed, as we may not be able to ACK...)
*/
- if (bus->intr && bus->intdis && !brcmf_sdcard_regfail(sdh)) {
+ if (bus->intr && bus->intdis && !brcmf_sdcard_regfail(card)) {
DHD_INTR(("%s: enable SDIO interrupts, rxdone %d framecnt %d\n",
__func__, rxdone, framecnt));
bus->intdis = false;
- brcmf_sdcard_intr_enable(sdh);
+ brcmf_sdcard_intr_enable(card);
}
if (DATAOK(bus) && bus->ctrl_frame_stat &&
(bus->clkstate == CLK_AVAIL)) {
int ret, i;
- ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(sdh),
+ ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card),
SDIO_FUNC_2, F2SYNC, (u8 *) bus->ctrl_frame_buf,
(u32) bus->ctrl_frame_len, NULL, NULL, NULL);
ASSERT(ret != -BCME_PENDING);
"terminate frame.\n", __func__, ret));
bus->tx_sderrs++;
- brcmf_sdcard_abort(sdh, SDIO_FUNC_2);
+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
NULL);
bus->f1regdata++;
for (i = 0; i < 3; i++) {
u8 hi, lo;
- hi = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCHI,
NULL);
- lo = brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_WFRAMEBCLO,
NULL);
bus->f1regdata += 2;
else await next interrupt */
/* On failed register access, all bets are off:
no resched or interrupts */
- if ((bus->dhd->busstate == DHD_BUS_DOWN) || brcmf_sdcard_regfail(sdh)) {
+ if ((bus->dhd->busstate == DHD_BUS_DOWN) ||
+ brcmf_sdcard_regfail(card)) {
DHD_ERROR(("%s: failed backplane access over SDIO, halting "
- "operation %d\n", __func__, brcmf_sdcard_regfail(sdh)));
+ "operation %d\n", __func__,
+ brcmf_sdcard_regfail(card)));
bus->dhd->busstate = DHD_BUS_DOWN;
bus->intstatus = 0;
} else if (bus->clkstate == CLK_PENDING) {
void brcmf_sdbrcm_isr(void *arg)
{
dhd_bus_t *bus = (dhd_bus_t *) arg;
- struct brcmf_sdio *sdh;
+ struct brcmf_sdio_card *card;
DHD_TRACE(("%s: Enter\n", __func__));
DHD_ERROR(("%s : bus is null pointer , exit\n", __func__));
return;
}
- sdh = bus->sdh;
+ card = bus->card;
if (bus->dhd->busstate == DHD_BUS_DOWN) {
DHD_ERROR(("%s : bus is down. we have nothing to do\n",
else
DHD_ERROR(("brcmf_sdbrcm_isr() w/o interrupt configured!\n"));
- brcmf_sdcard_intr_disable(sdh);
+ brcmf_sdcard_intr_disable(card);
bus->intdis = true;
#if defined(SDIO_ISR_THREAD)
if (!bus->dpc_sched) {
u8 devpend;
- devpend = brcmf_sdcard_cfg_read(bus->sdh,
+ devpend = brcmf_sdcard_cfg_read(bus->card,
SDIO_FUNC_0, SDIO_CCCR_INTx,
NULL);
intstatus =
bus->pollcnt++;
bus->ipend = true;
if (bus->intr)
- brcmf_sdcard_intr_disable(bus->sdh);
+ brcmf_sdcard_intr_disable(bus->card);
bus->dpc_sched = true;
brcmf_sdbrcm_sched_dpc(bus);
static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
u16 slot, u16 func, uint bustype, void *regsva,
- void *sdh)
+ void *card)
{
int ret;
dhd_bus_t *bus;
DHD_ERROR(("%s: kmalloc of dhd_bus_t failed\n", __func__));
goto fail;
}
- bus->sdh = sdh;
+ bus->card = card;
bus->cl_devid = (u16) devid;
bus->bus = DHD_BUS;
bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
else use locally malloced rxbuf */
/* attempt to attach to the dongle */
- if (!(brcmf_sdbrcm_probe_attach(bus, sdh, regsva, devid))) {
+ if (!(brcmf_sdbrcm_probe_attach(bus, card, regsva, devid))) {
DHD_ERROR(("%s: brcmf_sdbrcm_probe_attach failed\n", __func__));
goto fail;
}
}
/* Allocate buffers */
- if (!(brcmf_sdbrcm_probe_malloc(bus, sdh))) {
+ if (!(brcmf_sdbrcm_probe_malloc(bus, card))) {
DHD_ERROR(("%s: brcmf_sdbrcm_probe_malloc failed\n", __func__));
goto fail;
}
- if (!(brcmf_sdbrcm_probe_init(bus, sdh))) {
+ if (!(brcmf_sdbrcm_probe_init(bus, card))) {
DHD_ERROR(("%s: brcmf_sdbrcm_probe_init failed\n", __func__));
goto fail;
}
/* Register interrupt callback, but mask it (not operational yet). */
DHD_INTR(("%s: disable SDIO interrupts (not interested yet)\n",
__func__));
- brcmf_sdcard_intr_disable(sdh);
- ret = brcmf_sdcard_intr_reg(sdh, brcmf_sdbrcm_isr, bus);
+ brcmf_sdcard_intr_disable(card);
+ ret = brcmf_sdcard_intr_reg(card, brcmf_sdbrcm_isr, bus);
if (ret != 0) {
DHD_ERROR(("%s: FAILED: sdcard_intr_reg returned %d\n",
__func__, ret));
}
static bool
-brcmf_sdbrcm_probe_attach(struct dhd_bus *bus, void *sdh, void *regsva,
+brcmf_sdbrcm_probe_attach(struct dhd_bus *bus, void *card, void *regsva,
u16 devid)
{
u8 clkctl = 0;
#ifdef BCMDBG
printk(KERN_DEBUG "F1 signature read @0x18000000=0x%4x\n",
- brcmf_sdcard_reg_read(bus->sdh, SI_ENUM_BASE, 4));
+ brcmf_sdcard_reg_read(bus->card, SI_ENUM_BASE, 4));
#endif /* BCMDBG */
* programs PLL control regs
*/
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
DHD_INIT_CLKCTL1, &err);
if (!err)
clkctl =
- brcmf_sdcard_cfg_read(sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, &err);
if (err || ((clkctl & ~SBSDIO_AVBITS) != DHD_INIT_CLKCTL1)) {
goto fail;
}
- brcmf_sdcard_chipinfo(sdh, bus->ci->chip, bus->ci->chiprev);
+ brcmf_sdcard_chipinfo(card, bus->ci->chip, bus->ci->chiprev);
if (!brcmf_sdbrcm_chipmatch((u16) bus->ci->chip)) {
DHD_ERROR(("%s: unsupported chip: 0x%04x\n",
/* Get info on the ARM and SOCRAM cores... */
if (!DHD_NOPMU(bus)) {
- bus->armrev = SBCOREREV(brcmf_sdcard_reg_read(bus->sdh,
+ bus->armrev = SBCOREREV(brcmf_sdcard_reg_read(bus->card,
CORE_SB(bus->ci->armcorebase, sbidhigh), 4));
bus->orig_ramsize = bus->ci->ramsize;
if (!(bus->orig_ramsize)) {
return false;
}
-static bool brcmf_sdbrcm_probe_malloc(dhd_bus_t *bus, void *sdh)
+static bool brcmf_sdbrcm_probe_malloc(dhd_bus_t *bus, void *card)
{
DHD_TRACE(("%s: Enter\n", __func__));
return false;
}
-static bool brcmf_sdbrcm_probe_init(dhd_bus_t *bus, void *sdh)
+static bool brcmf_sdbrcm_probe_init(dhd_bus_t *bus, void *card)
{
s32 fnum;
#endif /* SDTEST */
/* Disable F2 to clear any intermediate frame state on the dongle */
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_0, SDIO_CCCR_IOEx,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL);
bus->dhd->busstate = DHD_BUS_DOWN;
bus->prev_rxlim_hit = 0;
/* Done with backplane-dependent accesses, can drop clock... */
- brcmf_sdcard_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, 0,
+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, 0,
NULL);
/* ...and initialize clock/power states */
/* Query the F2 block size, set roundup accordingly */
fnum = 2;
- if (brcmf_sdcard_iovar_op(sdh, "sd_blocksize", &fnum, sizeof(s32),
+ if (brcmf_sdcard_iovar_op(card, "sd_blocksize", &fnum, sizeof(s32),
&bus->blocksize, sizeof(s32), false) != 0) {
bus->blocksize = 0;
DHD_ERROR(("%s: fail on %s get\n", __func__, "sd_blocksize"));
/* Query if bus module supports packet chaining,
default to use if supported */
- if (brcmf_sdcard_iovar_op(sdh, "sd_rxchain", NULL, 0,
+ if (brcmf_sdcard_iovar_op(card, "sd_rxchain", NULL, 0,
&bus->sd_rxchain, sizeof(s32),
false) != 0) {
bus->sd_rxchain = false;
}
static bool
-brcmf_sdbrcm_download_firmware(struct dhd_bus *bus, void *sdh)
+brcmf_sdbrcm_download_firmware(struct dhd_bus *bus, void *card)
{
bool ret;
if (bus) {
/* De-register interrupt handler */
- brcmf_sdcard_intr_disable(bus->sdh);
- brcmf_sdcard_intr_dereg(bus->sdh);
+ brcmf_sdcard_intr_disable(bus->card);
+ brcmf_sdcard_intr_dereg(bus->card);
if (bus->dhd) {
brcmf_detach(bus->dhd);
brcmf_sdio_cmplt_fn_t complete, void *handle)
{
return brcmf_sdcard_send_buf
- (bus->sdh, addr, fn, flags, buf, nbytes, pkt, complete,
+ (bus->card, addr, fn, flags, buf, nbytes, pkt, complete,
handle);
}
if (bus->dhd->dongle_reset) {
/* Turn on WLAN */
/* Reset SD client */
- brcmf_sdcard_reset(bus->sdh);
+ brcmf_sdcard_reset(bus->card);
/* Attempt to re-attach & download */
- if (brcmf_sdbrcm_probe_attach(bus, bus->sdh,
+ if (brcmf_sdbrcm_probe_attach(bus, bus->card,
(u32 *) SI_ENUM_BASE,
bus->cl_devid)) {
/* Attempt to download binary to the dongle */
- if (brcmf_sdbrcm_probe_init(bus, bus->sdh)) {
+ if (brcmf_sdbrcm_probe_init(bus, bus->card)) {
/* Re-init bus, enable F2 transfer */
brcmf_sdbrcm_bus_init(
(struct brcmf_pub *) bus->dhd,
}
static int
-brcmf_sdbrcm_chip_recognition(struct brcmf_sdio *sdh, struct chip_info *ci,
- void *regs)
+brcmf_sdbrcm_chip_recognition(struct brcmf_sdio_card *card,
+ struct chip_info *ci, void *regs)
{
u32 regdata;
* other ways of recognition should be added here.
*/
ci->cccorebase = (u32)regs;
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_CC_REG(ci->cccorebase, chipid), 4);
ci->chip = regdata & CID_ID_MASK;
ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT;
return -ENODEV;
}
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(ci->cccorebase, sbidhigh), 4);
ci->ccrev = SBCOREREV(regdata);
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_CC_REG(ci->cccorebase, pmucapabilities), 4);
ci->pmurev = regdata & PCAP_REV_MASK;
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(ci->buscorebase, sbidhigh), 4);
ci->buscorerev = SBCOREREV(regdata);
ci->buscoretype = (regdata & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
ci->buscorerev, ci->buscoretype));
/* get chipcommon capabilites */
- ci->cccaps = brcmf_sdcard_reg_read(sdh,
+ ci->cccaps = brcmf_sdcard_reg_read(card,
CORE_CC_REG(ci->cccorebase, capabilities), 4);
return 0;
}
static void
-brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio *sdh, u32 corebase)
+brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase)
{
u32 regdata;
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatelow), 4);
if (regdata & SBTML_RESET)
return;
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatelow), 4);
if ((regdata & (SICF_CLOCK_EN << SBTML_SICF_SHIFT)) != 0) {
/*
* set target reject and spin until busy is clear
* (preserve core-specific bits)
*/
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatelow), 4);
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbtmstatelow), 4,
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4,
regdata | SBTML_REJ);
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatelow), 4);
udelay(1);
- SPINWAIT((brcmf_sdcard_reg_read(sdh,
+ SPINWAIT((brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatehigh), 4) &
SBTMH_BUSY), 100000);
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatehigh), 4);
if (regdata & SBTMH_BUSY)
DHD_ERROR(("%s: ARM core still busy\n", __func__));
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbidlow), 4);
if (regdata & SBIDL_INIT) {
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbimstate), 4) |
SBIM_RJ;
- brcmf_sdcard_reg_write(sdh,
+ brcmf_sdcard_reg_write(card,
CORE_SB(corebase, sbimstate), 4,
regdata);
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbimstate), 4);
udelay(1);
- SPINWAIT((brcmf_sdcard_reg_read(sdh,
+ SPINWAIT((brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbimstate), 4) &
SBIM_BY), 100000);
}
/* set reset and reject while enabling the clocks */
- brcmf_sdcard_reg_write(sdh,
+ brcmf_sdcard_reg_write(card,
CORE_SB(corebase, sbtmstatelow), 4,
(((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) |
SBTML_REJ | SBTML_RESET));
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbtmstatelow), 4);
udelay(10);
/* clear the initiator reject bit */
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbidlow), 4);
if (regdata & SBIDL_INIT) {
- regdata = brcmf_sdcard_reg_read(sdh,
+ regdata = brcmf_sdcard_reg_read(card,
CORE_SB(corebase, sbimstate), 4) &
~SBIM_RJ;
- brcmf_sdcard_reg_write(sdh,
+ brcmf_sdcard_reg_write(card,
CORE_SB(corebase, sbimstate), 4,
regdata);
}
}
/* leave reset and reject asserted */
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbtmstatelow), 4,
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4,
(SBTML_REJ | SBTML_RESET));
udelay(1);
}
/* bus/core/clk setup for register access */
/* Try forcing SDIO core to do ALPAvail request only */
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
clkset, &err);
if (err) {
DHD_ERROR(("%s: error writing for HT off\n", __func__));
/* If register supported, wait for ALPAvail and then force ALP */
/* This may take up to 15 milliseconds */
- clkval = brcmf_sdcard_cfg_read(bus->sdh, SDIO_FUNC_1,
+ clkval = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, NULL);
if ((clkval & ~SBSDIO_AVBITS) == clkset) {
SPINWAIT(((clkval =
- brcmf_sdcard_cfg_read(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR,
NULL)),
!SBSDIO_ALPAV(clkval)),
}
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF |
SBSDIO_FORCE_ALP;
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR,
clkset, &err);
udelay(65);
}
/* Also, disable the extra SDIO pull-ups */
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SDIOPULLUP,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_SDIOPULLUP,
0, NULL);
- err = brcmf_sdbrcm_chip_recognition(bus->sdh, ci, regs);
+ err = brcmf_sdbrcm_chip_recognition(bus->card, ci, regs);
if (err)
goto fail;
* Make sure any on-chip ARM is off (in case strapping is wrong),
* or downloaded code was already running.
*/
- brcmf_sdbrcm_chip_disablecore(bus->sdh, ci->armcorebase);
+ brcmf_sdbrcm_chip_disablecore(bus->card, ci->armcorebase);
- brcmf_sdcard_reg_write(bus->sdh,
+ brcmf_sdcard_reg_write(bus->card,
CORE_CC_REG(ci->cccorebase, gpiopullup), 4, 0);
- brcmf_sdcard_reg_write(bus->sdh,
+ brcmf_sdcard_reg_write(bus->card,
CORE_CC_REG(ci->cccorebase, gpiopulldown), 4, 0);
/* Disable F2 to clear any intermediate frame state on the dongle */
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_0, SDIO_CCCR_IOEx,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL);
/* WAR: cmd52 backplane read so core HW will drop ALPReq */
- clkval = brcmf_sdcard_cfg_read(bus->sdh, SDIO_FUNC_1,
+ clkval = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
0, NULL);
/* Done with backplane-dependent accesses, can drop clock... */
- brcmf_sdcard_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
0, NULL);
bus->ci = ci;
}
static void
-brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio *sdh, u32 corebase)
+brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase)
{
u32 regdata;
* Must do the disable sequence first to work for
* arbitrary current core state.
*/
- brcmf_sdbrcm_chip_disablecore(sdh, corebase);
+ brcmf_sdbrcm_chip_disablecore(card, corebase);
/*
* Now do the initialization sequence.
* set reset while enabling the clock and
* forcing them on throughout the core
*/
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbtmstatelow), 4,
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4,
((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) |
SBTML_RESET);
udelay(1);
- regdata = brcmf_sdcard_reg_read(sdh, CORE_SB(corebase, sbtmstatehigh),
+ regdata = brcmf_sdcard_reg_read(card, CORE_SB(corebase, sbtmstatehigh),
4);
if (regdata & SBTMH_SERR)
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbtmstatehigh),
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatehigh),
4, 0);
- regdata = brcmf_sdcard_reg_read(sdh, CORE_SB(corebase, sbimstate), 4);
+ regdata = brcmf_sdcard_reg_read(card, CORE_SB(corebase, sbimstate), 4);
if (regdata & (SBIM_IBE | SBIM_TO))
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbimstate), 4,
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbimstate), 4,
regdata & ~(SBIM_IBE | SBIM_TO));
/* clear reset and allow it to propagate throughout the core */
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbtmstatelow), 4,
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4,
(SICF_FGC << SBTML_SICF_SHIFT) |
(SICF_CLOCK_EN << SBTML_SICF_SHIFT));
udelay(1);
/* leave clock enabled */
- brcmf_sdcard_reg_write(sdh, CORE_SB(corebase, sbtmstatelow), 4,
+ brcmf_sdcard_reg_write(card, CORE_SB(corebase, sbtmstatelow), 4,
(SICF_CLOCK_EN << SBTML_SICF_SHIFT));
udelay(1);
}
}
}
- brcmf_sdcard_reg_write(bus->sdh,
+ brcmf_sdcard_reg_write(bus->card,
CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr),
4, 1);
- cc_data_temp = brcmf_sdcard_reg_read(bus->sdh,
+ cc_data_temp = brcmf_sdcard_reg_read(bus->card,
CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr), 4);
cc_data_temp &= ~str_mask;
drivestrength_sel <<= str_shift;
cc_data_temp |= drivestrength_sel;
- brcmf_sdcard_reg_write(bus->sdh,
+ brcmf_sdcard_reg_write(bus->card,
CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr),
4, cc_data_temp);