719268f8fec0c8d8a551e3e36b56e905bf05ee5a
[openwrt/staging/wigyori.git] /
1 From 1e6f676f43aa4270ebc5cff8e32a55f72362e042 Mon Sep 17 00:00:00 2001
2 From: Ian Molton <ian@mnementh.co.uk>
3 Date: Mon, 13 Nov 2017 21:35:39 +0100
4 Subject: [PATCH] brcmfmac: Register sizes on hardware are not dependent on
5 compiler types
6
7 The 4 IO functions in this patch are incorrect as they use compiler types
8 to determine how many bytes to send to the hardware.
9
10 Signed-off-by: Ian Molton <ian@mnementh.co.uk>
11 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
12 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
13 ---
14 .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 22 +++++++++++-----------
15 1 file changed, 11 insertions(+), 11 deletions(-)
16
17 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
18 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
19 @@ -264,7 +264,7 @@ static int brcmf_sdiod_request_data(stru
20 func = sdiodev->func[fn];
21
22 switch (regsz) {
23 - case sizeof(u8):
24 + case 1:
25 if (write) {
26 if (fn)
27 sdio_writeb(func, *(u8 *)data, addr, &ret);
28 @@ -278,13 +278,13 @@ static int brcmf_sdiod_request_data(stru
29 *(u8 *)data = sdio_f0_readb(func, addr, &ret);
30 }
31 break;
32 - case sizeof(u16):
33 + case 2:
34 if (write)
35 sdio_writew(func, *(u16 *)data, addr, &ret);
36 else
37 *(u16 *)data = sdio_readw(func, addr, &ret);
38 break;
39 - case sizeof(u32):
40 + case 4:
41 if (write)
42 sdio_writel(func, *(u32 *)data, addr, &ret);
43 else
44 @@ -368,7 +368,7 @@ brcmf_sdiod_set_sbaddr_window(struct brc
45 for (i = 0; i < 3; i++) {
46 err = brcmf_sdiod_regrw_helper(sdiodev,
47 SBSDIO_FUNC1_SBADDRLOW + i,
48 - sizeof(u8), &addr[i], true);
49 + 1, &addr[i], true);
50 if (err) {
51 brcmf_err("failed at addr: 0x%0x\n",
52 SBSDIO_FUNC1_SBADDRLOW + i);
53 @@ -407,7 +407,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d
54 int retval;
55
56 brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
57 - retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data,
58 + retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 1, &data,
59 false);
60 brcmf_dbg(SDIO, "data:0x%02x\n", data);
61
62 @@ -423,10 +423,10 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_
63 int retval;
64
65 brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
66 - retval = brcmf_sdiod_addrprep(sdiodev, sizeof(data), &addr);
67 + retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr);
68 if (retval)
69 goto done;
70 - retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data,
71 + retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 4, &data,
72 false);
73 brcmf_dbg(SDIO, "data:0x%08x\n", data);
74
75 @@ -443,7 +443,7 @@ void brcmf_sdiod_regwb(struct brcmf_sdio
76 int retval;
77
78 brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data);
79 - retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data,
80 + retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 1, &data,
81 true);
82 if (ret)
83 *ret = retval;
84 @@ -455,10 +455,10 @@ void brcmf_sdiod_regwl(struct brcmf_sdio
85 int retval;
86
87 brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data);
88 - retval = brcmf_sdiod_addrprep(sdiodev, sizeof(data), &addr);
89 + retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr);
90 if (retval)
91 goto done;
92 - retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data,
93 + retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 4, &data,
94 true);
95
96 done:
97 @@ -876,7 +876,7 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
98
99 /* issue abort cmd52 command through F0 */
100 brcmf_sdiod_request_data(sdiodev, SDIO_FUNC_0, SDIO_CCCR_ABORT,
101 - sizeof(t_func), &t_func, true);
102 + 1, &t_func, true);
103
104 brcmf_dbg(SDIO, "Exit\n");
105 return 0;