1 From 262f2b53f67936b59cc8dfc6f3899ab8905bf1ed Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Tue, 20 Feb 2018 00:14:20 +0100
4 Subject: [PATCH] brcmfmac: call brcmf_attach() just before calling
7 Now we can move brcmf_attach() until after the firmware has been downloaded
8 to the device. Make the call just before brcmf_bus_started().
10 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
11 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
12 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
13 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
16 .../wireless/broadcom/brcm80211/brcmfmac/core.c | 6 ++++
17 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 34 +++++++++++-----------
18 2 files changed, 23 insertions(+), 17 deletions(-)
20 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
21 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
22 @@ -1268,6 +1268,12 @@ void brcmf_bus_change_state(struct brcmf
25 brcmf_dbg(TRACE, "%d -> %d\n", bus->state, state);
28 + brcmf_dbg(INFO, "ignoring transition, bus not attached yet\n");
34 if (state == BRCMF_BUS_UP) {
35 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
36 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
37 @@ -4048,9 +4048,6 @@ static void brcmf_sdio_firmware_callback
44 /* try to download image and nvram to the dongle */
46 err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len);
47 @@ -4126,11 +4123,28 @@ static void brcmf_sdio_firmware_callback
49 sdio_release_host(sdiodev->func1);
51 + /* Assign bus interface call back */
52 + sdiodev->bus_if->dev = sdiodev->dev;
53 + sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
54 + sdiodev->bus_if->chip = bus->ci->chip;
55 + sdiodev->bus_if->chiprev = bus->ci->chiprev;
57 + /* Attach to the common layer, reserve hdr space */
58 + err = brcmf_attach(sdiodev->dev, sdiodev->settings);
60 + brcmf_err("brcmf_attach failed\n");
64 + brcmf_sdio_debugfs_create(bus);
66 err = brcmf_bus_started(dev);
68 brcmf_err("dongle is not responding\n");
76 @@ -4200,22 +4214,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
77 bus->dpc_triggered = false;
78 bus->dpc_running = false;
80 - /* Assign bus interface call back */
81 - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
82 - bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
83 - bus->sdiodev->bus_if->chip = bus->ci->chip;
84 - bus->sdiodev->bus_if->chiprev = bus->ci->chiprev;
86 /* default sdio bus header length for tx packet */
87 bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
89 - /* Attach to the common layer, reserve hdr space */
90 - ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings);
92 - brcmf_err("brcmf_attach failed\n");
96 /* Query the F2 block size, set roundup accordingly */
97 bus->blocksize = bus->sdiodev->func2->cur_blksize;
98 bus->roundup = min(max_roundup, bus->blocksize);
99 @@ -4240,7 +4241,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
101 bus->sr_enabled = false;
103 - brcmf_sdio_debugfs_create(bus);
104 brcmf_dbg(INFO, "completed!!\n");
106 ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev,