1f0488a621543f6128471c49edc9ab9d32adf825
[openwrt/staging/blocktrron.git] /
1 From b9b0d290bc0c90a5a262bc89c9d995988ea98669 Mon Sep 17 00:00:00 2001
2 From: Ian Molton <ian@mnementh.co.uk>
3 Date: Mon, 13 Nov 2017 21:35:41 +0100
4 Subject: [PATCH] brcmfmac: Clean up brcmf_sdiod_set_sbaddr_window()
5
6 This function sets the address of the IO window used for
7 SDIO accesses onto the backplane of the chip.
8
9 It currently uses 3 separate masks despite the full mask being
10 defined in the code already. Remove the separate masks and clean up.
11
12 Signed-off-by: Ian Molton <ian@mnementh.co.uk>
13 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16 .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 17 +++++------------
17 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 3 ---
18 2 files changed, 5 insertions(+), 15 deletions(-)
19
20 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
21 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
22 @@ -410,23 +410,16 @@ static int
23 brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
24 {
25 int err = 0, i;
26 - u8 addr[3];
27 + u32 addr;
28
29 if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM)
30 return -ENOMEDIUM;
31
32 - addr[0] = (address >> 8) & SBSDIO_SBADDRLOW_MASK;
33 - addr[1] = (address >> 16) & SBSDIO_SBADDRMID_MASK;
34 - addr[2] = (address >> 24) & SBSDIO_SBADDRHIGH_MASK;
35 + addr = (address & SBSDIO_SBWINDOW_MASK) >> 8;
36
37 - for (i = 0; i < 3; i++) {
38 - brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, addr[i],
39 - &err);
40 - if (err) {
41 - brcmf_err("failed at addr: 0x%0x\n",
42 - SBSDIO_FUNC1_SBADDRLOW + i);
43 - }
44 - }
45 + for (i = 0 ; i < 3 && !err ; i++, addr >>= 8)
46 + brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i,
47 + addr & 0xff, &err);
48
49 return err;
50 }
51 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
52 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
53 @@ -133,9 +133,6 @@
54
55 /* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */
56
57 -#define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */
58 -#define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */
59 -#define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */
60 /* Address bits from SBADDR regs */
61 #define SBSDIO_SBWINDOW_MASK 0xffff8000
62