Commit 712ac5b3 authored by Franky Lin's avatar Franky Lin Committed by John W. Linville

brcm80211: fmac: stop referencing brcmf_pub in bus layer

brcmf_pub is the data structure for common layer. Since brcmf_bus
should be the only structure shared by common layer and bus layer,
stop referencing brcmf_pub from bus layer. This patch is part of
the fullmac bus interface refactoring.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarAlwin Beukers <alwin@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c8bf3484
...@@ -669,8 +669,8 @@ extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen, ...@@ -669,8 +669,8 @@ extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen,
* Returned structure should have bus and prot pointers filled in. * Returned structure should have bus and prot pointers filled in.
* bus_hdrlen specifies required headroom for bus module header. * bus_hdrlen specifies required headroom for bus module header.
*/ */
extern struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, extern int brcmf_attach(struct brcmf_sdio *bus,
uint bus_hdrlen, struct device *dev); uint bus_hdrlen, struct device *dev);
extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
......
...@@ -922,17 +922,18 @@ void brcmf_del_if(struct brcmf_pub *drvr, int ifidx) ...@@ -922,17 +922,18 @@ void brcmf_del_if(struct brcmf_pub *drvr, int ifidx)
} }
} }
struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, int brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen,
struct device *dev) struct device *dev)
{ {
struct brcmf_pub *drvr = NULL; struct brcmf_pub *drvr = NULL;
int ret = 0;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
/* Allocate primary brcmf_info */ /* Allocate primary brcmf_info */
drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC); drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC);
if (!drvr) if (!drvr)
goto fail; return -ENOMEM;
mutex_init(&drvr->proto_block); mutex_init(&drvr->proto_block);
...@@ -944,7 +945,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, ...@@ -944,7 +945,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen,
drvr->dev = dev; drvr->dev = dev;
/* Attach and link in the protocol */ /* Attach and link in the protocol */
if (brcmf_proto_attach(drvr) != 0) { ret = brcmf_proto_attach(drvr);
if (ret != 0) {
brcmf_dbg(ERROR, "brcmf_prot_attach failed\n"); brcmf_dbg(ERROR, "brcmf_prot_attach failed\n");
goto fail; goto fail;
} }
...@@ -952,13 +954,12 @@ struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, ...@@ -952,13 +954,12 @@ struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen,
INIT_WORK(&drvr->setmacaddr_work, _brcmf_set_mac_address); INIT_WORK(&drvr->setmacaddr_work, _brcmf_set_mac_address);
INIT_WORK(&drvr->multicast_work, _brcmf_set_multicast_list); INIT_WORK(&drvr->multicast_work, _brcmf_set_multicast_list);
return drvr; return ret;
fail: fail:
if (drvr) brcmf_detach(dev);
brcmf_detach(dev);
return NULL; return ret;
} }
int brcmf_bus_start(struct device *dev) int brcmf_bus_start(struct device *dev)
......
...@@ -450,8 +450,6 @@ struct sdpcm_shared_le { ...@@ -450,8 +450,6 @@ struct sdpcm_shared_le {
/* misc chip info needed by some of the routines */ /* misc chip info needed by some of the routines */
/* Private data for SDIO bus interaction */ /* Private data for SDIO bus interaction */
struct brcmf_sdio { struct brcmf_sdio {
struct brcmf_pub *drvr;
struct brcmf_sdio_dev *sdiodev; /* sdio device handler */ struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
struct chip_info *ci; /* Chip info struct */ struct chip_info *ci; /* Chip info struct */
char *vars; /* Variables (from CIS and/or other) */ char *vars; /* Variables (from CIS and/or other) */
...@@ -1077,7 +1075,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) ...@@ -1077,7 +1075,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
/* If we can't reach the device, signal failure */ /* If we can't reach the device, signal failure */
if (err || brcmf_sdcard_regfail(bus->sdiodev)) if (err || brcmf_sdcard_regfail(bus->sdiodev))
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
} }
/* copy a buffer into a pkt buffer chain */ /* copy a buffer into a pkt buffer chain */
...@@ -1724,7 +1722,7 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished) ...@@ -1724,7 +1722,7 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
for (rxseq = bus->rx_seq, rxleft = maxframes; for (rxseq = bus->rx_seq, rxleft = maxframes;
!bus->rxskip && rxleft && !bus->rxskip && rxleft &&
bus->drvr->bus_if->state != BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN;
rxseq++, rxleft--) { rxseq++, rxleft--) {
/* Handle glomming separately */ /* Handle glomming separately */
...@@ -2259,8 +2257,6 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2259,8 +2257,6 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
uint datalen; uint datalen;
u8 tx_prec_map; u8 tx_prec_map;
struct brcmf_pub *drvr = bus->drvr;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
tx_prec_map = ~bus->flowcontrol; tx_prec_map = ~bus->flowcontrol;
...@@ -2297,8 +2293,8 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2297,8 +2293,8 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
} }
/* Deflow-control stack if needed */ /* Deflow-control stack if needed */
if (drvr->bus_if->drvr_up && if (bus->sdiodev->bus_if->drvr_up &&
(drvr->bus_if->state == BRCMF_BUS_DATA) && (bus->sdiodev->bus_if->state == BRCMF_BUS_DATA) &&
bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { bus->txoff && (pktq_len(&bus->txq) < TXLOW)) {
bus->txoff = OFF; bus->txoff = OFF;
brcmf_txflowcontrol(bus->sdiodev->dev, 0, OFF); brcmf_txflowcontrol(bus->sdiodev->dev, 0, OFF);
...@@ -2335,7 +2331,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2335,7 +2331,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
SBSDIO_DEVICE_CTL, &err); SBSDIO_DEVICE_CTL, &err);
if (err) { if (err) {
brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err); brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err);
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
} }
#endif /* BCMDBG */ #endif /* BCMDBG */
...@@ -2345,7 +2341,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2345,7 +2341,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
if (err) { if (err) {
brcmf_dbg(ERROR, "error reading CSR: %d\n", brcmf_dbg(ERROR, "error reading CSR: %d\n",
err); err);
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
} }
brcmf_dbg(INFO, "DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", brcmf_dbg(INFO, "DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n",
...@@ -2358,7 +2354,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2358,7 +2354,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
if (err) { if (err) {
brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", brcmf_dbg(ERROR, "error reading DEVCTL: %d\n",
err); err);
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
} }
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
...@@ -2366,7 +2362,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2366,7 +2362,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
if (err) { if (err) {
brcmf_dbg(ERROR, "error writing DEVCTL: %d\n", brcmf_dbg(ERROR, "error writing DEVCTL: %d\n",
err); err);
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
} }
bus->clkstate = CLK_AVAIL; bus->clkstate = CLK_AVAIL;
} else { } else {
...@@ -2522,11 +2518,11 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2522,11 +2518,11 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
else await next interrupt */ else await next interrupt */
/* On failed register access, all bets are off: /* On failed register access, all bets are off:
no resched or interrupts */ no resched or interrupts */
if ((bus->drvr->bus_if->state == BRCMF_BUS_DOWN) || if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) ||
brcmf_sdcard_regfail(bus->sdiodev)) { brcmf_sdcard_regfail(bus->sdiodev)) {
brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation %d\n", brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation %d\n",
brcmf_sdcard_regfail(bus->sdiodev)); brcmf_sdcard_regfail(bus->sdiodev));
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
bus->intstatus = 0; bus->intstatus = 0;
} else if (bus->clkstate == CLK_PENDING) { } else if (bus->clkstate == CLK_PENDING) {
brcmf_dbg(INFO, "rescheduled due to CLK_PENDING awaiting I_CHIPACTIVE interrupt\n"); brcmf_dbg(INFO, "rescheduled due to CLK_PENDING awaiting I_CHIPACTIVE interrupt\n");
...@@ -2563,7 +2559,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data) ...@@ -2563,7 +2559,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data)
if (!wait_for_completion_interruptible(&bus->dpc_wait)) { if (!wait_for_completion_interruptible(&bus->dpc_wait)) {
/* Call bus dpc unless it indicated down /* Call bus dpc unless it indicated down
(then clean stop) */ (then clean stop) */
if (bus->drvr->bus_if->state != BRCMF_BUS_DOWN) { if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) {
if (brcmf_sdbrcm_dpc(bus)) if (brcmf_sdbrcm_dpc(bus))
complete(&bus->dpc_wait); complete(&bus->dpc_wait);
} else { } else {
...@@ -3137,7 +3133,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter) ...@@ -3137,7 +3133,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter)
/* Allow HT Clock now that the ARM is running. */ /* Allow HT Clock now that the ARM is running. */
bus->alp_only = false; bus->alp_only = false;
bus->drvr->bus_if->state = BRCMF_BUS_LOAD; bus->sdiodev->bus_if->state = BRCMF_BUS_LOAD;
} }
fail: fail:
return bcmerror; return bcmerror;
...@@ -3383,7 +3379,7 @@ void brcmf_sdbrcm_bus_stop(struct device *dev) ...@@ -3383,7 +3379,7 @@ void brcmf_sdbrcm_bus_stop(struct device *dev)
bus->hostintmask = 0; bus->hostintmask = 0;
/* Change our idea of bus state */ /* Change our idea of bus state */
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
/* Force clocks on backplane to be sure F2 interrupt propagates */ /* Force clocks on backplane to be sure F2 interrupt propagates */
saveclk = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1, saveclk = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
...@@ -3446,7 +3442,7 @@ int brcmf_sdbrcm_bus_init(struct device *dev) ...@@ -3446,7 +3442,7 @@ int brcmf_sdbrcm_bus_init(struct device *dev)
return -1; return -1;
} }
if (!bus->drvr) if (!bus->sdiodev->bus_if->drvr)
return 0; return 0;
/* Start the watchdog timer */ /* Start the watchdog timer */
...@@ -3542,7 +3538,7 @@ void brcmf_sdbrcm_isr(void *arg) ...@@ -3542,7 +3538,7 @@ void brcmf_sdbrcm_isr(void *arg)
return; return;
} }
if (bus->drvr->bus_if->state == BRCMF_BUS_DOWN) { if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) {
brcmf_dbg(ERROR, "bus is down. we have nothing to do\n"); brcmf_dbg(ERROR, "bus is down. we have nothing to do\n");
return; return;
} }
...@@ -3798,7 +3794,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus) ...@@ -3798,7 +3794,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus)
brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx, brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL); SDIO_FUNC_ENABLE_1, NULL);
bus->drvr->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
bus->sleeping = false; bus->sleeping = false;
bus->rxflow = false; bus->rxflow = false;
...@@ -3884,7 +3880,6 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) ...@@ -3884,7 +3880,6 @@ 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_sdbrcm_release_dongle(bus);
bus->drvr = NULL;
} }
brcmf_sdbrcm_release_malloc(bus); brcmf_sdbrcm_release_malloc(bus);
...@@ -3958,8 +3953,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) ...@@ -3958,8 +3953,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
} }
/* Attach to the brcmf/OS/network interface */ /* Attach to the brcmf/OS/network interface */
bus->drvr = brcmf_attach(bus, SDPCM_RESERVE, bus->sdiodev->dev); ret = brcmf_attach(bus, SDPCM_RESERVE, bus->sdiodev->dev);
if (!bus->drvr) { if (ret != 0) {
brcmf_dbg(ERROR, "brcmf_attach failed\n"); brcmf_dbg(ERROR, "brcmf_attach failed\n");
goto fail; goto fail;
} }
...@@ -4032,7 +4027,7 @@ brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick) ...@@ -4032,7 +4027,7 @@ brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick)
} }
/* don't start the wd until fw is loaded */ /* don't start the wd until fw is loaded */
if (bus->drvr->bus_if->state == BRCMF_BUS_DOWN) if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN)
return; return;
if (wdtick) { if (wdtick) {
......
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