summaryrefslogtreecommitdiff
path: root/package/kernel/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'package/kernel/mac80211')
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch45
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch69
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch106
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch41
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch130
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch190
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch64
-rw-r--r--package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch126
-rw-r--r--package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch2
9 files changed, 772 insertions, 1 deletions
diff --git a/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch b/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch
new file mode 100644
index 0000000..f4d9a84
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch
@@ -0,0 +1,45 @@
+From da472385a29f1fddcac7cfa0499482704310bd16 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:18 +0100
+Subject: [PATCH] brcmfmac: move brcmf_bus_preinit() call just after changing
+ bus state
+
+Moving the brcmf_bus_preinit() call allows the bus code to do some
+required initialization before handling firmware control messages.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 3 ---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+@@ -369,9 +369,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+
+ /* Enable tx beamforming, errors can be ignored (not supported) */
+ (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1);
+-
+- /* do bus specific preinit here */
+- err = brcmf_bus_preinit(ifp->drvr->bus_if);
+ done:
+ return err;
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -1091,6 +1091,11 @@ int brcmf_bus_started(struct device *dev
+ /* signal bus ready */
+ brcmf_bus_change_state(bus_if, BRCMF_BUS_UP);
+
++ /* do bus specific preinit here */
++ ret = brcmf_bus_preinit(ifp->drvr->bus_if);
++ if (ret < 0)
++ goto fail;
++
+ /* Bus is ready, do any initialization */
+ ret = brcmf_c_preinit_dcmds(ifp);
+ if (ret < 0)
diff --git a/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch b/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch
new file mode 100644
index 0000000..230e891
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch
@@ -0,0 +1,69 @@
+From 4b5adc736828dc25ca33e263ad8c0b9dcd3bf325 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:19 +0100
+Subject: [PATCH] brcmfmac: move allocation of control rx buffer to
+ brcmf_sdio_bus_preinit()
+
+Allocate the control rx buffer needed for firmware control interface
+during brcmf_sdio_bus_preinit(). This relies on common layer setting
+struct brcmf_bus::maxctl during brcmf_attach(). By moving the allocation
+we can move brcmf_attach() in subsequent change.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 26 ++++++++++------------
+ 1 file changed, 12 insertions(+), 14 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -1707,7 +1707,6 @@ brcmf_sdio_read_control(struct brcmf_sdi
+ int sdret;
+
+ brcmf_dbg(TRACE, "Enter\n");
+-
+ if (bus->rxblen)
+ buf = vzalloc(bus->rxblen);
+ if (!buf)
+@@ -3411,6 +3410,18 @@ static int brcmf_sdio_bus_preinit(struct
+ u32 value;
+ int err;
+
++ /* maxctl provided by common layer */
++ if (WARN_ON(!bus_if->maxctl))
++ return -EINVAL;
++
++ /* Allocate control receive buffer */
++ bus_if->maxctl += bus->roundup;
++ value = roundup((bus_if->maxctl + SDPCM_HDRLEN), ALIGNMENT);
++ value += bus->head_align;
++ bus->rxbuf = kmalloc(value, GFP_ATOMIC);
++ if (bus->rxbuf)
++ bus->rxblen = value;
++
+ /* the commands below use the terms tx and rx from
+ * a device perspective, ie. bus:txglom affects the
+ * bus transfers from device to host.
+@@ -4209,19 +4220,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
+ bus->blocksize = bus->sdiodev->func2->cur_blksize;
+ bus->roundup = min(max_roundup, bus->blocksize);
+
+- /* Allocate buffers */
+- if (bus->sdiodev->bus_if->maxctl) {
+- bus->sdiodev->bus_if->maxctl += bus->roundup;
+- bus->rxblen =
+- roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN),
+- ALIGNMENT) + bus->head_align;
+- bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC);
+- if (!(bus->rxbuf)) {
+- brcmf_err("rxbuf allocation failed\n");
+- goto fail;
+- }
+- }
+-
+ sdio_claim_host(bus->sdiodev->func1);
+
+ /* Disable F2 to clear any intermediate frame state on the dongle */
diff --git a/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch b/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch
new file mode 100644
index 0000000..a8b0171
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch
@@ -0,0 +1,106 @@
+From 262f2b53f67936b59cc8dfc6f3899ab8905bf1ed Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:20 +0100
+Subject: [PATCH] brcmfmac: call brcmf_attach() just before calling
+ brcmf_bus_started()
+
+Now we can move brcmf_attach() until after the firmware has been downloaded
+to the device. Make the call just before brcmf_bus_started().
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/core.c | 6 ++++
+ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 34 +++++++++++-----------
+ 2 files changed, 23 insertions(+), 17 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -1268,6 +1268,12 @@ void brcmf_bus_change_state(struct brcmf
+ int ifidx;
+
+ brcmf_dbg(TRACE, "%d -> %d\n", bus->state, state);
++
++ if (!drvr) {
++ brcmf_dbg(INFO, "ignoring transition, bus not attached yet\n");
++ return;
++ }
++
+ bus->state = state;
+
+ if (state == BRCMF_BUS_UP) {
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -4048,9 +4048,6 @@ static void brcmf_sdio_firmware_callback
+ if (err)
+ goto fail;
+
+- if (!bus_if->drvr)
+- return;
+-
+ /* try to download image and nvram to the dongle */
+ bus->alp_only = true;
+ err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len);
+@@ -4126,11 +4123,28 @@ static void brcmf_sdio_firmware_callback
+
+ sdio_release_host(sdiodev->func1);
+
++ /* Assign bus interface call back */
++ sdiodev->bus_if->dev = sdiodev->dev;
++ sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
++ sdiodev->bus_if->chip = bus->ci->chip;
++ sdiodev->bus_if->chiprev = bus->ci->chiprev;
++
++ /* Attach to the common layer, reserve hdr space */
++ err = brcmf_attach(sdiodev->dev, sdiodev->settings);
++ if (err != 0) {
++ brcmf_err("brcmf_attach failed\n");
++ goto fail;
++ }
++
++ brcmf_sdio_debugfs_create(bus);
++
+ err = brcmf_bus_started(dev);
+ if (err != 0) {
+ brcmf_err("dongle is not responding\n");
+ goto fail;
+ }
++
++ /* ready */
+ return;
+
+ release:
+@@ -4200,22 +4214,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
+ bus->dpc_triggered = false;
+ bus->dpc_running = false;
+
+- /* Assign bus interface call back */
+- bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
+- bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
+- bus->sdiodev->bus_if->chip = bus->ci->chip;
+- bus->sdiodev->bus_if->chiprev = bus->ci->chiprev;
+-
+ /* default sdio bus header length for tx packet */
+ bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
+
+- /* Attach to the common layer, reserve hdr space */
+- ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings);
+- if (ret != 0) {
+- brcmf_err("brcmf_attach failed\n");
+- goto fail;
+- }
+-
+ /* Query the F2 block size, set roundup accordingly */
+ bus->blocksize = bus->sdiodev->func2->cur_blksize;
+ bus->roundup = min(max_roundup, bus->blocksize);
+@@ -4240,7 +4241,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
+ /* SR state */
+ bus->sr_enabled = false;
+
+- brcmf_sdio_debugfs_create(bus);
+ brcmf_dbg(INFO, "completed!!\n");
+
+ ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev,
diff --git a/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch b/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch
new file mode 100644
index 0000000..00c4141
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch
@@ -0,0 +1,41 @@
+From a7f4a80c0070b673d4a4ce94b99979ea6d0c6296 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:21 +0100
+Subject: [PATCH] brcmfmac: usb: call brcmf_usb_up() during brcmf_bus_preinit()
+
+By calling brcmf_usb_up() during brcmf_bus_preinit() it does not need
+to be called in brcmf_usb_bus_setup().
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+@@ -1146,8 +1146,9 @@ static int brcmf_usb_get_fwname(struct d
+ }
+
+ static const struct brcmf_bus_ops brcmf_usb_bus_ops = {
+- .txdata = brcmf_usb_tx,
++ .preinit = brcmf_usb_up,
+ .stop = brcmf_usb_down,
++ .txdata = brcmf_usb_tx,
+ .txctl = brcmf_usb_tx_ctlpkt,
+ .rxctl = brcmf_usb_rx_ctlpkt,
+ .wowl_config = brcmf_usb_wowl_config,
+@@ -1165,10 +1166,6 @@ static int brcmf_usb_bus_setup(struct br
+ return ret;
+ }
+
+- ret = brcmf_usb_up(devinfo->dev);
+- if (ret)
+- goto fail;
+-
+ ret = brcmf_bus_started(devinfo->dev);
+ if (ret)
+ goto fail;
diff --git a/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch b/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch
new file mode 100644
index 0000000..086b5fa
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch
@@ -0,0 +1,130 @@
+From 0542503c4c164c65cd1567b0f2b3f887af6c81eb Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:22 +0100
+Subject: [PATCH] brcmfmac: move brcmf_attach() function in core.c
+
+Moving the function in preparation of subsequent patch.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/core.c | 98 +++++++++++-----------
+ 1 file changed, 49 insertions(+), 49 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -992,55 +992,6 @@ static int brcmf_inet6addr_changed(struc
+ }
+ #endif
+
+-int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
+-{
+- struct brcmf_pub *drvr = NULL;
+- int ret = 0;
+- int i;
+-
+- brcmf_dbg(TRACE, "Enter\n");
+-
+- /* Allocate primary brcmf_info */
+- drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC);
+- if (!drvr)
+- return -ENOMEM;
+-
+- for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
+- drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
+-
+- mutex_init(&drvr->proto_block);
+-
+- /* Link to bus module */
+- drvr->hdrlen = 0;
+- drvr->bus_if = dev_get_drvdata(dev);
+- drvr->bus_if->drvr = drvr;
+- drvr->settings = settings;
+-
+- /* attach debug facilities */
+- brcmf_debug_attach(drvr);
+-
+- /* Attach and link in the protocol */
+- ret = brcmf_proto_attach(drvr);
+- if (ret != 0) {
+- brcmf_err("brcmf_prot_attach failed\n");
+- goto fail;
+- }
+-
+- /* Attach to events important for core code */
+- brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
+- brcmf_psm_watchdog_notify);
+-
+- /* attach firmware event handler */
+- brcmf_fweh_attach(drvr);
+-
+- return ret;
+-
+-fail:
+- brcmf_detach(dev);
+-
+- return ret;
+-}
+-
+ static int brcmf_revinfo_read(struct seq_file *s, void *data)
+ {
+ struct brcmf_bus *bus_if = dev_get_drvdata(s->private);
+@@ -1170,6 +1121,55 @@ fail:
+
+ return ret;
+ }
++
++int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
++{
++ struct brcmf_pub *drvr = NULL;
++ int ret = 0;
++ int i;
++
++ brcmf_dbg(TRACE, "Enter\n");
++
++ /* Allocate primary brcmf_info */
++ drvr = kzalloc(sizeof(*drvr), GFP_ATOMIC);
++ if (!drvr)
++ return -ENOMEM;
++
++ for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
++ drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
++
++ mutex_init(&drvr->proto_block);
++
++ /* Link to bus module */
++ drvr->hdrlen = 0;
++ drvr->bus_if = dev_get_drvdata(dev);
++ drvr->bus_if->drvr = drvr;
++ drvr->settings = settings;
++
++ /* attach debug facilities */
++ brcmf_debug_attach(drvr);
++
++ /* Attach and link in the protocol */
++ ret = brcmf_proto_attach(drvr);
++ if (ret != 0) {
++ brcmf_err("brcmf_prot_attach failed\n");
++ goto fail;
++ }
++
++ /* Attach to events important for core code */
++ brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
++ brcmf_psm_watchdog_notify);
++
++ /* attach firmware event handler */
++ brcmf_fweh_attach(drvr);
++
++ return ret;
++
++fail:
++ brcmf_detach(dev);
++
++ return ret;
++}
+
+ void brcmf_bus_add_txhdrlen(struct device *dev, uint len)
+ {
diff --git a/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch b/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch
new file mode 100644
index 0000000..6d23ccd
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch
@@ -0,0 +1,190 @@
+From de2a3027f6f15e2f6558dc4d178282ccc1f054db Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:23 +0100
+Subject: [PATCH] brcmfmac: remove brcmf_bus_started() from bus api
+
+No longer needed to call this in bus layer so make it static and call
+it in the last phase of brcmf_attach() instead.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 1 -
+ .../wireless/broadcom/brcm80211/brcmfmac/core.c | 14 +++++++----
+ .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 +---------------
+ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 ++------
+ .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 28 ++++------------------
+ 5 files changed, 16 insertions(+), 57 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+@@ -253,7 +253,6 @@ void brcmf_dev_reset(struct device *dev)
+ /* Configure the "global" bus state used by upper layers */
+ void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
+
+-int brcmf_bus_started(struct device *dev);
+ s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len);
+ void brcmf_bus_add_txhdrlen(struct device *dev, uint len);
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -1022,11 +1022,10 @@ static int brcmf_revinfo_read(struct seq
+ return 0;
+ }
+
+-int brcmf_bus_started(struct device *dev)
++static int brcmf_bus_started(struct brcmf_pub *drvr)
+ {
+ int ret = -1;
+- struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+- struct brcmf_pub *drvr = bus_if->drvr;
++ struct brcmf_bus *bus_if = drvr->bus_if;
+ struct brcmf_if *ifp;
+ struct brcmf_if *p2p_ifp;
+
+@@ -1043,7 +1042,7 @@ int brcmf_bus_started(struct device *dev
+ brcmf_bus_change_state(bus_if, BRCMF_BUS_UP);
+
+ /* do bus specific preinit here */
+- ret = brcmf_bus_preinit(ifp->drvr->bus_if);
++ ret = brcmf_bus_preinit(bus_if);
+ if (ret < 0)
+ goto fail;
+
+@@ -1163,7 +1162,12 @@ int brcmf_attach(struct device *dev, str
+ /* attach firmware event handler */
+ brcmf_fweh_attach(drvr);
+
+- return ret;
++ ret = brcmf_bus_started(drvr);
++ if (ret != 0) {
++ brcmf_err("dongle is not responding: err=%d\n", ret);
++ goto fail;
++ }
++ return 0;
+
+ fail:
+ brcmf_detach(dev);
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+@@ -1581,24 +1581,6 @@ static void brcmf_pcie_release_resource(
+ }
+
+
+-static int brcmf_pcie_attach_bus(struct brcmf_pciedev_info *devinfo)
+-{
+- int ret;
+-
+- /* Attach to the common driver interface */
+- ret = brcmf_attach(&devinfo->pdev->dev, devinfo->settings);
+- if (ret) {
+- brcmf_err("brcmf_attach failed\n");
+- } else {
+- ret = brcmf_bus_started(&devinfo->pdev->dev);
+- if (ret)
+- brcmf_err("dongle is not responding\n");
+- }
+-
+- return ret;
+-}
+-
+-
+ static u32 brcmf_pcie_buscore_prep_addr(const struct pci_dev *pdev, u32 addr)
+ {
+ u32 ret_addr;
+@@ -1735,7 +1717,7 @@ static void brcmf_pcie_setup(struct devi
+ init_waitqueue_head(&devinfo->mbdata_resp_wait);
+
+ brcmf_pcie_intr_enable(devinfo);
+- if (brcmf_pcie_attach_bus(devinfo) == 0)
++ if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0)
+ return;
+
+ brcmf_pcie_bus_console_read(devinfo);
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -3422,6 +3422,8 @@ static int brcmf_sdio_bus_preinit(struct
+ if (bus->rxbuf)
+ bus->rxblen = value;
+
++ brcmf_sdio_debugfs_create(bus);
++
+ /* the commands below use the terms tx and rx from
+ * a device perspective, ie. bus:txglom affects the
+ * bus transfers from device to host.
+@@ -4136,14 +4138,6 @@ static void brcmf_sdio_firmware_callback
+ goto fail;
+ }
+
+- brcmf_sdio_debugfs_create(bus);
+-
+- err = brcmf_bus_started(dev);
+- if (err != 0) {
+- brcmf_err("dongle is not responding\n");
+- goto fail;
+- }
+-
+ /* ready */
+ return;
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+@@ -1155,27 +1155,6 @@ static const struct brcmf_bus_ops brcmf_
+ .get_fwname = brcmf_usb_get_fwname,
+ };
+
+-static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo)
+-{
+- int ret;
+-
+- /* Attach to the common driver interface */
+- ret = brcmf_attach(devinfo->dev, devinfo->settings);
+- if (ret) {
+- brcmf_err("brcmf_attach failed\n");
+- return ret;
+- }
+-
+- ret = brcmf_bus_started(devinfo->dev);
+- if (ret)
+- goto fail;
+-
+- return 0;
+-fail:
+- brcmf_detach(devinfo->dev);
+- return ret;
+-}
+-
+ static void brcmf_usb_probe_phase2(struct device *dev, int ret,
+ const struct firmware *fw,
+ void *nvram, u32 nvlen)
+@@ -1203,7 +1182,8 @@ static void brcmf_usb_probe_phase2(struc
+ if (ret)
+ goto error;
+
+- ret = brcmf_usb_bus_setup(devinfo);
++ /* Attach to the common driver interface */
++ ret = brcmf_attach(devinfo->dev, devinfo->settings);
+ if (ret)
+ goto error;
+
+@@ -1253,7 +1233,7 @@ static int brcmf_usb_probe_cb(struct brc
+ }
+
+ if (!brcmf_usb_dlneeded(devinfo)) {
+- ret = brcmf_usb_bus_setup(devinfo);
++ ret = brcmf_attach(devinfo->dev, devinfo->settings);
+ if (ret)
+ goto fail;
+ /* we are done */
+@@ -1456,7 +1436,7 @@ static int brcmf_usb_resume(struct usb_i
+
+ brcmf_dbg(USB, "Enter\n");
+ if (!devinfo->wowl_enabled)
+- return brcmf_usb_bus_setup(devinfo);
++ return brcmf_attach(devinfo->dev, devinfo->settings);
+
+ devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP;
+ brcmf_usb_rx_fill_all(devinfo);
diff --git a/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch b/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch
new file mode 100644
index 0000000..3448269
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch
@@ -0,0 +1,64 @@
+From d678296bfb9a630d0000222fc21f4ed0d0d65332 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:24 +0100
+Subject: [PATCH] brcmfmac: change log level for some low-level sdio functions
+
+Reducing the number of trace level messages in sdio code giving
+them sdio log level instead.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -1706,7 +1706,7 @@ brcmf_sdio_read_control(struct brcmf_sdi
+ u8 *buf = NULL, *rbuf;
+ int sdret;
+
+- brcmf_dbg(TRACE, "Enter\n");
++ brcmf_dbg(SDIO, "Enter\n");
+ if (bus->rxblen)
+ buf = vzalloc(bus->rxblen);
+ if (!buf)
+@@ -1809,7 +1809,7 @@ static uint brcmf_sdio_readframes(struct
+ struct brcmf_sdio_hdrinfo *rd = &bus->cur_read, rd_new;
+ u8 head_read = 0;
+
+- brcmf_dbg(TRACE, "Enter\n");
++ brcmf_dbg(SDIO, "Enter\n");
+
+ /* Not finished unless we encounter no more frames indication */
+ bus->rxpending = true;
+@@ -2344,7 +2344,7 @@ static int brcmf_sdio_tx_ctrlframe(struc
+ struct brcmf_sdio_hdrinfo hd_info = {0};
+ int ret;
+
+- brcmf_dbg(TRACE, "Enter\n");
++ brcmf_dbg(SDIO, "Enter\n");
+
+ /* Back the pointer to make room for bus header */
+ frame -= bus->tx_hdrlen;
+@@ -2520,7 +2520,7 @@ static void brcmf_sdio_dpc(struct brcmf_
+ uint framecnt; /* Temporary counter of tx/rx frames */
+ int err = 0;
+
+- brcmf_dbg(TRACE, "Enter\n");
++ brcmf_dbg(SDIO, "Enter\n");
+
+ sdio_claim_host(bus->sdiodev->func1);
+
+@@ -2605,7 +2605,7 @@ static void brcmf_sdio_dpc(struct brcmf_
+
+ /* Would be active due to wake-wlan in gSPI */
+ if (intstatus & I_CHIPACTIVE) {
+- brcmf_dbg(INFO, "Dongle reports CHIPACTIVE\n");
++ brcmf_dbg(SDIO, "Dongle reports CHIPACTIVE\n");
+ intstatus &= ~I_CHIPACTIVE;
+ }
+
diff --git a/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch b/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch
new file mode 100644
index 0000000..39fba21
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch
@@ -0,0 +1,126 @@
+From 2d6edad4b2da1991f74e7b02053eeb4a043b887f Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 20 Feb 2018 00:14:25 +0100
+Subject: [PATCH] brcmfmac: remove duplicate pointer variable from
+ brcmf_sdio_firmware_callback()
+
+In brcmf_sdio_firmware_callback() two pointer variables were used
+pointing to the same construct. Get rid of sdiodev variable.
+
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 37 +++++++++++-----------
+ 1 file changed, 18 insertions(+), 19 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -4039,9 +4039,8 @@ static void brcmf_sdio_firmware_callback
+ void *nvram, u32 nvram_len)
+ {
+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+- struct brcmf_sdio *bus = sdiodev->bus;
+- struct brcmf_sdio_dev *sdiod = bus->sdiodev;
++ struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio;
++ struct brcmf_sdio *bus = sdiod->bus;
+ struct brcmf_core *core = bus->sdio_core;
+ u8 saveclk;
+
+@@ -4061,7 +4060,7 @@ static void brcmf_sdio_firmware_callback
+ bus->sdcnt.tickcnt = 0;
+ brcmf_sdio_wd_timer(bus, true);
+
+- sdio_claim_host(sdiodev->func1);
++ sdio_claim_host(sdiod->func1);
+
+ /* Make sure backplane clock is on, needed to generate F2 interrupt */
+ brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
+@@ -4069,9 +4068,9 @@ static void brcmf_sdio_firmware_callback
+ goto release;
+
+ /* Force clocks on backplane to be sure F2 interrupt propagates */
+- saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err);
++ saveclk = brcmf_sdiod_readb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, &err);
+ if (!err) {
+- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
++ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR,
+ (saveclk | SBSDIO_FORCE_HT), &err);
+ }
+ if (err) {
+@@ -4083,7 +4082,7 @@ static void brcmf_sdio_firmware_callback
+ brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata),
+ SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL);
+
+- err = sdio_enable_func(sdiodev->func2);
++ err = sdio_enable_func(sdiod->func2);
+
+ brcmf_dbg(INFO, "enable F2: err=%d\n", err);
+
+@@ -4095,10 +4094,10 @@ static void brcmf_sdio_firmware_callback
+ bus->hostintmask, NULL);
+
+
+- brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err);
++ brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 8, &err);
+ } else {
+ /* Disable F2 again */
+- sdio_disable_func(sdiodev->func2);
++ sdio_disable_func(sdiod->func2);
+ goto release;
+ }
+
+@@ -4106,7 +4105,7 @@ static void brcmf_sdio_firmware_callback
+ brcmf_sdio_sr_init(bus);
+ } else {
+ /* Restore previous clock setting */
+- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
++ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR,
+ saveclk, &err);
+ }
+
+@@ -4114,7 +4113,7 @@ static void brcmf_sdio_firmware_callback
+ /* Allow full data communication using DPC from now on. */
+ brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
+
+- err = brcmf_sdiod_intr_register(sdiodev);
++ err = brcmf_sdiod_intr_register(sdiod);
+ if (err != 0)
+ brcmf_err("intr register failed:%d\n", err);
+ }
+@@ -4123,16 +4122,16 @@ static void brcmf_sdio_firmware_callback
+ if (err != 0)
+ brcmf_sdio_clkctl(bus, CLK_NONE, false);
+
+- sdio_release_host(sdiodev->func1);
++ sdio_release_host(sdiod->func1);
+
+ /* Assign bus interface call back */
+- sdiodev->bus_if->dev = sdiodev->dev;
+- sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
+- sdiodev->bus_if->chip = bus->ci->chip;
+- sdiodev->bus_if->chiprev = bus->ci->chiprev;
++ sdiod->bus_if->dev = sdiod->dev;
++ sdiod->bus_if->ops = &brcmf_sdio_bus_ops;
++ sdiod->bus_if->chip = bus->ci->chip;
++ sdiod->bus_if->chiprev = bus->ci->chiprev;
+
+ /* Attach to the common layer, reserve hdr space */
+- err = brcmf_attach(sdiodev->dev, sdiodev->settings);
++ err = brcmf_attach(sdiod->dev, sdiod->settings);
+ if (err != 0) {
+ brcmf_err("brcmf_attach failed\n");
+ goto fail;
+@@ -4142,10 +4141,10 @@ static void brcmf_sdio_firmware_callback
+ return;
+
+ release:
+- sdio_release_host(sdiodev->func1);
++ sdio_release_host(sdiod->func1);
+ fail:
+ brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
+- device_release_driver(&sdiodev->func2->dev);
++ device_release_driver(&sdiod->func2->dev);
+ device_release_driver(dev);
+ }
+
diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
index b7bce63..a167046 100644
--- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
+++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1295,6 +1295,7 @@ int __init brcmf_core_init(void)
+@@ -1310,6 +1310,7 @@ int __init brcmf_core_init(void)
{
if (!schedule_work(&brcmf_driver_work))
return -EBUSY;