3828c320f4c5c72e70c93434615aa57525c98a05
[openwrt/staging/mans0n.git] /
1 From 874bb8e49b7c6368f8ff9f2566c7bd06a2249be0 Mon Sep 17 00:00:00 2001
2 From: Ian Molton <ian@mnementh.co.uk>
3 Date: Tue, 19 Dec 2017 13:47:09 +0100
4 Subject: [PATCH] brcmfmac: stabilise the value of ->sbwad in use for some xfer
5 routines.
6
7 The IO functions operate within the Chipcommon IO window. Explicitly
8 set this, rather than relying on the last initialisation IO access to
9 leave it set to the right value by chance.
10
11 Signed-off-by: Ian Molton <ian@mnementh.co.uk>
12 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
13 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 ++++----
17 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++++
18 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 1 +
19 3 files changed, 10 insertions(+), 4 deletions(-)
20
21 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
22 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
23 @@ -529,7 +529,7 @@ int brcmf_sdiod_recv_buf(struct brcmf_sd
24
25 int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, struct sk_buff *pkt)
26 {
27 - u32 addr = sdiodev->sbwad;
28 + u32 addr = sdiodev->cc_core->base;
29 int err = 0;
30
31 brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pkt->len);
32 @@ -552,7 +552,7 @@ int brcmf_sdiod_recv_chain(struct brcmf_
33 {
34 struct sk_buff *glom_skb = NULL;
35 struct sk_buff *skb;
36 - u32 addr = sdiodev->sbwad;
37 + u32 addr = sdiodev->cc_core->base;
38 int err = 0;
39
40 brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n",
41 @@ -593,7 +593,7 @@ done:
42 int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
43 {
44 struct sk_buff *mypkt;
45 - u32 addr = sdiodev->sbwad;
46 + u32 addr = sdiodev->cc_core->base;
47 int err;
48
49 mypkt = brcmu_pkt_buf_get_skb(nbytes);
50 @@ -625,7 +625,7 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd
51 struct sk_buff_head *pktq)
52 {
53 struct sk_buff *skb;
54 - u32 addr = sdiodev->sbwad;
55 + u32 addr = sdiodev->cc_core->base;
56 int err;
57
58 brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pktq->qlen);
59 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
60 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
61 @@ -3842,6 +3842,11 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
62 if (!bus->sdio_core)
63 goto fail;
64
65 + /* Pick up the CHIPCOMMON core info struct, for bulk IO in bcmsdh.c */
66 + sdiodev->cc_core = brcmf_chip_get_core(bus->ci, BCMA_CORE_CHIPCOMMON);
67 + if (!sdiodev->cc_core)
68 + goto fail;
69 +
70 sdiodev->settings = brcmf_get_module_param(sdiodev->dev,
71 BRCMF_BUSTYPE_SDIO,
72 bus->ci->chip,
73 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
74 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
75 @@ -178,6 +178,7 @@ struct brcmf_sdio_dev {
76 struct sdio_func *func[SDIO_MAX_FUNCS];
77 u8 num_funcs; /* Supported funcs on client */
78 u32 sbwad; /* Save backplane window address */
79 + struct brcmf_core *cc_core; /* chipcommon core info struct */
80 struct brcmf_sdio *bus;
81 struct device *dev;
82 struct brcmf_bus *bus_if;