1 From 8c8e60fb86a90a30721bbd797f58f96b3980dcc1 Mon Sep 17 00:00:00 2001
2 From: Jean-Philippe Brucker <jean-philippe@linaro.org>
3 Date: Thu, 26 Dec 2019 10:20:33 +0100
4 Subject: [PATCH] brcmfmac: sdio: Fix OOB interrupt initialization on brcm43362
6 Commit 262f2b53f679 ("brcmfmac: call brcmf_attach() just before calling
7 brcmf_bus_started()") changed the initialization order of the brcmfmac
8 SDIO driver. Unfortunately since brcmf_sdiod_intr_register() is now
9 called before the sdiodev->bus_if initialization, it reads the wrong
10 chip ID and fails to initialize the GPIO on brcm43362. Thus the chip
11 cannot send interrupts and fails to probe:
13 [ 12.517023] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
14 [ 12.531214] ieee80211 phy0: brcmf_bus_started: failed: -110
15 [ 12.536976] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-110
16 [ 12.566467] brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
18 Initialize the bus interface earlier to ensure that
19 brcmf_sdiod_intr_register() properly sets up the OOB interrupt.
21 BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908438
22 Fixes: 262f2b53f679 ("brcmfmac: call brcmf_attach() just before calling brcmf_bus_started()")
23 Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
24 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
25 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
27 .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 ++++++------
28 1 file changed, 6 insertions(+), 6 deletions(-)
30 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
31 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
32 @@ -4249,6 +4249,12 @@ static void brcmf_sdio_firmware_callback
36 + /* Assign bus interface call back */
37 + sdiod->bus_if->dev = sdiod->dev;
38 + sdiod->bus_if->ops = &brcmf_sdio_bus_ops;
39 + sdiod->bus_if->chip = bus->ci->chip;
40 + sdiod->bus_if->chiprev = bus->ci->chiprev;
42 /* Allow full data communication using DPC from now on. */
43 brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
45 @@ -4265,12 +4271,6 @@ static void brcmf_sdio_firmware_callback
47 sdio_release_host(sdiod->func1);
49 - /* Assign bus interface call back */
50 - sdiod->bus_if->dev = sdiod->dev;
51 - sdiod->bus_if->ops = &brcmf_sdio_bus_ops;
52 - sdiod->bus_if->chip = bus->ci->chip;
53 - sdiod->bus_if->chiprev = bus->ci->chiprev;
55 err = brcmf_alloc(sdiod->dev, sdiod->settings);
57 brcmf_err("brcmf_alloc failed\n");