Commit 82d7f3c1 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: use consistent function names in dhd_sdio.c

Functions in dhd_sdio.c that are called with struct brcmf_sdio
instance are renamed consistently with brcmf_sdio_ prefix.
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7b8a466e
...@@ -72,7 +72,7 @@ static irqreturn_t brcmf_sdiod_oob_irqhandler(int irq, void *dev_id) ...@@ -72,7 +72,7 @@ static irqreturn_t brcmf_sdiod_oob_irqhandler(int irq, void *dev_id)
sdiodev->irq_en = false; sdiodev->irq_en = false;
} }
brcmf_sdbrcm_isr(sdiodev->bus); brcmf_sdio_isr(sdiodev->bus);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -84,7 +84,7 @@ static void brcmf_sdiod_ib_irqhandler(struct sdio_func *func) ...@@ -84,7 +84,7 @@ static void brcmf_sdiod_ib_irqhandler(struct sdio_func *func)
brcmf_dbg(INTR, "IB intr triggered\n"); brcmf_dbg(INTR, "IB intr triggered\n");
brcmf_sdbrcm_isr(sdiodev->bus); brcmf_sdio_isr(sdiodev->bus);
} }
/* dummy handler for SDIO function 2 interrupt */ /* dummy handler for SDIO function 2 interrupt */
...@@ -901,7 +901,7 @@ static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev) ...@@ -901,7 +901,7 @@ static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
sdiodev->bus_if->state = BRCMF_BUS_DOWN; sdiodev->bus_if->state = BRCMF_BUS_DOWN;
if (sdiodev->bus) { if (sdiodev->bus) {
brcmf_sdbrcm_disconnect(sdiodev->bus); brcmf_sdio_disconnect(sdiodev->bus);
sdiodev->bus = NULL; sdiodev->bus = NULL;
} }
...@@ -971,7 +971,7 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -971,7 +971,7 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
sdiodev->max_segment_size = host->max_seg_size; sdiodev->max_segment_size = host->max_seg_size;
/* try to attach to the target device */ /* try to attach to the target device */
sdiodev->bus = brcmf_sdbrcm_probe(sdiodev); sdiodev->bus = brcmf_sdio_probe(sdiodev);
if (!sdiodev->bus) { if (!sdiodev->bus) {
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
...@@ -1117,7 +1117,7 @@ static int brcmf_ops_sdio_suspend(struct device *dev) ...@@ -1117,7 +1117,7 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
return ret; return ret;
} }
brcmf_sdbrcm_wd_timer(sdiodev->bus, 0); brcmf_sdio_wd_timer(sdiodev->bus, 0);
return ret; return ret;
} }
...@@ -1127,7 +1127,7 @@ static int brcmf_ops_sdio_resume(struct device *dev) ...@@ -1127,7 +1127,7 @@ static int brcmf_ops_sdio_resume(struct device *dev)
struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
brcmf_sdbrcm_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS); brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
atomic_set(&sdiodev->suspend, false); atomic_set(&sdiodev->suspend, false);
return 0; return 0;
} }
......
...@@ -556,7 +556,7 @@ static const struct brcmf_firmware_names brcmf_fwname_data[] = { ...@@ -556,7 +556,7 @@ static const struct brcmf_firmware_names brcmf_fwname_data[] = {
}; };
static const struct firmware *brcmf_sdbrcm_get_fw(struct brcmf_sdio *bus, static const struct firmware *brcmf_sdio_get_fw(struct brcmf_sdio *bus,
enum brcmf_firmware_type type) enum brcmf_firmware_type type)
{ {
const struct firmware *fw; const struct firmware *fw;
...@@ -641,7 +641,7 @@ w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset) ...@@ -641,7 +641,7 @@ w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset)
} }
static int static int
brcmf_sdbrcm_kso_control(struct brcmf_sdio *bus, bool on) brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on)
{ {
u8 wr_val = 0, rd_val, cmp_val, bmask; u8 wr_val = 0, rd_val, cmp_val, bmask;
int err = 0; int err = 0;
...@@ -701,7 +701,7 @@ brcmf_sdbrcm_kso_control(struct brcmf_sdio *bus, bool on) ...@@ -701,7 +701,7 @@ brcmf_sdbrcm_kso_control(struct brcmf_sdio *bus, bool on)
#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE) #define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE)
/* Turn backplane clock on or off */ /* Turn backplane clock on or off */
static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) static int brcmf_sdio_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
{ {
int err; int err;
u8 clkctl, clkreq, devctl; u8 clkctl, clkreq, devctl;
...@@ -823,7 +823,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) ...@@ -823,7 +823,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
} }
/* Change idle/active SD state */ /* Change idle/active SD state */
static int brcmf_sdbrcm_sdclk(struct brcmf_sdio *bus, bool on) static int brcmf_sdio_sdclk(struct brcmf_sdio *bus, bool on)
{ {
brcmf_dbg(SDIO, "Enter\n"); brcmf_dbg(SDIO, "Enter\n");
...@@ -836,7 +836,7 @@ static int brcmf_sdbrcm_sdclk(struct brcmf_sdio *bus, bool on) ...@@ -836,7 +836,7 @@ static int brcmf_sdbrcm_sdclk(struct brcmf_sdio *bus, bool on)
} }
/* Transition SD and backplane clock readiness */ /* Transition SD and backplane clock readiness */
static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) static int brcmf_sdio_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
{ {
#ifdef DEBUG #ifdef DEBUG
uint oldstate = bus->clkstate; uint oldstate = bus->clkstate;
...@@ -847,7 +847,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) ...@@ -847,7 +847,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
/* Early exit if we're already there */ /* Early exit if we're already there */
if (bus->clkstate == target) { if (bus->clkstate == target) {
if (target == CLK_AVAIL) { if (target == CLK_AVAIL) {
brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
bus->activity = true; bus->activity = true;
} }
return 0; return 0;
...@@ -857,32 +857,32 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) ...@@ -857,32 +857,32 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
case CLK_AVAIL: case CLK_AVAIL:
/* Make sure SD clock is available */ /* Make sure SD clock is available */
if (bus->clkstate == CLK_NONE) if (bus->clkstate == CLK_NONE)
brcmf_sdbrcm_sdclk(bus, true); brcmf_sdio_sdclk(bus, true);
/* Now request HT Avail on the backplane */ /* Now request HT Avail on the backplane */
brcmf_sdbrcm_htclk(bus, true, pendok); brcmf_sdio_htclk(bus, true, pendok);
brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
bus->activity = true; bus->activity = true;
break; break;
case CLK_SDONLY: case CLK_SDONLY:
/* Remove HT request, or bring up SD clock */ /* Remove HT request, or bring up SD clock */
if (bus->clkstate == CLK_NONE) if (bus->clkstate == CLK_NONE)
brcmf_sdbrcm_sdclk(bus, true); brcmf_sdio_sdclk(bus, true);
else if (bus->clkstate == CLK_AVAIL) else if (bus->clkstate == CLK_AVAIL)
brcmf_sdbrcm_htclk(bus, false, false); brcmf_sdio_htclk(bus, false, false);
else else
brcmf_err("request for %d -> %d\n", brcmf_err("request for %d -> %d\n",
bus->clkstate, target); bus->clkstate, target);
brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
break; break;
case CLK_NONE: case CLK_NONE:
/* Make sure to remove HT request */ /* Make sure to remove HT request */
if (bus->clkstate == CLK_AVAIL) if (bus->clkstate == CLK_AVAIL)
brcmf_sdbrcm_htclk(bus, false, false); brcmf_sdio_htclk(bus, false, false);
/* Now remove the SD clock */ /* Now remove the SD clock */
brcmf_sdbrcm_sdclk(bus, false); brcmf_sdio_sdclk(bus, false);
brcmf_sdbrcm_wd_timer(bus, 0); brcmf_sdio_wd_timer(bus, 0);
break; break;
} }
#ifdef DEBUG #ifdef DEBUG
...@@ -893,7 +893,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) ...@@ -893,7 +893,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
} }
static int static int
brcmf_sdbrcm_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok) brcmf_sdio_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok)
{ {
int err = 0; int err = 0;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -916,13 +916,13 @@ brcmf_sdbrcm_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok) ...@@ -916,13 +916,13 @@ brcmf_sdbrcm_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok)
brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
data_ok(bus))) data_ok(bus)))
return -EBUSY; return -EBUSY;
err = brcmf_sdbrcm_kso_control(bus, false); err = brcmf_sdio_kso_control(bus, false);
/* disable watchdog */ /* disable watchdog */
if (!err) if (!err)
brcmf_sdbrcm_wd_timer(bus, 0); brcmf_sdio_wd_timer(bus, 0);
} else { } else {
bus->idlecount = 0; bus->idlecount = 0;
err = brcmf_sdbrcm_kso_control(bus, true); err = brcmf_sdio_kso_control(bus, true);
} }
if (!err) { if (!err) {
/* Change state */ /* Change state */
...@@ -940,16 +940,16 @@ brcmf_sdbrcm_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok) ...@@ -940,16 +940,16 @@ brcmf_sdbrcm_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok)
/* control clocks */ /* control clocks */
if (sleep) { if (sleep) {
if (!bus->sr_enabled) if (!bus->sr_enabled)
brcmf_sdbrcm_clkctl(bus, CLK_NONE, pendok); brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
} else { } else {
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, pendok); brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
} }
return err; return err;
} }
static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus) static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus)
{ {
u32 intstatus = 0; u32 intstatus = 0;
u32 hmb_data; u32 hmb_data;
...@@ -1025,7 +1025,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus) ...@@ -1025,7 +1025,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus)
return intstatus; return intstatus;
} }
static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) static void brcmf_sdio_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
{ {
uint retries = 0; uint retries = 0;
u16 lastrbc; u16 lastrbc;
...@@ -1085,7 +1085,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) ...@@ -1085,7 +1085,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
} }
/* return total length of buffer chain */ /* return total length of buffer chain */
static uint brcmf_sdbrcm_glom_len(struct brcmf_sdio *bus) static uint brcmf_sdio_glom_len(struct brcmf_sdio *bus)
{ {
struct sk_buff *p; struct sk_buff *p;
uint total; uint total;
...@@ -1096,7 +1096,7 @@ static uint brcmf_sdbrcm_glom_len(struct brcmf_sdio *bus) ...@@ -1096,7 +1096,7 @@ static uint brcmf_sdbrcm_glom_len(struct brcmf_sdio *bus)
return total; return total;
} }
static void brcmf_sdbrcm_free_glom(struct brcmf_sdio *bus) static void brcmf_sdio_free_glom(struct brcmf_sdio *bus)
{ {
struct sk_buff *cur, *next; struct sk_buff *cur, *next;
...@@ -1184,7 +1184,7 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header, ...@@ -1184,7 +1184,7 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
if ((u16)(~(len ^ checksum))) { if ((u16)(~(len ^ checksum))) {
brcmf_err("HW header checksum error\n"); brcmf_err("HW header checksum error\n");
bus->sdcnt.rx_badhdr++; bus->sdcnt.rx_badhdr++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdio_rxfail(bus, false, false);
return -EIO; return -EIO;
} }
if (len < SDPCM_HDRLEN) { if (len < SDPCM_HDRLEN) {
...@@ -1216,7 +1216,7 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header, ...@@ -1216,7 +1216,7 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
type != BRCMF_SDIO_FT_SUPER) { type != BRCMF_SDIO_FT_SUPER) {
brcmf_err("HW header length too long\n"); brcmf_err("HW header length too long\n");
bus->sdcnt.rx_toolong++; bus->sdcnt.rx_toolong++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdio_rxfail(bus, false, false);
rd->len = 0; rd->len = 0;
return -EPROTO; return -EPROTO;
} }
...@@ -1235,7 +1235,7 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header, ...@@ -1235,7 +1235,7 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) {
brcmf_err("seq %d: bad data offset\n", rx_seq); brcmf_err("seq %d: bad data offset\n", rx_seq);
bus->sdcnt.rx_badhdr++; bus->sdcnt.rx_badhdr++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdio_rxfail(bus, false, false);
rd->len = 0; rd->len = 0;
return -ENXIO; return -ENXIO;
} }
...@@ -1308,7 +1308,7 @@ static void brcmf_sdio_hdpack(struct brcmf_sdio *bus, u8 *header, ...@@ -1308,7 +1308,7 @@ static void brcmf_sdio_hdpack(struct brcmf_sdio *bus, u8 *header,
trace_brcmf_sdpcm_hdr(SDPCM_TX + !!(bus->txglom), header); trace_brcmf_sdpcm_hdr(SDPCM_TX + !!(bus->txglom), header);
} }
static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) static u8 brcmf_sdio_rxglom(struct brcmf_sdio *bus, u8 rxseq)
{ {
u16 dlen, totlen; u16 dlen, totlen;
u8 *dptr, num = 0; u8 *dptr, num = 0;
...@@ -1388,7 +1388,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1388,7 +1388,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
} }
pfirst = pnext = NULL; pfirst = pnext = NULL;
} else { } else {
brcmf_sdbrcm_free_glom(bus); brcmf_sdio_free_glom(bus);
num = 0; num = 0;
} }
...@@ -1411,7 +1411,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1411,7 +1411,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
} }
pfirst = skb_peek(&bus->glom); pfirst = skb_peek(&bus->glom);
dlen = (u16) brcmf_sdbrcm_glom_len(bus); dlen = (u16) brcmf_sdio_glom_len(bus);
/* Do an SDIO read for the superframe. Configurable iovar to /* Do an SDIO read for the superframe. Configurable iovar to
* read directly into the chained packet, or allocate a large * read directly into the chained packet, or allocate a large
...@@ -1430,12 +1430,12 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1430,12 +1430,12 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
if (bus->glomerr++ < 3) { if (bus->glomerr++ < 3) {
brcmf_sdbrcm_rxfail(bus, true, true); brcmf_sdio_rxfail(bus, true, true);
} else { } else {
bus->glomerr = 0; bus->glomerr = 0;
brcmf_sdbrcm_rxfail(bus, true, false); brcmf_sdio_rxfail(bus, true, false);
bus->sdcnt.rxglomfail++; bus->sdcnt.rxglomfail++;
brcmf_sdbrcm_free_glom(bus); brcmf_sdio_free_glom(bus);
} }
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
return 0; return 0;
...@@ -1483,12 +1483,12 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1483,12 +1483,12 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
if (bus->glomerr++ < 3) { if (bus->glomerr++ < 3) {
/* Restore superframe header space */ /* Restore superframe header space */
skb_push(pfirst, sfdoff); skb_push(pfirst, sfdoff);
brcmf_sdbrcm_rxfail(bus, true, true); brcmf_sdio_rxfail(bus, true, true);
} else { } else {
bus->glomerr = 0; bus->glomerr = 0;
brcmf_sdbrcm_rxfail(bus, true, false); brcmf_sdio_rxfail(bus, true, false);
bus->sdcnt.rxglomfail++; bus->sdcnt.rxglomfail++;
brcmf_sdbrcm_free_glom(bus); brcmf_sdio_free_glom(bus);
} }
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
bus->cur_read.len = 0; bus->cur_read.len = 0;
...@@ -1532,7 +1532,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1532,7 +1532,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
return num; return num;
} }
static int brcmf_sdbrcm_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition, static int brcmf_sdio_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition,
bool *pending) bool *pending)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -1554,7 +1554,7 @@ static int brcmf_sdbrcm_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition, ...@@ -1554,7 +1554,7 @@ static int brcmf_sdbrcm_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition,
return timeout; return timeout;
} }
static int brcmf_sdbrcm_dcmd_resp_wake(struct brcmf_sdio *bus) static int brcmf_sdio_dcmd_resp_wake(struct brcmf_sdio *bus)
{ {
if (waitqueue_active(&bus->dcmd_resp_wait)) if (waitqueue_active(&bus->dcmd_resp_wait))
wake_up_interruptible(&bus->dcmd_resp_wait); wake_up_interruptible(&bus->dcmd_resp_wait);
...@@ -1562,7 +1562,7 @@ static int brcmf_sdbrcm_dcmd_resp_wake(struct brcmf_sdio *bus) ...@@ -1562,7 +1562,7 @@ static int brcmf_sdbrcm_dcmd_resp_wake(struct brcmf_sdio *bus)
return 0; return 0;
} }
static void static void
brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) brcmf_sdio_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
{ {
uint rdlen, pad; uint rdlen, pad;
u8 *buf = NULL, *rbuf; u8 *buf = NULL, *rbuf;
...@@ -1600,7 +1600,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) ...@@ -1600,7 +1600,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) { if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) {
brcmf_err("%d-byte control read exceeds %d-byte buffer\n", brcmf_err("%d-byte control read exceeds %d-byte buffer\n",
rdlen, bus->sdiodev->bus_if->maxctl); rdlen, bus->sdiodev->bus_if->maxctl);
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdio_rxfail(bus, false, false);
goto done; goto done;
} }
...@@ -1608,7 +1608,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) ...@@ -1608,7 +1608,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
brcmf_err("%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n", brcmf_err("%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n",
len, len - doff, bus->sdiodev->bus_if->maxctl); len, len - doff, bus->sdiodev->bus_if->maxctl);
bus->sdcnt.rx_toolong++; bus->sdcnt.rx_toolong++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdio_rxfail(bus, false, false);
goto done; goto done;
} }
...@@ -1621,7 +1621,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) ...@@ -1621,7 +1621,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
brcmf_err("read %d control bytes failed: %d\n", brcmf_err("read %d control bytes failed: %d\n",
rdlen, sdret); rdlen, sdret);
bus->sdcnt.rxc_errors++; bus->sdcnt.rxc_errors++;
brcmf_sdbrcm_rxfail(bus, true, true); brcmf_sdio_rxfail(bus, true, true);
goto done; goto done;
} else } else
memcpy(buf + BRCMF_FIRSTREAD, rbuf, rdlen); memcpy(buf + BRCMF_FIRSTREAD, rbuf, rdlen);
...@@ -1646,11 +1646,11 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) ...@@ -1646,11 +1646,11 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
done: done:
/* Awake any waiters */ /* Awake any waiters */
brcmf_sdbrcm_dcmd_resp_wake(bus); brcmf_sdio_dcmd_resp_wake(bus);
} }
/* Pad read to blocksize for efficiency */ /* Pad read to blocksize for efficiency */
static void brcmf_pad(struct brcmf_sdio *bus, u16 *pad, u16 *rdlen) static void brcmf_sdio_pad(struct brcmf_sdio *bus, u16 *pad, u16 *rdlen)
{ {
if (bus->roundup && bus->blocksize && *rdlen > bus->blocksize) { if (bus->roundup && bus->blocksize && *rdlen > bus->blocksize) {
*pad = bus->blocksize - (*rdlen % bus->blocksize); *pad = bus->blocksize - (*rdlen % bus->blocksize);
...@@ -1687,7 +1687,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1687,7 +1687,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
u8 cnt; u8 cnt;
brcmf_dbg(GLOM, "calling rxglom: glomd %p, glom %p\n", brcmf_dbg(GLOM, "calling rxglom: glomd %p, glom %p\n",
bus->glomd, skb_peek(&bus->glom)); bus->glomd, skb_peek(&bus->glom));
cnt = brcmf_sdbrcm_rxglom(bus, rd->seq_num); cnt = brcmf_sdio_rxglom(bus, rd->seq_num);
brcmf_dbg(GLOM, "rxglom returned %d\n", cnt); brcmf_dbg(GLOM, "rxglom returned %d\n", cnt);
rd->seq_num += cnt - 1; rd->seq_num += cnt - 1;
rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1; rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1;
...@@ -1705,7 +1705,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1705,7 +1705,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
brcmf_err("RXHEADER FAILED: %d\n", brcmf_err("RXHEADER FAILED: %d\n",
ret); ret);
bus->sdcnt.rx_hdrfail++; bus->sdcnt.rx_hdrfail++;
brcmf_sdbrcm_rxfail(bus, true, true); brcmf_sdio_rxfail(bus, true, true);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
continue; continue;
} }
...@@ -1724,7 +1724,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1724,7 +1724,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
} }
if (rd->channel == SDPCM_CONTROL_CHANNEL) { if (rd->channel == SDPCM_CONTROL_CHANNEL) {
brcmf_sdbrcm_read_control(bus, bus->rxhdr, brcmf_sdio_read_control(bus, bus->rxhdr,
rd->len, rd->len,
rd->dat_offset); rd->dat_offset);
/* prepare the descriptor for the next read */ /* prepare the descriptor for the next read */
...@@ -1740,14 +1740,14 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1740,14 +1740,14 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
head_read = BRCMF_FIRSTREAD; head_read = BRCMF_FIRSTREAD;
} }
brcmf_pad(bus, &pad, &rd->len_left); brcmf_sdio_pad(bus, &pad, &rd->len_left);
pkt = brcmu_pkt_buf_get_skb(rd->len_left + head_read + pkt = brcmu_pkt_buf_get_skb(rd->len_left + head_read +
bus->head_align); bus->head_align);
if (!pkt) { if (!pkt) {
/* Give up on data, request rtx of events */ /* Give up on data, request rtx of events */
brcmf_err("brcmu_pkt_buf_get_skb failed\n"); brcmf_err("brcmu_pkt_buf_get_skb failed\n");
brcmf_sdbrcm_rxfail(bus, false, brcmf_sdio_rxfail(bus, false,
RETRYCHAN(rd->channel)); RETRYCHAN(rd->channel));
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
continue; continue;
...@@ -1764,7 +1764,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1764,7 +1764,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
rd->len, rd->channel, ret); rd->len, rd->channel, ret);
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_rxfail(bus, true, brcmf_sdio_rxfail(bus, true,
RETRYCHAN(rd->channel)); RETRYCHAN(rd->channel));
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
continue; continue;
...@@ -1789,7 +1789,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1789,7 +1789,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
rd->len, rd->len,
roundup(rd_new.len, 16) >> 4); roundup(rd_new.len, 16) >> 4);
rd->len = 0; rd->len = 0;
brcmf_sdbrcm_rxfail(bus, true, true); brcmf_sdio_rxfail(bus, true, true);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
continue; continue;
...@@ -1811,7 +1811,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1811,7 +1811,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
/* Force retry w/normal header read */ /* Force retry w/normal header read */
rd->len = 0; rd->len = 0;
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_rxfail(bus, false, true); brcmf_sdio_rxfail(bus, false, true);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
continue; continue;
...@@ -1836,7 +1836,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1836,7 +1836,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
brcmf_err("%s: glom superframe w/o " brcmf_err("%s: glom superframe w/o "
"descriptor!\n", __func__); "descriptor!\n", __func__);
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdio_rxfail(bus, false, false);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
} }
/* prepare the descriptor for the next read */ /* prepare the descriptor for the next read */
...@@ -1880,7 +1880,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1880,7 +1880,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
} }
static void static void
brcmf_sdbrcm_wait_event_wakeup(struct brcmf_sdio *bus) brcmf_sdio_wait_event_wakeup(struct brcmf_sdio *bus)
{ {
if (waitqueue_active(&bus->ctrl_wait)) if (waitqueue_active(&bus->ctrl_wait))
wake_up_interruptible(&bus->ctrl_wait); wake_up_interruptible(&bus->ctrl_wait);
...@@ -2096,7 +2096,7 @@ brcmf_sdio_txpkt_postp(struct brcmf_sdio *bus, struct sk_buff_head *pktq) ...@@ -2096,7 +2096,7 @@ brcmf_sdio_txpkt_postp(struct brcmf_sdio *bus, struct sk_buff_head *pktq)
/* Writes a HW/SW header into the packet and sends it. */ /* Writes a HW/SW header into the packet and sends it. */
/* Assumes: (a) header space already there, (b) caller holds lock */ /* Assumes: (a) header space already there, (b) caller holds lock */
static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq, static int brcmf_sdio_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
uint chan) uint chan)
{ {
int ret; int ret;
...@@ -2148,7 +2148,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq, ...@@ -2148,7 +2148,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
return ret; return ret;
} }
static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) static uint brcmf_sdio_sendfromq(struct brcmf_sdio *bus, uint maxframes)
{ {
struct sk_buff *pkt; struct sk_buff *pkt;
struct sk_buff_head pktq; struct sk_buff_head pktq;
...@@ -2182,7 +2182,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2182,7 +2182,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
if (i == 0) if (i == 0)
break; break;
ret = brcmf_sdbrcm_txpkt(bus, &pktq, SDPCM_DATA_CHANNEL); ret = brcmf_sdio_txpkt(bus, &pktq, SDPCM_DATA_CHANNEL);
cnt += i; cnt += i;
/* In poll mode, need to check for other events */ /* In poll mode, need to check for other events */
...@@ -2211,7 +2211,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2211,7 +2211,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
return cnt; return cnt;
} }
static void brcmf_sdbrcm_bus_stop(struct device *dev) static void brcmf_sdio_bus_stop(struct device *dev)
{ {
u32 local_hostintmask; u32 local_hostintmask;
u8 saveclk; u8 saveclk;
...@@ -2231,7 +2231,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev) ...@@ -2231,7 +2231,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
/* Enable clock for device interrupts */ /* Enable clock for device interrupts */
brcmf_sdbrcm_bus_sleep(bus, false, false); brcmf_sdio_bus_sleep(bus, false, false);
/* Disable and clear interrupts at the chip level also */ /* Disable and clear interrupts at the chip level also */
w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask)); w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask));
...@@ -2260,7 +2260,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev) ...@@ -2260,7 +2260,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs, intstatus));
/* Turn off the backplane clock (only) */ /* Turn off the backplane clock (only) */
brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); brcmf_sdio_clkctl(bus, CLK_SDONLY, false);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
/* Clear the data packet queues */ /* Clear the data packet queues */
...@@ -2269,20 +2269,20 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev) ...@@ -2269,20 +2269,20 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
/* Clear any held glomming stuff */ /* Clear any held glomming stuff */
if (bus->glomd) if (bus->glomd)
brcmu_pkt_buf_free_skb(bus->glomd); brcmu_pkt_buf_free_skb(bus->glomd);
brcmf_sdbrcm_free_glom(bus); brcmf_sdio_free_glom(bus);
/* Clear rx control and wake any waiters */ /* Clear rx control and wake any waiters */
spin_lock_bh(&bus->rxctl_lock); spin_lock_bh(&bus->rxctl_lock);
bus->rxlen = 0; bus->rxlen = 0;
spin_unlock_bh(&bus->rxctl_lock); spin_unlock_bh(&bus->rxctl_lock);
brcmf_sdbrcm_dcmd_resp_wake(bus); brcmf_sdio_dcmd_resp_wake(bus);
/* Reset some F2 state stuff */ /* Reset some F2 state stuff */
bus->rxskip = false; bus->rxskip = false;
bus->tx_seq = bus->rx_seq = 0; bus->tx_seq = bus->rx_seq = 0;
} }
static inline void brcmf_sdbrcm_clrintr(struct brcmf_sdio *bus) static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
{ {
unsigned long flags; unsigned long flags;
...@@ -2331,7 +2331,7 @@ static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus) ...@@ -2331,7 +2331,7 @@ static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
return ret; return ret;
} }
static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) static void brcmf_sdio_dpc(struct brcmf_sdio *bus)
{ {
u32 newstatus = 0; u32 newstatus = 0;
unsigned long intstatus; unsigned long intstatus;
...@@ -2391,7 +2391,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2391,7 +2391,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
} }
/* Make sure backplane clock is on */ /* Make sure backplane clock is on */
brcmf_sdbrcm_bus_sleep(bus, false, true); brcmf_sdio_bus_sleep(bus, false, true);
/* Pending interrupt indicates new device status */ /* Pending interrupt indicates new device status */
if (atomic_read(&bus->ipend) > 0) { if (atomic_read(&bus->ipend) > 0) {
...@@ -2422,7 +2422,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2422,7 +2422,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
/* Handle host mailbox indication */ /* Handle host mailbox indication */
if (intstatus & I_HMB_HOST_INT) { if (intstatus & I_HMB_HOST_INT) {
intstatus &= ~I_HMB_HOST_INT; intstatus &= ~I_HMB_HOST_INT;
intstatus |= brcmf_sdbrcm_hostmail(bus); intstatus |= brcmf_sdio_hostmail(bus);
} }
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
...@@ -2467,7 +2467,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2467,7 +2467,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
set_bit(n, (unsigned long *)&bus->intstatus.counter); set_bit(n, (unsigned long *)&bus->intstatus.counter);
} }
brcmf_sdbrcm_clrintr(bus); brcmf_sdio_clrintr(bus);
if (data_ok(bus) && bus->ctrl_frame_stat && if (data_ok(bus) && bus->ctrl_frame_stat &&
(bus->clkstate == CLK_AVAIL)) { (bus->clkstate == CLK_AVAIL)) {
...@@ -2508,7 +2508,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2508,7 +2508,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
} }
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
bus->ctrl_frame_stat = false; bus->ctrl_frame_stat = false;
brcmf_sdbrcm_wait_event_wakeup(bus); brcmf_sdio_wait_event_wakeup(bus);
} }
/* Send queued frames (limit 1 if rx may still be pending) */ /* Send queued frames (limit 1 if rx may still be pending) */
else if ((bus->clkstate == CLK_AVAIL) && !atomic_read(&bus->fcstate) && else if ((bus->clkstate == CLK_AVAIL) && !atomic_read(&bus->fcstate) &&
...@@ -2516,7 +2516,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2516,7 +2516,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
&& data_ok(bus)) { && data_ok(bus)) {
framecnt = bus->rxpending ? min(txlimit, bus->txminmax) : framecnt = bus->rxpending ? min(txlimit, bus->txminmax) :
txlimit; txlimit;
framecnt = brcmf_sdbrcm_sendfromq(bus, framecnt); framecnt = brcmf_sdio_sendfromq(bus, framecnt);
txlimit -= framecnt; txlimit -= framecnt;
} }
...@@ -2538,12 +2538,12 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2538,12 +2538,12 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
bus->activity = false; bus->activity = false;
brcmf_dbg(SDIO, "idle state\n"); brcmf_dbg(SDIO, "idle state\n");
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_bus_sleep(bus, true, false); brcmf_sdio_bus_sleep(bus, true, false);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
} }
} }
static struct pktq *brcmf_sdbrcm_bus_gettxq(struct device *dev) static struct pktq *brcmf_sdio_bus_gettxq(struct device *dev)
{ {
struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
...@@ -2552,7 +2552,7 @@ static struct pktq *brcmf_sdbrcm_bus_gettxq(struct device *dev) ...@@ -2552,7 +2552,7 @@ static struct pktq *brcmf_sdbrcm_bus_gettxq(struct device *dev)
return &bus->txq; return &bus->txq;
} }
static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt)
{ {
int ret = -EBADE; int ret = -EBADE;
uint datalen, prec; uint datalen, prec;
...@@ -2608,7 +2608,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) ...@@ -2608,7 +2608,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt)
#ifdef DEBUG #ifdef DEBUG
#define CONSOLE_LINE_MAX 192 #define CONSOLE_LINE_MAX 192
static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus) static int brcmf_sdio_readconsole(struct brcmf_sdio *bus)
{ {
struct brcmf_console *c = &bus->console; struct brcmf_console *c = &bus->console;
u8 line[CONSOLE_LINE_MAX], ch; u8 line[CONSOLE_LINE_MAX], ch;
...@@ -2685,7 +2685,7 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus) ...@@ -2685,7 +2685,7 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus)
} }
#endif /* DEBUG */ #endif /* DEBUG */
static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len) static int brcmf_sdio_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
{ {
int i; int i;
int ret; int ret;
...@@ -2724,7 +2724,7 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len) ...@@ -2724,7 +2724,7 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
} }
static int static int
brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) brcmf_sdio_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
{ {
u8 *frame; u8 *frame;
u16 len, pad; u16 len, pad;
...@@ -2768,7 +2768,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) ...@@ -2768,7 +2768,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
/* Make sure backplane clock is on */ /* Make sure backplane clock is on */
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_bus_sleep(bus, false, false); brcmf_sdio_bus_sleep(bus, false, false);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
hd_info.len = (u16)msglen; hd_info.len = (u16)msglen;
...@@ -2812,7 +2812,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) ...@@ -2812,7 +2812,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
do { do {
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
ret = brcmf_tx_frame(bus, frame, len); ret = brcmf_sdio_tx_frame(bus, frame, len);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
} while (ret < 0 && retries++ < TXRETRIES); } while (ret < 0 && retries++ < TXRETRIES);
} }
...@@ -2822,7 +2822,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) ...@@ -2822,7 +2822,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
bus->activity = false; bus->activity = false;
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_dbg(INFO, "idle\n"); brcmf_dbg(INFO, "idle\n");
brcmf_sdbrcm_clkctl(bus, CLK_NONE, true); brcmf_sdio_clkctl(bus, CLK_NONE, true);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
} }
...@@ -2856,7 +2856,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus, ...@@ -2856,7 +2856,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
* address of sdpcm_shared structure * address of sdpcm_shared structure
*/ */
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_bus_sleep(bus, false, false); brcmf_sdio_bus_sleep(bus, false, false);
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4); rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
if (rv < 0) if (rv < 0)
...@@ -3044,7 +3044,7 @@ static int brcmf_sdio_assert_info(struct brcmf_sdio *bus, ...@@ -3044,7 +3044,7 @@ static int brcmf_sdio_assert_info(struct brcmf_sdio *bus,
return simple_read_from_buffer(data, count, &pos, buf, res); return simple_read_from_buffer(data, count, &pos, buf, res);
} }
static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) static int brcmf_sdio_checkdied(struct brcmf_sdio *bus)
{ {
int error; int error;
struct sdpcm_shared sh; struct sdpcm_shared sh;
...@@ -3065,7 +3065,7 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) ...@@ -3065,7 +3065,7 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus)
return 0; return 0;
} }
static int brcmf_sdbrcm_died_dump(struct brcmf_sdio *bus, char __user *data, static int brcmf_sdio_died_dump(struct brcmf_sdio *bus, char __user *data,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int error = 0; int error = 0;
...@@ -3107,7 +3107,7 @@ static ssize_t brcmf_sdio_forensic_read(struct file *f, char __user *data, ...@@ -3107,7 +3107,7 @@ static ssize_t brcmf_sdio_forensic_read(struct file *f, char __user *data,
struct brcmf_sdio *bus = f->private_data; struct brcmf_sdio *bus = f->private_data;
int res; int res;
res = brcmf_sdbrcm_died_dump(bus, data, count, ppos); res = brcmf_sdio_died_dump(bus, data, count, ppos);
if (res > 0) if (res > 0)
*ppos += res; *ppos += res;
return (ssize_t)res; return (ssize_t)res;
...@@ -3132,7 +3132,7 @@ static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) ...@@ -3132,7 +3132,7 @@ static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
brcmf_debugfs_create_sdio_count(drvr, &bus->sdcnt); brcmf_debugfs_create_sdio_count(drvr, &bus->sdcnt);
} }
#else #else
static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) static int brcmf_sdio_checkdied(struct brcmf_sdio *bus)
{ {
return 0; return 0;
} }
...@@ -3143,7 +3143,7 @@ static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) ...@@ -3143,7 +3143,7 @@ static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
#endif /* DEBUG */ #endif /* DEBUG */
static int static int
brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) brcmf_sdio_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
{ {
int timeleft; int timeleft;
uint rxlen = 0; uint rxlen = 0;
...@@ -3156,7 +3156,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) ...@@ -3156,7 +3156,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
/* Wait until control frame is available */ /* Wait until control frame is available */
timeleft = brcmf_sdbrcm_dcmd_resp_wait(bus, &bus->rxlen, &pending); timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
spin_lock_bh(&bus->rxctl_lock); spin_lock_bh(&bus->rxctl_lock);
rxlen = bus->rxlen; rxlen = bus->rxlen;
...@@ -3173,13 +3173,13 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) ...@@ -3173,13 +3173,13 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
rxlen, msglen); rxlen, msglen);
} else if (timeleft == 0) { } else if (timeleft == 0) {
brcmf_err("resumed on timeout\n"); brcmf_err("resumed on timeout\n");
brcmf_sdbrcm_checkdied(bus); brcmf_sdio_checkdied(bus);
} else if (pending) { } else if (pending) {
brcmf_dbg(CTL, "cancelled\n"); brcmf_dbg(CTL, "cancelled\n");
return -ERESTARTSYS; return -ERESTARTSYS;
} else { } else {
brcmf_dbg(CTL, "resumed for unknown reason?\n"); brcmf_dbg(CTL, "resumed for unknown reason?\n");
brcmf_sdbrcm_checkdied(bus); brcmf_sdio_checkdied(bus);
} }
if (rxlen) if (rxlen)
...@@ -3190,7 +3190,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) ...@@ -3190,7 +3190,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
return rxlen ? (int)rxlen : -ETIMEDOUT; return rxlen ? (int)rxlen : -ETIMEDOUT;
} }
static bool brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter) static bool brcmf_sdio_download_state(struct brcmf_sdio *bus, bool enter)
{ {
struct chip_info *ci = bus->ci; struct chip_info *ci = bus->ci;
...@@ -3215,7 +3215,7 @@ static bool brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter) ...@@ -3215,7 +3215,7 @@ static bool brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter)
return true; return true;
} }
static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus) static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus)
{ {
const struct firmware *fw; const struct firmware *fw;
int err; int err;
...@@ -3223,7 +3223,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus) ...@@ -3223,7 +3223,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus)
int address; int address;
int len; int len;
fw = brcmf_sdbrcm_get_fw(bus, BRCMF_FIRMWARE_BIN); fw = brcmf_sdio_get_fw(bus, BRCMF_FIRMWARE_BIN);
if (fw == NULL) if (fw == NULL)
return -ENOENT; return -ENOENT;
...@@ -3263,7 +3263,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus) ...@@ -3263,7 +3263,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus)
* by two NULs. * by two NULs.
*/ */
static int brcmf_process_nvram_vars(struct brcmf_sdio *bus, static int brcmf_sdio_strip_nvram(struct brcmf_sdio *bus,
const struct firmware *nv) const struct firmware *nv)
{ {
char *varbuf; char *varbuf;
...@@ -3328,44 +3328,48 @@ static int brcmf_process_nvram_vars(struct brcmf_sdio *bus, ...@@ -3328,44 +3328,48 @@ static int brcmf_process_nvram_vars(struct brcmf_sdio *bus,
return ret; return ret;
} }
static int brcmf_sdbrcm_download_nvram(struct brcmf_sdio *bus) static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus)
{ {
const struct firmware *nv; const struct firmware *nv;
int ret; int ret;
nv = brcmf_sdbrcm_get_fw(bus, BRCMF_FIRMWARE_NVRAM); nv = brcmf_sdio_get_fw(bus, BRCMF_FIRMWARE_NVRAM);
if (nv == NULL) if (nv == NULL)
return -ENOENT; return -ENOENT;
ret = brcmf_process_nvram_vars(bus, nv); ret = brcmf_sdio_strip_nvram(bus, nv);
release_firmware(nv); release_firmware(nv);
return ret; return ret;
} }
static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus)
{ {
int bcmerror = -1; int bcmerror = -EFAULT;
sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
/* Keep arm in reset */ /* Keep arm in reset */
if (!brcmf_sdbrcm_download_state(bus, true)) { if (!brcmf_sdio_download_state(bus, true)) {
brcmf_err("error placing ARM core in reset\n"); brcmf_err("error placing ARM core in reset\n");
goto err; goto err;
} }
if (brcmf_sdbrcm_download_code_file(bus)) { if (brcmf_sdio_download_code_file(bus)) {
brcmf_err("dongle image file download failed\n"); brcmf_err("dongle image file download failed\n");
goto err; goto err;
} }
if (brcmf_sdbrcm_download_nvram(bus)) { if (brcmf_sdio_download_nvram(bus)) {
brcmf_err("dongle nvram file download failed\n"); brcmf_err("dongle nvram file download failed\n");
goto err; goto err;
} }
/* Take arm out of reset */ /* Take arm out of reset */
if (!brcmf_sdbrcm_download_state(bus, false)) { if (!brcmf_sdio_download_state(bus, false)) {
brcmf_err("error getting out of ARM core reset\n"); brcmf_err("error getting out of ARM core reset\n");
goto err; goto err;
} }
...@@ -3373,10 +3377,12 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) ...@@ -3373,10 +3377,12 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus)
bcmerror = 0; bcmerror = 0;
err: err:
brcmf_sdio_clkctl(bus, CLK_SDONLY, false);
sdio_release_host(bus->sdiodev->func[1]);
return bcmerror; return bcmerror;
} }
static bool brcmf_sdbrcm_sr_capable(struct brcmf_sdio *bus) static bool brcmf_sdio_sr_capable(struct brcmf_sdio *bus)
{ {
u32 addr, reg; u32 addr, reg;
...@@ -3395,7 +3401,7 @@ static bool brcmf_sdbrcm_sr_capable(struct brcmf_sdio *bus) ...@@ -3395,7 +3401,7 @@ static bool brcmf_sdbrcm_sr_capable(struct brcmf_sdio *bus)
return (bool)reg; return (bool)reg;
} }
static void brcmf_sdbrcm_sr_init(struct brcmf_sdio *bus) static void brcmf_sdio_sr_init(struct brcmf_sdio *bus)
{ {
int err = 0; int err = 0;
u8 val; u8 val;
...@@ -3438,7 +3444,7 @@ static void brcmf_sdbrcm_sr_init(struct brcmf_sdio *bus) ...@@ -3438,7 +3444,7 @@ static void brcmf_sdbrcm_sr_init(struct brcmf_sdio *bus)
} }
/* enable KSO bit */ /* enable KSO bit */
static int brcmf_sdbrcm_kso_init(struct brcmf_sdio *bus) static int brcmf_sdio_kso_init(struct brcmf_sdio *bus)
{ {
u8 val; u8 val;
int err = 0; int err = 0;
...@@ -3470,25 +3476,7 @@ static int brcmf_sdbrcm_kso_init(struct brcmf_sdio *bus) ...@@ -3470,25 +3476,7 @@ static int brcmf_sdbrcm_kso_init(struct brcmf_sdio *bus)
} }
static bool static int brcmf_sdio_bus_preinit(struct device *dev)
brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus)
{
bool ret;
sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
ret = _brcmf_sdbrcm_download_firmware(bus) == 0;
brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
sdio_release_host(bus->sdiodev->func[1]);
return ret;
}
static int brcmf_sdbrcm_bus_preinit(struct device *dev)
{ {
struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
...@@ -3547,7 +3535,7 @@ static int brcmf_sdbrcm_bus_preinit(struct device *dev) ...@@ -3547,7 +3535,7 @@ static int brcmf_sdbrcm_bus_preinit(struct device *dev)
return err; return err;
} }
static int brcmf_sdbrcm_bus_init(struct device *dev) static int brcmf_sdio_bus_init(struct device *dev)
{ {
struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
...@@ -3559,8 +3547,9 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) ...@@ -3559,8 +3547,9 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
/* try to download image and nvram to the dongle */ /* try to download image and nvram to the dongle */
if (bus_if->state == BRCMF_BUS_DOWN) { if (bus_if->state == BRCMF_BUS_DOWN) {
if (!(brcmf_sdbrcm_download_firmware(bus))) err = brcmf_sdio_download_firmware(bus);
return -1; if (err)
return err;
} }
if (!bus->sdiodev->bus_if->drvr) if (!bus->sdiodev->bus_if->drvr)
...@@ -3568,12 +3557,12 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) ...@@ -3568,12 +3557,12 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
/* Start the watchdog timer */ /* Start the watchdog timer */
bus->sdcnt.tickcnt = 0; bus->sdcnt.tickcnt = 0;
brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
/* Make sure backplane clock is on, needed to generate F2 interrupt */ /* Make sure backplane clock is on, needed to generate F2 interrupt */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
if (bus->clkstate != CLK_AVAIL) if (bus->clkstate != CLK_AVAIL)
goto exit; goto exit;
...@@ -3611,8 +3600,8 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) ...@@ -3611,8 +3600,8 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
ret = -ENODEV; ret = -ENODEV;
} }
if (brcmf_sdbrcm_sr_capable(bus)) { if (brcmf_sdio_sr_capable(bus)) {
brcmf_sdbrcm_sr_init(bus); brcmf_sdio_sr_init(bus);
} else { } else {
/* Restore previous clock setting */ /* Restore previous clock setting */
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
...@@ -3627,7 +3616,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) ...@@ -3627,7 +3616,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
/* If we didn't come up, turn off backplane clock */ /* If we didn't come up, turn off backplane clock */
if (bus_if->state != BRCMF_BUS_DATA) if (bus_if->state != BRCMF_BUS_DATA)
brcmf_sdbrcm_clkctl(bus, CLK_NONE, false); brcmf_sdio_clkctl(bus, CLK_NONE, false);
exit: exit:
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
...@@ -3635,7 +3624,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev) ...@@ -3635,7 +3624,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
return ret; return ret;
} }
void brcmf_sdbrcm_isr(struct brcmf_sdio *bus) void brcmf_sdio_isr(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -3666,7 +3655,7 @@ void brcmf_sdbrcm_isr(struct brcmf_sdio *bus) ...@@ -3666,7 +3655,7 @@ void brcmf_sdbrcm_isr(struct brcmf_sdio *bus)
queue_work(bus->brcmf_wq, &bus->datawork); queue_work(bus->brcmf_wq, &bus->datawork);
} }
static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
{ {
#ifdef DEBUG #ifdef DEBUG
struct brcmf_bus *bus_if = dev_get_drvdata(bus->sdiodev->dev); struct brcmf_bus *bus_if = dev_get_drvdata(bus->sdiodev->dev);
...@@ -3722,8 +3711,8 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) ...@@ -3722,8 +3711,8 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
bus->console.count -= bus->console_interval; bus->console.count -= bus->console_interval;
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
/* Make sure backplane clock is on */ /* Make sure backplane clock is on */
brcmf_sdbrcm_bus_sleep(bus, false, false); brcmf_sdio_bus_sleep(bus, false, false);
if (brcmf_sdbrcm_readconsole(bus) < 0) if (brcmf_sdio_readconsole(bus) < 0)
/* stop on error */ /* stop on error */
bus->console_interval = 0; bus->console_interval = 0;
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
...@@ -3737,11 +3726,11 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) ...@@ -3737,11 +3726,11 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
bus->idlecount = 0; bus->idlecount = 0;
if (bus->activity) { if (bus->activity) {
bus->activity = false; bus->activity = false;
brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
} else { } else {
brcmf_dbg(SDIO, "idle\n"); brcmf_dbg(SDIO, "idle\n");
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_bus_sleep(bus, true, false); brcmf_sdio_bus_sleep(bus, true, false);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
} }
} }
...@@ -3756,12 +3745,12 @@ static void brcmf_sdio_dataworker(struct work_struct *work) ...@@ -3756,12 +3745,12 @@ static void brcmf_sdio_dataworker(struct work_struct *work)
datawork); datawork);
while (atomic_read(&bus->dpc_tskcnt)) { while (atomic_read(&bus->dpc_tskcnt)) {
brcmf_sdbrcm_dpc(bus); brcmf_sdio_dpc(bus);
atomic_dec(&bus->dpc_tskcnt); atomic_dec(&bus->dpc_tskcnt);
} }
} }
static void brcmf_sdbrcm_release_malloc(struct brcmf_sdio *bus) static void brcmf_sdio_release_malloc(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -3770,7 +3759,7 @@ static void brcmf_sdbrcm_release_malloc(struct brcmf_sdio *bus) ...@@ -3770,7 +3759,7 @@ static void brcmf_sdbrcm_release_malloc(struct brcmf_sdio *bus)
bus->rxlen = 0; bus->rxlen = 0;
} }
static bool brcmf_sdbrcm_probe_malloc(struct brcmf_sdio *bus) static bool brcmf_sdio_probe_malloc(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -3787,7 +3776,7 @@ static bool brcmf_sdbrcm_probe_malloc(struct brcmf_sdio *bus) ...@@ -3787,7 +3776,7 @@ static bool brcmf_sdbrcm_probe_malloc(struct brcmf_sdio *bus)
} }
static bool static bool
brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus) brcmf_sdio_probe_attach(struct brcmf_sdio *bus)
{ {
u8 clkctl = 0; u8 clkctl = 0;
int err = 0; int err = 0;
...@@ -3824,7 +3813,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus) ...@@ -3824,7 +3813,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus)
goto fail; goto fail;
} }
if (brcmf_sdbrcm_kso_init(bus)) { if (brcmf_sdio_kso_init(bus)) {
brcmf_err("error enabling KSO\n"); brcmf_err("error enabling KSO\n");
goto fail; goto fail;
} }
...@@ -3899,7 +3888,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus) ...@@ -3899,7 +3888,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus)
return false; return false;
} }
static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus) static bool brcmf_sdio_probe_init(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -3933,7 +3922,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus) ...@@ -3933,7 +3922,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus)
} }
static int static int
brcmf_sdbrcm_watchdog_thread(void *data) brcmf_sdio_watchdog_thread(void *data)
{ {
struct brcmf_sdio *bus = (struct brcmf_sdio *)data; struct brcmf_sdio *bus = (struct brcmf_sdio *)data;
...@@ -3943,7 +3932,7 @@ brcmf_sdbrcm_watchdog_thread(void *data) ...@@ -3943,7 +3932,7 @@ brcmf_sdbrcm_watchdog_thread(void *data)
if (kthread_should_stop()) if (kthread_should_stop())
break; break;
if (!wait_for_completion_interruptible(&bus->watchdog_wait)) { if (!wait_for_completion_interruptible(&bus->watchdog_wait)) {
brcmf_sdbrcm_bus_watchdog(bus); brcmf_sdio_bus_watchdog(bus);
/* Count the tick for reference */ /* Count the tick for reference */
bus->sdcnt.tickcnt++; bus->sdcnt.tickcnt++;
} else } else
...@@ -3953,7 +3942,7 @@ brcmf_sdbrcm_watchdog_thread(void *data) ...@@ -3953,7 +3942,7 @@ brcmf_sdbrcm_watchdog_thread(void *data)
} }
static void static void
brcmf_sdbrcm_watchdog(unsigned long data) brcmf_sdio_watchdog(unsigned long data)
{ {
struct brcmf_sdio *bus = (struct brcmf_sdio *)data; struct brcmf_sdio *bus = (struct brcmf_sdio *)data;
...@@ -3966,14 +3955,14 @@ brcmf_sdbrcm_watchdog(unsigned long data) ...@@ -3966,14 +3955,14 @@ brcmf_sdbrcm_watchdog(unsigned long data)
} }
} }
static void brcmf_sdbrcm_release_dongle(struct brcmf_sdio *bus) static void brcmf_sdio_release_dongle(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
if (bus->ci) { if (bus->ci) {
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
brcmf_sdbrcm_clkctl(bus, CLK_NONE, false); brcmf_sdio_clkctl(bus, CLK_NONE, false);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
brcmf_sdio_chip_detach(&bus->ci); brcmf_sdio_chip_detach(&bus->ci);
if (bus->vars && bus->varsz) if (bus->vars && bus->varsz)
...@@ -3985,7 +3974,7 @@ static void brcmf_sdbrcm_release_dongle(struct brcmf_sdio *bus) ...@@ -3985,7 +3974,7 @@ static void brcmf_sdbrcm_release_dongle(struct brcmf_sdio *bus)
} }
/* Detach and free everything */ /* Detach and free everything */
static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) static void brcmf_sdio_release(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -3999,11 +3988,11 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) ...@@ -3999,11 +3988,11 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus)
if (bus->sdiodev->bus_if->drvr) { if (bus->sdiodev->bus_if->drvr) {
brcmf_detach(bus->sdiodev->dev); brcmf_detach(bus->sdiodev->dev);
brcmf_sdbrcm_release_dongle(bus); brcmf_sdio_release_dongle(bus);
} }
brcmu_pkt_buf_free_skb(bus->txglom_sgpad); brcmu_pkt_buf_free_skb(bus->txglom_sgpad);
brcmf_sdbrcm_release_malloc(bus); brcmf_sdio_release_malloc(bus);
kfree(bus->hdrbuf); kfree(bus->hdrbuf);
kfree(bus); kfree(bus);
} }
...@@ -4012,16 +4001,16 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) ...@@ -4012,16 +4001,16 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus)
} }
static struct brcmf_bus_ops brcmf_sdio_bus_ops = { static struct brcmf_bus_ops brcmf_sdio_bus_ops = {
.stop = brcmf_sdbrcm_bus_stop, .stop = brcmf_sdio_bus_stop,
.preinit = brcmf_sdbrcm_bus_preinit, .preinit = brcmf_sdio_bus_preinit,
.init = brcmf_sdbrcm_bus_init, .init = brcmf_sdio_bus_init,
.txdata = brcmf_sdbrcm_bus_txdata, .txdata = brcmf_sdio_bus_txdata,
.txctl = brcmf_sdbrcm_bus_txctl, .txctl = brcmf_sdio_bus_txctl,
.rxctl = brcmf_sdbrcm_bus_rxctl, .rxctl = brcmf_sdio_bus_rxctl,
.gettxq = brcmf_sdbrcm_bus_gettxq, .gettxq = brcmf_sdio_bus_gettxq,
}; };
struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev) struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
{ {
int ret; int ret;
struct brcmf_sdio *bus; struct brcmf_sdio *bus;
...@@ -4061,8 +4050,8 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -4061,8 +4050,8 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev)
} }
/* attempt to attach to the dongle */ /* attempt to attach to the dongle */
if (!(brcmf_sdbrcm_probe_attach(bus))) { if (!(brcmf_sdio_probe_attach(bus))) {
brcmf_err("brcmf_sdbrcm_probe_attach failed\n"); brcmf_err("brcmf_sdio_probe_attach failed\n");
goto fail; goto fail;
} }
...@@ -4074,11 +4063,11 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -4074,11 +4063,11 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev)
/* Set up the watchdog timer */ /* Set up the watchdog timer */
init_timer(&bus->timer); init_timer(&bus->timer);
bus->timer.data = (unsigned long)bus; bus->timer.data = (unsigned long)bus;
bus->timer.function = brcmf_sdbrcm_watchdog; bus->timer.function = brcmf_sdio_watchdog;
/* Initialize watchdog thread */ /* Initialize watchdog thread */
init_completion(&bus->watchdog_wait); init_completion(&bus->watchdog_wait);
bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread, bus->watchdog_tsk = kthread_run(brcmf_sdio_watchdog_thread,
bus, "brcmf_watchdog"); bus, "brcmf_watchdog");
if (IS_ERR(bus->watchdog_tsk)) { if (IS_ERR(bus->watchdog_tsk)) {
pr_warn("brcmf_watchdog thread failed to start\n"); pr_warn("brcmf_watchdog thread failed to start\n");
...@@ -4104,13 +4093,13 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -4104,13 +4093,13 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev)
} }
/* Allocate buffers */ /* Allocate buffers */
if (!(brcmf_sdbrcm_probe_malloc(bus))) { if (!(brcmf_sdio_probe_malloc(bus))) {
brcmf_err("brcmf_sdbrcm_probe_malloc failed\n"); brcmf_err("brcmf_sdio_probe_malloc failed\n");
goto fail; goto fail;
} }
if (!(brcmf_sdbrcm_probe_init(bus))) { if (!(brcmf_sdio_probe_init(bus))) {
brcmf_err("brcmf_sdbrcm_probe_init failed\n"); brcmf_err("brcmf_sdio_probe_init failed\n");
goto fail; goto fail;
} }
...@@ -4127,21 +4116,20 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev) ...@@ -4127,21 +4116,20 @@ struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev)
return bus; return bus;
fail: fail:
brcmf_sdbrcm_release(bus); brcmf_sdio_release(bus);
return NULL; return NULL;
} }
void brcmf_sdbrcm_disconnect(struct brcmf_sdio *bus) void brcmf_sdio_disconnect(struct brcmf_sdio *bus)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
brcmf_sdbrcm_release(bus); brcmf_sdio_release(bus);
brcmf_dbg(TRACE, "Disconnected\n"); brcmf_dbg(TRACE, "Disconnected\n");
} }
void void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, uint wdtick)
brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick)
{ {
/* Totally stop the timer */ /* Totally stop the timer */
if (!wdtick && bus->wd_timer_valid) { if (!wdtick && bus->wd_timer_valid) {
......
...@@ -235,9 +235,10 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address, ...@@ -235,9 +235,10 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
/* Issue an abort to the specified function */ /* Issue an abort to the specified function */
int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn); int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev); struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
void brcmf_sdbrcm_disconnect(struct brcmf_sdio *bus); void brcmf_sdio_disconnect(struct brcmf_sdio *bus);
void brcmf_sdbrcm_isr(struct brcmf_sdio *bus); void brcmf_sdio_isr(struct brcmf_sdio *bus);
void brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick);
void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, uint wdtick);
#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