Commit 5c15c23a authored by Franky Lin's avatar Franky Lin Committed by John W. Linville

brcmfmac: remove function brcmf_sdcard_regfail

The new interface brcmf_sdio_regr/w provides result of access
attempts. It is no longer necessary to use dedicated variable
and function to provide enquiry for failure.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 58692750
...@@ -237,8 +237,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, ...@@ -237,8 +237,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
func_num, addr, data, 4); func_num, addr, data, 4);
} while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); } while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
sdiodev->regfail = (ret != 0); if (ret != 0)
if (sdiodev->regfail)
brcmf_dbg(ERROR, "failed with %d\n", ret); brcmf_dbg(ERROR, "failed with %d\n", ret);
return ret; return ret;
...@@ -298,11 +297,6 @@ void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, ...@@ -298,11 +297,6 @@ void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr,
*ret = retval; *ret = retval;
} }
bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev)
{
return sdiodev->regfail;
}
static int brcmf_sdcard_recv_prepare(struct brcmf_sdio_dev *sdiodev, uint fn, static int brcmf_sdcard_recv_prepare(struct brcmf_sdio_dev *sdiodev, uint fn,
uint flags, uint width, u32 *addr) uint flags, uint width, u32 *addr)
{ {
......
...@@ -1026,9 +1026,9 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) ...@@ -1026,9 +1026,9 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
/* Wait until the packet has been flushed (device/FIFO stable) */ /* Wait until the packet has been flushed (device/FIFO stable) */
for (lastrbc = retries = 0xffff; retries > 0; retries--) { for (lastrbc = retries = 0xffff; retries > 0; retries--) {
hi = brcmf_sdio_regrb(bus->sdiodev, hi = brcmf_sdio_regrb(bus->sdiodev,
SBSDIO_FUNC1_RFRAMEBCHI, NULL); SBSDIO_FUNC1_RFRAMEBCHI, &err);
lo = brcmf_sdio_regrb(bus->sdiodev, lo = brcmf_sdio_regrb(bus->sdiodev,
SBSDIO_FUNC1_RFRAMEBCLO, NULL); SBSDIO_FUNC1_RFRAMEBCLO, &err);
bus->f1regdata += 2; bus->f1regdata += 2;
if ((hi == 0) && (lo == 0)) if ((hi == 0) && (lo == 0))
...@@ -1060,7 +1060,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) ...@@ -1060,7 +1060,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
bus->nextlen = 0; bus->nextlen = 0;
/* If we can't reach the device, signal failure */ /* If we can't reach the device, signal failure */
if (err || brcmf_sdcard_regfail(bus->sdiodev)) if (err)
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
} }
...@@ -2221,10 +2221,11 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2221,10 +2221,11 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
/* In poll mode, need to check for other events */ /* In poll mode, need to check for other events */
if (!bus->intr && cnt) { if (!bus->intr && cnt) {
/* Check device status, signal pending interrupt */ /* Check device status, signal pending interrupt */
r_sdreg32(bus, &intstatus, ret = r_sdreg32(bus, &intstatus,
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs,
intstatus));
bus->f2txdata++; bus->f2txdata++;
if (brcmf_sdcard_regfail(bus->sdiodev)) if (ret != 0)
break; break;
if (intstatus & bus->hostintmask) if (intstatus & bus->hostintmask)
bus->ipend = true; bus->ipend = true;
...@@ -2347,6 +2348,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2347,6 +2348,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
uint framecnt = 0; /* Temporary counter of tx/rx frames */ uint framecnt = 0; /* Temporary counter of tx/rx frames */
bool rxdone = true; /* Flag for no more read data */ bool rxdone = true; /* Flag for no more read data */
bool resched = false; /* Flag indicating resched wanted */ bool resched = false; /* Flag indicating resched wanted */
int err;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -2357,7 +2359,6 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2357,7 +2359,6 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
/* If waiting for HTAVAIL, check status */ /* If waiting for HTAVAIL, check status */
if (bus->clkstate == CLK_PENDING) { if (bus->clkstate == CLK_PENDING) {
int err;
u8 clkctl, devctl = 0; u8 clkctl, devctl = 0;
#ifdef DEBUG #ifdef DEBUG
...@@ -2414,16 +2415,17 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2414,16 +2415,17 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
/* Pending interrupt indicates new device status */ /* Pending interrupt indicates new device status */
if (bus->ipend) { if (bus->ipend) {
bus->ipend = false; bus->ipend = false;
r_sdreg32(bus, &newstatus, err = r_sdreg32(bus, &newstatus,
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs, intstatus));
bus->f1regdata++; bus->f1regdata++;
if (brcmf_sdcard_regfail(bus->sdiodev)) if (err != 0)
newstatus = 0; newstatus = 0;
newstatus &= bus->hostintmask; newstatus &= bus->hostintmask;
bus->fcstate = !!(newstatus & I_HMB_FC_STATE); bus->fcstate = !!(newstatus & I_HMB_FC_STATE);
if (newstatus) { if (newstatus) {
w_sdreg32(bus, newstatus, err = w_sdreg32(bus, newstatus,
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs,
intstatus));
bus->f1regdata++; bus->f1regdata++;
} }
} }
...@@ -2438,10 +2440,10 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2438,10 +2440,10 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
*/ */
if (intstatus & I_HMB_FC_CHANGE) { if (intstatus & I_HMB_FC_CHANGE) {
intstatus &= ~I_HMB_FC_CHANGE; intstatus &= ~I_HMB_FC_CHANGE;
w_sdreg32(bus, I_HMB_FC_CHANGE, err = w_sdreg32(bus, I_HMB_FC_CHANGE,
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs, intstatus));
r_sdreg32(bus, &newstatus, err = r_sdreg32(bus, &newstatus,
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs, intstatus));
bus->f1regdata += 2; bus->f1regdata += 2;
bus->fcstate = bus->fcstate =
...@@ -2513,17 +2515,17 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2513,17 +2515,17 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
SFC_WF_TERM, NULL); SFC_WF_TERM, &err);
bus->f1regdata++; bus->f1regdata++;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
u8 hi, lo; u8 hi, lo;
hi = brcmf_sdio_regrb(bus->sdiodev, hi = brcmf_sdio_regrb(bus->sdiodev,
SBSDIO_FUNC1_WFRAMEBCHI, SBSDIO_FUNC1_WFRAMEBCHI,
NULL); &err);
lo = brcmf_sdio_regrb(bus->sdiodev, lo = brcmf_sdio_regrb(bus->sdiodev,
SBSDIO_FUNC1_WFRAMEBCLO, SBSDIO_FUNC1_WFRAMEBCLO,
NULL); &err);
bus->f1regdata += 2; bus->f1regdata += 2;
if ((hi == 0) && (lo == 0)) if ((hi == 0) && (lo == 0))
break; break;
...@@ -2550,10 +2552,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2550,10 +2552,8 @@ 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->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || (err != 0)) {
brcmf_sdcard_regfail(bus->sdiodev)) { brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation\n");
brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation %d\n",
brcmf_sdcard_regfail(bus->sdiodev));
bus->sdiodev->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) {
......
...@@ -146,7 +146,6 @@ struct brcmf_sdio_dev { ...@@ -146,7 +146,6 @@ struct brcmf_sdio_dev {
u8 num_funcs; /* Supported funcs on client */ u8 num_funcs; /* Supported funcs on client */
u32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
u32 sbwad; /* Save backplane window address */ u32 sbwad; /* Save backplane window address */
bool regfail; /* status of last reg_r/w call */
void *bus; void *bus;
atomic_t suspend; /* suspend flag */ atomic_t suspend; /* suspend flag */
wait_queue_head_t request_byte_wait; wait_queue_head_t request_byte_wait;
...@@ -176,9 +175,6 @@ extern void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, ...@@ -176,9 +175,6 @@ extern void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr,
extern void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, extern void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr,
u32 data, int *ret); u32 data, int *ret);
/* Indicate if last reg read/write failed */
extern bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev);
/* Buffer transfer to/from device (client) core via cmd53. /* Buffer transfer to/from device (client) core via cmd53.
* fn: function number * fn: function number
* addr: backplane address (i.e. >= regsva from attach) * addr: backplane address (i.e. >= regsva from attach)
......
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