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()
6 This function sets the address of the IO window used for
7 SDIO accesses onto the backplane of the chip.
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.
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>
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(-)
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)
29 if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM)
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;
37 - for (i = 0; i < 3; i++) {
38 - brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, addr[i],
41 - brcmf_err("failed at addr: 0x%0x\n",
42 - SBSDIO_FUNC1_SBADDRLOW + i);
45 + for (i = 0 ; i < 3 && !err ; i++, addr >>= 8)
46 + brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i,
51 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
52 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
55 /* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */
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