Commit 1cc26990 authored by Franky Lin's avatar Franky Lin Committed by John W. Linville

brcm80211: fmac: fix SDIO function 0 register r/w issue

SDIO stack doesn't have a structure for function 0. The structure
pointer stored in card->sdio_func[0] is actually for function 1.
With current implementation the register read/write is applied to
function 1. This pathch fixes the issue.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarFlorian Fainelli <florian@openwrt.org>
Reviewed-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4dcc0637
...@@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, ...@@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
sdio_release_host(sdfunc); sdio_release_host(sdfunc);
} }
} else if (regaddr == SDIO_CCCR_ABORT) { } else if (regaddr == SDIO_CCCR_ABORT) {
sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func),
GFP_KERNEL);
if (!sdfunc)
return -ENOMEM;
sdfunc->num = 0;
sdio_claim_host(sdfunc); sdio_claim_host(sdfunc);
sdio_writeb(sdfunc, *byte, regaddr, &err_ret); sdio_writeb(sdfunc, *byte, regaddr, &err_ret);
sdio_release_host(sdfunc); sdio_release_host(sdfunc);
kfree(sdfunc);
} else if (regaddr < 0xF0) { } else if (regaddr < 0xF0) {
brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr);
err_ret = -EPERM; err_ret = -EPERM;
...@@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, ...@@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
kfree(bus_if); kfree(bus_if);
return -ENOMEM; return -ENOMEM;
} }
sdiodev->func[0] = func->card->sdio_func[0]; sdiodev->func[0] = func;
sdiodev->func[1] = func; sdiodev->func[1] = func;
sdiodev->bus_if = bus_if; sdiodev->bus_if = bus_if;
bus_if->bus_priv.sdio = sdiodev; bus_if->bus_priv.sdio = sdiodev;
......
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