Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2019-01-11 15:11:28 +0100
committerPetr Tesarik <ptesarik@suse.cz>2019-01-11 15:11:28 +0100
commit171485d8c7e7d3b338cdf8233d266187a6e9d951 (patch)
tree2b5542db271be368d317e6168e26e1fc47d3467a
parentd0a916f8f86fdb3f4a12c6c3a470c35fbc4b9c7a (diff)
parent0cfb5bfac24c0abab646750c41af6eb3da643c15 (diff)
Merge branch 'users/mbrugger/SLE15-SP1/for-next' into SLE15-SP1
Pull brcmfmac wifi improvements from Matthias Brugger
-rw-r--r--patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch110
-rw-r--r--patches.drivers/0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch134
-rw-r--r--patches.drivers/0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch87
-rw-r--r--patches.drivers/0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch91
-rw-r--r--patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch194
-rw-r--r--patches.drivers/0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch49
-rw-r--r--patches.drivers/0007-brcmfmac-Add-support-for-getting-nvram-contents-from.patch139
-rw-r--r--patches.drivers/0008-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch105
-rw-r--r--patches.drivers/brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch47
-rw-r--r--patches.drivers/brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch42
-rw-r--r--series.conf10
11 files changed, 1008 insertions, 0 deletions
diff --git a/patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch b/patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch
new file mode 100644
index 0000000000..b3e23f3e3f
--- /dev/null
+++ b/patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch
@@ -0,0 +1,110 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:00:58 +0200
+Subject: brcmfmac: Remove firmware-loading code duplication
+Git-commit: a1a3b762163868ad07a4499a73df324f40d5ab0b
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+brcmf_fw_request_next_item and brcmf_fw_request_done both have identical
+code to complete the fw-request depending on the item-type.
+
+This commit adds a new brcmf_fw_complete_request helper removing this code
+duplication.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/firmware.c | 62 +++++++++----------
+ 1 file changed, 31 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index 9095b830ae4d..784c84f0e9e7 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -504,6 +504,34 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
+ return -ENOENT;
+ }
+
++static int brcmf_fw_complete_request(const struct firmware *fw,
++ struct brcmf_fw *fwctx)
++{
++ struct brcmf_fw_item *cur = &fwctx->req->items[fwctx->curpos];
++ int ret = 0;
++
++ brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path, fw ? "" : "not ");
++
++ switch (cur->type) {
++ case BRCMF_FW_TYPE_NVRAM:
++ ret = brcmf_fw_request_nvram_done(fw, fwctx);
++ break;
++ case BRCMF_FW_TYPE_BINARY:
++ if (fw)
++ cur->binary = fw;
++ else
++ ret = -ENOENT;
++ break;
++ default:
++ /* something fishy here so bail out early */
++ brcmf_err("unknown fw type: %d\n", cur->type);
++ release_firmware(fw);
++ ret = -EINVAL;
++ }
++
++ return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret;
++}
++
+ static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async)
+ {
+ struct brcmf_fw_item *cur;
+@@ -525,15 +553,7 @@ static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async)
+ if (ret < 0) {
+ brcmf_fw_request_done(NULL, fwctx);
+ } else if (!async && fw) {
+- brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path,
+- fw ? "" : "not ");
+- if (cur->type == BRCMF_FW_TYPE_BINARY)
+- cur->binary = fw;
+- else if (cur->type == BRCMF_FW_TYPE_NVRAM)
+- brcmf_fw_request_nvram_done(fw, fwctx);
+- else
+- release_firmware(fw);
+-
++ brcmf_fw_complete_request(fw, fwctx);
+ return -EAGAIN;
+ }
+ return 0;
+@@ -547,28 +567,8 @@ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+
+ cur = &fwctx->req->items[fwctx->curpos];
+
+- brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path,
+- fw ? "" : "not ");
+-
+- if (!fw)
+- ret = -ENOENT;
+-
+- switch (cur->type) {
+- case BRCMF_FW_TYPE_NVRAM:
+- ret = brcmf_fw_request_nvram_done(fw, fwctx);
+- break;
+- case BRCMF_FW_TYPE_BINARY:
+- cur->binary = fw;
+- break;
+- default:
+- /* something fishy here so bail out early */
+- brcmf_err("unknown fw type: %d\n", cur->type);
+- release_firmware(fw);
+- ret = -EINVAL;
+- goto fail;
+- }
+-
+- if (ret < 0 && !(cur->flags & BRCMF_FW_REQF_OPTIONAL))
++ ret = brcmf_fw_complete_request(fw, fwctx);
++ if (ret < 0)
+ goto fail;
+
+ do {
+--
+2.20.1
+
diff --git a/patches.drivers/0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch b/patches.drivers/0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch
new file mode 100644
index 0000000000..fbc1b5343f
--- /dev/null
+++ b/patches.drivers/0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch
@@ -0,0 +1,134 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:00:59 +0200
+Subject: brcmfmac: Remove recursion from firmware load error handling
+Git-commit: 5b587496dc63595b71265d986ce69728c2724370
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+Before this commit brcmf_fw_request_done would call
+brcmf_fw_request_next_item to load the next item, which on an error would
+call brcmf_fw_request_done, which if the error is recoverable (*) will
+then continue calling brcmf_fw_request_next_item for the next item again
+which on an error will call brcmf_fw_request_done again...
+
+This does not blow up because we only have a limited number of items so
+we never recurse too deep. But the recursion is still quite ugly and
+frankly is giving me a headache, so lets fix this.
+
+This commit fixes this by removing brcmf_fw_request_next_item and by
+making brcmf_fw_get_firmwares and brcmf_fw_request_done directly call
+firmware_request_nowait resp. firmware_request themselves.
+
+*) brcmf_fw_request_nvram_done fallback path succeeds or
+ BRCMF_FW_REQF_OPTIONAL is set
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/firmware.c | 65 ++++++-------------
+ 1 file changed, 19 insertions(+), 46 deletions(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index 784c84f0e9e7..08aaf99fee34 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -532,33 +532,6 @@ static int brcmf_fw_complete_request(const struct firmware *fw,
+ return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret;
+ }
+
+-static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async)
+-{
+- struct brcmf_fw_item *cur;
+- const struct firmware *fw = NULL;
+- int ret;
+-
+- cur = &fwctx->req->items[fwctx->curpos];
+-
+- brcmf_dbg(TRACE, "%srequest for %s\n", async ? "async " : "",
+- cur->path);
+-
+- if (async)
+- ret = request_firmware_nowait(THIS_MODULE, true, cur->path,
+- fwctx->dev, GFP_KERNEL, fwctx,
+- brcmf_fw_request_done);
+- else
+- ret = request_firmware(&fw, cur->path, fwctx->dev);
+-
+- if (ret < 0) {
+- brcmf_fw_request_done(NULL, fwctx);
+- } else if (!async && fw) {
+- brcmf_fw_complete_request(fw, fwctx);
+- return -EAGAIN;
+- }
+- return 0;
+-}
+-
+ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+ {
+ struct brcmf_fw *fwctx = ctx;
+@@ -568,26 +541,19 @@ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+ cur = &fwctx->req->items[fwctx->curpos];
+
+ ret = brcmf_fw_complete_request(fw, fwctx);
+- if (ret < 0)
+- goto fail;
+-
+- do {
+- if (++fwctx->curpos == fwctx->req->n_items) {
+- ret = 0;
+- goto done;
+- }
+
+- ret = brcmf_fw_request_next_item(fwctx, false);
+- } while (ret == -EAGAIN);
+-
+- return;
++ while (ret == 0 && ++fwctx->curpos < fwctx->req->n_items) {
++ cur = &fwctx->req->items[fwctx->curpos];
++ request_firmware(&fw, cur->path, fwctx->dev);
++ ret = brcmf_fw_complete_request(fw, ctx);
++ }
+
+-fail:
+- brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret,
+- dev_name(fwctx->dev), cur->path);
+- brcmf_fw_free_request(fwctx->req);
+- fwctx->req = NULL;
+-done:
++ if (ret) {
++ brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret,
++ dev_name(fwctx->dev), cur->path);
++ brcmf_fw_free_request(fwctx->req);
++ fwctx->req = NULL;
++ }
+ fwctx->done(fwctx->dev, ret, fwctx->req);
+ kfree(fwctx);
+ }
+@@ -611,7 +577,9 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
+ void (*fw_cb)(struct device *dev, int err,
+ struct brcmf_fw_request *req))
+ {
++ struct brcmf_fw_item *first = &req->items[0];
+ struct brcmf_fw *fwctx;
++ int ret;
+
+ brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
+ if (!fw_cb)
+@@ -628,7 +596,12 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
+ fwctx->req = req;
+ fwctx->done = fw_cb;
+
+- brcmf_fw_request_next_item(fwctx, true);
++ ret = request_firmware_nowait(THIS_MODULE, true, first->path,
++ fwctx->dev, GFP_KERNEL, fwctx,
++ brcmf_fw_request_done);
++ if (ret < 0)
++ brcmf_fw_request_done(NULL, fwctx);
++
+ return 0;
+ }
+
+--
+2.20.1
+
diff --git a/patches.drivers/0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch b/patches.drivers/0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch
new file mode 100644
index 0000000000..8b09b8b96e
--- /dev/null
+++ b/patches.drivers/0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch
@@ -0,0 +1,87 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:01:00 +0200
+Subject: brcmfmac: Add support for first trying to get a board specific nvram
+ file
+Git-commit: eae8e50669e15002b195177212a6e25afbe7cf4d
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+The nvram files which some brcmfmac chips need are board-specific. To be
+able to distribute these as part of linux-firmware, so that devices with
+such a wifi chip will work OOTB, multiple (one per board) versions must
+co-exist under /lib/firmware.
+
+This commit adds support for callers of the brcmfmac/firmware.c code to
+pass in a board_type parameter through the request structure.
+
+If that parameter is set then the code will first try to load
+chipmodel.board_type.txt before falling back to the old chipmodel.txt name.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/firmware.c | 27 ++++++++++++++++++-
+ .../broadcom/brcm80211/brcmfmac/firmware.h | 1 +
+ 2 files changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index 08aaf99fee34..6755b2388fbc 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -532,6 +532,31 @@ static int brcmf_fw_complete_request(const struct firmware *fw,
+ return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret;
+ }
+
++static int brcmf_fw_request_firmware(const struct firmware **fw,
++ struct brcmf_fw *fwctx)
++{
++ struct brcmf_fw_item *cur = &fwctx->req->items[fwctx->curpos];
++ int ret;
++
++ /* nvram files are board-specific, first try a board-specific path */
++ if (cur->type == BRCMF_FW_TYPE_NVRAM && fwctx->req->board_type) {
++ char alt_path[BRCMF_FW_NAME_LEN];
++
++ strlcpy(alt_path, cur->path, BRCMF_FW_NAME_LEN);
++ /* strip .txt at the end */
++ alt_path[strlen(alt_path) - 4] = 0;
++ strlcat(alt_path, ".", BRCMF_FW_NAME_LEN);
++ strlcat(alt_path, fwctx->req->board_type, BRCMF_FW_NAME_LEN);
++ strlcat(alt_path, ".txt", BRCMF_FW_NAME_LEN);
++
++ ret = request_firmware(fw, alt_path, fwctx->dev);
++ if (ret == 0)
++ return ret;
++ }
++
++ return request_firmware(fw, cur->path, fwctx->dev);
++}
++
+ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+ {
+ struct brcmf_fw *fwctx = ctx;
+@@ -544,7 +569,7 @@ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+
+ while (ret == 0 && ++fwctx->curpos < fwctx->req->n_items) {
+ cur = &fwctx->req->items[fwctx->curpos];
+- request_firmware(&fw, cur->path, fwctx->dev);
++ brcmf_fw_request_firmware(&fw, fwctx);
+ ret = brcmf_fw_complete_request(fw, ctx);
+ }
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
+index 2893e56910f0..a0834be8864e 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
+@@ -70,6 +70,7 @@ struct brcmf_fw_request {
+ u16 domain_nr;
+ u16 bus_nr;
+ u32 n_items;
++ const char *board_type;
+ struct brcmf_fw_item items[0];
+ };
+
+--
+2.20.1
+
diff --git a/patches.drivers/0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch b/patches.drivers/0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch
new file mode 100644
index 0000000000..ff42c5694e
--- /dev/null
+++ b/patches.drivers/0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch
@@ -0,0 +1,91 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:01:01 +0200
+Subject: brcmfmac: Set board_type used for nvram file selection to
+ machine-compatible
+Git-commit: 0ad4b55b2f29784f93875e6231bf57cd233624a2
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+For of/devicetree using machines, set the board_type used for nvram file
+selection to the first string listed in the top-level's node compatible
+string, aka the machine-compatible as used by of_machine_is_compatible().
+
+The board_type setting is used to load the board-specific nvram file with
+a board-specific name so that we can ship files for each supported board
+in linux-firmware.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../net/wireless/broadcom/brcm80211/brcmfmac/common.h | 1 +
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 11 ++++++++++-
+ .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 +
+ .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
+ 4 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+index a34642cb4d2f..e63a273642e9 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+@@ -59,6 +59,7 @@ struct brcmf_mp_device {
+ bool iapp;
+ bool ignore_probe_fail;
+ struct brcmfmac_pd_cc *country_codes;
++ const char *board_type;
+ union {
+ struct brcmfmac_sdio_pd sdio;
+ } bus;
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+index aee6e5937c41..84e3373289eb 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
+ struct brcmf_mp_device *settings)
+ {
+ struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
+- struct device_node *np = dev->of_node;
++ struct device_node *root, *np = dev->of_node;
++ struct property *prop;
+ int irq;
+ u32 irqf;
+ u32 val;
+
++ /* Set board-type to the first string of the machine compatible prop */
++ root = of_find_node_by_path("/");
++ if (root) {
++ prop = of_find_property(root, "compatible", NULL);
++ settings->board_type = of_prop_next_string(prop, NULL);
++ of_node_put(root);
++ }
++
+ if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
+ !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
+ return;
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+index 5dea569d63ed..956a8b236836 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo)
+ fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
+ fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
+ fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL;
++ fwreq->board_type = devinfo->settings->board_type;
+ /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */
+ fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1;
+ fwreq->bus_nr = devinfo->pdev->bus->number;
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+index b2e1ab5adb64..22646a3b911e 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -4174,6 +4174,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus)
+
+ fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
+ fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
++ fwreq->board_type = bus->sdiodev->settings->board_type;
+
+ return fwreq;
+ }
+--
+2.20.1
+
diff --git a/patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch b/patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch
new file mode 100644
index 0000000000..50e42a9387
--- /dev/null
+++ b/patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch
@@ -0,0 +1,194 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:01:02 +0200
+Subject: brcmfmac: Set board_type from DMI on x86 based machines
+Git-commit: bd1e82bb420adf4ad7cd468d8a482cde622dd69d
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+For x86 based machines, set the board_type used for nvram file selection
+based on the DMI sys-vendor and product-name strings.
+
+Since on some models these strings are too generic, this commit also adds
+a quirk table overriding the strings for models listed in that table.
+
+The board_type setting is used to load the board-specific nvram file with
+a board-specific name so that we can ship files for each supported board
+in linux-firmware.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/Makefile | 2 +
+ .../broadcom/brcm80211/brcmfmac/common.c | 3 +-
+ .../broadcom/brcm80211/brcmfmac/common.h | 7 ++
+ .../broadcom/brcm80211/brcmfmac/dmi.c | 116 ++++++++++++++++++
+ 4 files changed, 127 insertions(+), 1 deletion(-)
+ create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
+index 1f5a9b948abf..22fd95a736a8 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
+@@ -54,3 +54,5 @@ brcmfmac-$(CONFIG_BRCM_TRACING) += \
+ tracepoint.o
+ brcmfmac-$(CONFIG_OF) += \
+ of.o
++brcmfmac-$(CONFIG_DMI) += \
++ dmi.o
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+index 94044a7a6021..d52774c6489b 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+@@ -448,8 +448,9 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
+ }
+ }
+ if (!found) {
+- /* No platform data for this device, try OF (Open Firwmare) */
++ /* No platform data for this device, try OF and DMI data */
+ brcmf_of_probe(dev, bus_type, settings);
++ brcmf_dmi_probe(settings, chip, chiprev);
+ }
+ return settings;
+ }
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+index e63a273642e9..4ce56be90b74 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+@@ -75,4 +75,11 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param);
+ /* Sets dongle media info (drv_version, mac address). */
+ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
+
++#ifdef CONFIG_DMI
++void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev);
++#else
++static inline void
++brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {}
++#endif
++
+ #endif /* BRCMFMAC_COMMON_H */
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+new file mode 100644
+index 000000000000..51d76ac45075
+--- /dev/null
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+@@ -0,0 +1,116 @@
++/*
++ * Copyright 2018 Hans de Goede <hdegoede@redhat.com>
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
++ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <linux/dmi.h>
++#include <linux/mod_devicetable.h>
++#include "core.h"
++#include "common.h"
++#include "brcm_hw_ids.h"
++
++/* The DMI data never changes so we can use a static buf for this */
++static char dmi_board_type[128];
++
++struct brcmf_dmi_data {
++ u32 chip;
++ u32 chiprev;
++ const char *board_type;
++};
++
++/* NOTE: Please keep all entries sorted alphabetically */
++
++static const struct brcmf_dmi_data gpd_win_pocket_data = {
++ BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket"
++};
++
++static const struct brcmf_dmi_data jumper_ezpad_mini3_data = {
++ BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3"
++};
++
++static const struct brcmf_dmi_data meegopad_t08_data = {
++ BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08"
++};
++
++static const struct dmi_system_id dmi_platform_data[] = {
++ {
++ /* Match for the GPDwin which unfortunately uses somewhat
++ * generic dmi strings, which is why we test for 4 strings.
++ * Comparing against 23 other byt/cht boards, board_vendor
++ * and board_name are unique to the GPDwin, where as only one
++ * other board has the same board_serial and 3 others have
++ * the same default product_name. Also the GPDwin is the
++ * only device to have both board_ and product_name not set.
++ */
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
++ DMI_MATCH(DMI_BOARD_NAME, "Default string"),
++ DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
++ },
++ .driver_data = (void *)&gpd_win_pocket_data,
++ },
++ {
++ /* Jumper EZpad mini3 */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),
++ /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
++ DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
++ },
++ .driver_data = (void *)&jumper_ezpad_mini3_data,
++ },
++ {
++ /* Meegopad T08 */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "Default string"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
++ DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
++ DMI_MATCH(DMI_BOARD_VERSION, "V1.1"),
++ },
++ .driver_data = (void *)&meegopad_t08_data,
++ },
++ {}
++};
++
++void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev)
++{
++ const struct dmi_system_id *match;
++ const struct brcmf_dmi_data *data;
++ const char *sys_vendor;
++ const char *product_name;
++
++ /* Some models have DMI strings which are too generic, e.g.
++ * "Default string", we use a quirk table for these.
++ */
++ for (match = dmi_first_match(dmi_platform_data);
++ match;
++ match = dmi_first_match(match + 1)) {
++ data = match->driver_data;
++
++ if (data->chip == chip && data->chiprev == chiprev) {
++ settings->board_type = data->board_type;
++ return;
++ }
++ }
++
++ /* Not found in the quirk-table, use sys_vendor-product_name */
++ sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
++ product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
++ if (sys_vendor && product_name) {
++ snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s",
++ sys_vendor, product_name);
++ settings->board_type = dmi_board_type;
++ }
++}
+--
+2.20.1
+
diff --git a/patches.drivers/0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch b/patches.drivers/0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch
new file mode 100644
index 0000000000..4b5b7129a4
--- /dev/null
+++ b/patches.drivers/0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch
@@ -0,0 +1,49 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:01:03 +0200
+Subject: brcmfmac: Cleanup brcmf_fw_request_done()
+Git-commit: 55e491edbf14b2da5419c2a319ea3b1d6368d9a2
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+The "cur" variable is now only used for a debug print and we already
+print the same info from brcmf_fw_complete_request(), so the debug print
+does not provide any extra info and we can remove it.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index 6755b2388fbc..b38c4b40b235 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -560,22 +560,16 @@ static int brcmf_fw_request_firmware(const struct firmware **fw,
+ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+ {
+ struct brcmf_fw *fwctx = ctx;
+- struct brcmf_fw_item *cur;
+- int ret = 0;
+-
+- cur = &fwctx->req->items[fwctx->curpos];
++ int ret;
+
+ ret = brcmf_fw_complete_request(fw, fwctx);
+
+ while (ret == 0 && ++fwctx->curpos < fwctx->req->n_items) {
+- cur = &fwctx->req->items[fwctx->curpos];
+ brcmf_fw_request_firmware(&fw, fwctx);
+ ret = brcmf_fw_complete_request(fw, ctx);
+ }
+
+ if (ret) {
+- brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret,
+- dev_name(fwctx->dev), cur->path);
+ brcmf_fw_free_request(fwctx->req);
+ fwctx->req = NULL;
+ }
+--
+2.20.1
+
diff --git a/patches.drivers/0007-brcmfmac-Add-support-for-getting-nvram-contents-from.patch b/patches.drivers/0007-brcmfmac-Add-support-for-getting-nvram-contents-from.patch
new file mode 100644
index 0000000000..b013085768
--- /dev/null
+++ b/patches.drivers/0007-brcmfmac-Add-support-for-getting-nvram-contents-from.patch
@@ -0,0 +1,139 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Thu, 11 Oct 2018 11:51:06 +0200
+Subject: brcmfmac: Add support for getting nvram contents from EFI variables
+Git-commit: ce2e6db554fad444fa0b3904fc3015336e0ef765
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+Various X86 laptops with a SDIO attached brcmfmac wifi chip, store the
+nvram contents in a special EFI variable. This commit adds support for
+getting nvram directly from this EFI variable, without the user needing
+to manually copy it.
+
+This makes Wifi / Bluetooth work out of the box on these devices instead of
+requiring manual setup.
+
+This has been tested on the following models: Acer Iconia Tab8 w1-810,
+Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a
+Lenovo Mixx 2 8.
+
+Tested-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/firmware.c | 63 +++++++++++++++++--
+ 1 file changed, 57 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index b38c4b40b235..965ae5c24c2d 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -14,6 +14,7 @@
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#include <linux/efi.h>
+ #include <linux/kernel.h>
+ #include <linux/slab.h>
+ #include <linux/device.h>
+@@ -445,6 +446,51 @@ struct brcmf_fw {
+
+ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx);
+
++#ifdef CONFIG_EFI
++static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
++{
++ const u16 name[] = { 'n', 'v', 'r', 'a', 'm', 0 };
++ struct efivar_entry *nvram_efivar;
++ unsigned long data_len = 0;
++ u8 *data = NULL;
++ int err;
++
++ nvram_efivar = kzalloc(sizeof(*nvram_efivar), GFP_KERNEL);
++ if (!nvram_efivar)
++ return NULL;
++
++ memcpy(&nvram_efivar->var.VariableName, name, sizeof(name));
++ nvram_efivar->var.VendorGuid = EFI_GUID(0x74b00bd9, 0x805a, 0x4d61,
++ 0xb5, 0x1f, 0x43, 0x26,
++ 0x81, 0x23, 0xd1, 0x13);
++
++ err = efivar_entry_size(nvram_efivar, &data_len);
++ if (err)
++ goto fail;
++
++ data = kmalloc(data_len, GFP_KERNEL);
++ if (!data)
++ goto fail;
++
++ err = efivar_entry_get(nvram_efivar, NULL, &data_len, data);
++ if (err)
++ goto fail;
++
++ brcmf_info("Using nvram EFI variable\n");
++
++ kfree(nvram_efivar);
++ *data_len_ret = data_len;
++ return data;
++
++fail:
++ kfree(data);
++ kfree(nvram_efivar);
++ return NULL;
++}
++#else
++static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
++#endif
++
+ static void brcmf_fw_free_request(struct brcmf_fw_request *req)
+ {
+ struct brcmf_fw_item *item;
+@@ -463,11 +509,12 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
+ {
+ struct brcmf_fw *fwctx = ctx;
+ struct brcmf_fw_item *cur;
++ bool free_bcm47xx_nvram = false;
++ bool kfree_nvram = false;
+ u32 nvram_length = 0;
+ void *nvram = NULL;
+ u8 *data = NULL;
+ size_t data_len;
+- bool raw_nvram;
+
+ brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
+
+@@ -476,12 +523,13 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
+ if (fw && fw->data) {
+ data = (u8 *)fw->data;
+ data_len = fw->size;
+- raw_nvram = false;
+ } else {
+- data = bcm47xx_nvram_get_contents(&data_len);
+- if (!data && !(cur->flags & BRCMF_FW_REQF_OPTIONAL))
++ if ((data = bcm47xx_nvram_get_contents(&data_len)))
++ free_bcm47xx_nvram = true;
++ else if ((data = brcmf_fw_nvram_from_efi(&data_len)))
++ kfree_nvram = true;
++ else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL))
+ goto fail;
+- raw_nvram = true;
+ }
+
+ if (data)
+@@ -489,8 +537,11 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
+ fwctx->req->domain_nr,
+ fwctx->req->bus_nr);
+
+- if (raw_nvram)
++ if (free_bcm47xx_nvram)
+ bcm47xx_nvram_release_contents(data);
++ if (kfree_nvram)
++ kfree(data);
++
+ release_firmware(fw);
+ if (!nvram && !(cur->flags & BRCMF_FW_REQF_OPTIONAL))
+ goto fail;
+--
+2.20.1
+
diff --git a/patches.drivers/0008-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch b/patches.drivers/0008-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch
new file mode 100644
index 0000000000..06d1e99d1a
--- /dev/null
+++ b/patches.drivers/0008-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch
@@ -0,0 +1,105 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Thu, 11 Oct 2018 11:51:07 +0200
+Subject: brcmfmac: Fix ccode from EFI nvram when necessary
+Git-commit: 29ec3394f0bd85c22674ab6693d92da5e2324610
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+In some cases the EFI-var stored nvram contains "ccode=ALL" or "ccode=XV"
+to specify "worldwide" compatible settings, but these 2 ccode-s do not work
+properly.
+
+I've tested the different known "worldwide" ccode-s used in various nvram
+sources with the latest firmwares from linux-firmware for various brcmfmac
+models, here is a simplified (*) table with what each setting results in:
+
+ALL: 12-14 disab, U-NII-1, U-NII-2 no-IR/radar, U-NII-3
+XV: 12-14 no-IR, disables all 5G channels
+XY: 12-13 enab, 14 disab, U-NII-1 enab, U-NII-2 no-IR/radar, U-NII-3 disab
+X2: 12-13 no-IR, 14 dis, U-NII-1 no-IR, U-NII-2 no-IR/radar, U-NII-3 no-IR
+
+Where 12,13,14 are 2.4G channels 12-14 and U-NII-1/2/3 are the 3 different
+5G channel groups. no-IR is no-Initiate-Radiation, we will never send on
+these channels without first having received valid wifi traffic there.
+
+This immediately shows that both ALL and XV are not as worldwide as we want
+them to be. ALL causes channels 12 and 13 to not be available and XV causes
+all 5GHz channels to not be available. Also ALL unconditionally enables the
+U-NII-1 and U-NII-3 5G groups, while we really should be using no-IR for
+these.
+
+This commit replace XV and ALL with X2, which allows usage of chan 12-13
+and 5G channels, but only after receiving valid wifi traffic there first.
+
+Note that this configure the firmware's channel limits, the kernels own
+regulatory restrictions based on e.g. regulatory info received from the
+access-point, will be applied on top of this.
+
+This fixes channels 12+13 not working on the Asus T200TA and the Lenovo
+Mixx 2 8 and 5G channels not working on the Asus T100HA.
+
+This has been tested on the following models: Acer Iconia Tab8 w1-810,
+Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a
+Lenovo Mixx 2 8.
+
+*) There are some exceptions to this table:
+1) On really old firmware e.g. linux-firmware's 2011 brcmfmac4330-sdio.bin
+ ALL really means all, unconditionally enabling everything
+2) The exact meaning might be influenced by setting the regrev nvram var.
+ Specifically using ccode=XV + regrev=1 on brcmfmac43241b4 leads to:
+ 12-14 no-ir, U-NII-1 no-ir, U-NII-2 no-ir/radar, U-NII-3 no-ir
+ But only on the brcmfmac43241b4 and not on e.g. the brcmfmac43340
+
+Tested-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/firmware.c | 24 +++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index 965ae5c24c2d..72d8c0c3c3a1 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -447,6 +447,29 @@ struct brcmf_fw {
+ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx);
+
+ #ifdef CONFIG_EFI
++/* In some cases the EFI-var stored nvram contains "ccode=ALL" or "ccode=XV"
++ * to specify "worldwide" compatible settings, but these 2 ccode-s do not work
++ * properly. "ccode=ALL" causes channels 12 and 13 to not be available,
++ * "ccode=XV" causes all 5GHz channels to not be available. So we replace both
++ * with "ccode=X2" which allows channels 12+13 and 5Ghz channels in
++ * no-Initiate-Radiation mode. This means that we will never send on these
++ * channels without first having received valid wifi traffic on the channel.
++ */
++static void brcmf_fw_fix_efi_nvram_ccode(char *data, unsigned long data_len)
++{
++ char *ccode;
++
++ ccode = strnstr((char *)data, "ccode=ALL", data_len);
++ if (!ccode)
++ ccode = strnstr((char *)data, "ccode=XV\r", data_len);
++ if (!ccode)
++ return;
++
++ ccode[6] = 'X';
++ ccode[7] = '2';
++ ccode[8] = '\r';
++}
++
+ static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
+ {
+ const u16 name[] = { 'n', 'v', 'r', 'a', 'm', 0 };
+@@ -476,6 +499,7 @@ static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
+ if (err)
+ goto fail;
+
++ brcmf_fw_fix_efi_nvram_ccode(data, data_len);
+ brcmf_info("Using nvram EFI variable\n");
+
+ kfree(nvram_efivar);
+--
+2.20.1
+
diff --git a/patches.drivers/brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch b/patches.drivers/brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch
new file mode 100644
index 0000000000..3cbe63408c
--- /dev/null
+++ b/patches.drivers/brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch
@@ -0,0 +1,47 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Fri, 23 Nov 2018 10:11:48 +0100
+Subject: brcmfmac: Call brcmf_dmi_probe before brcmf_of_probe
+Git-commit: 554da3868eb1d7174710c18b4ddd6ff01f6d612c
+Patch-mainline: v5.0
+References: fate#326215
+
+ARM systems with UEFI may have both devicetree (of) and DMI data in this
+case we end up setting brcmf_mp_device.board_type twice.
+
+In this case we should prefer the devicetree data, because:
+1) The devicerree data is more reliable
+2) Some ARM systems (e.g. the Raspberry Pi 3 models) support both UEFI and
+ classic uboot booting, the devicetree data is always there, so using it
+ makes sure we ask for the same nvram file independent of how we booted.
+
+This commit moves the brcmf_dmi_probe call to before the brcmf_of_probe
+call, so that the latter can override the value of the first if both are
+set.
+
+Fixes: bd1e82bb420a ("brcmfmac: Set board_type from DMI on x86 based ...")
+Cc: Peter Robinson <pbrobinson@gmail.com>
+Tested-and-reported-by: Peter Robinson <pbrobinson@gmail.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+index e738112ed87c..1f1e95a15a17 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+@@ -449,8 +449,8 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
+ }
+ if (!found) {
+ /* No platform data for this device, try OF and DMI data */
+- brcmf_of_probe(dev, bus_type, settings);
+ brcmf_dmi_probe(settings, chip, chiprev);
++ brcmf_of_probe(dev, bus_type, settings);
+ }
+ return settings;
+ }
+--
+2.20.1
+
diff --git a/patches.drivers/brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch b/patches.drivers/brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch
new file mode 100644
index 0000000000..71787ce883
--- /dev/null
+++ b/patches.drivers/brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch
@@ -0,0 +1,42 @@
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 10 Dec 2018 21:55:37 +0100
+Subject: brcmfmac: fix false-positive -Wmaybe-unintialized warning
+Git-commit: 412dd15c8177d93abe0c8787b83b31c5eb061405
+Patch-mainline: v5.0
+References: fate#326215
+
+When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
+for the brcmf_fw_request_nvram_done() function, after gcc figures
+out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
+variable, but fails to notice that it always returns NULL:
+
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+Mark it 'inline' to force gcc to understand this.
+
+Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index dad3c1c79038..14b948917a1a 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -512,7 +512,7 @@ static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
+ return NULL;
+ }
+ #else
+-static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
++static inline u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
+ #endif
+
+ static void brcmf_fw_free_request(struct brcmf_fw_request *req)
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 200540d95b..59d75f902c 100644
--- a/series.conf
+++ b/series.conf
@@ -41793,6 +41793,14 @@
patches.drivers/bnx2x-Add-MBI-version-to-ethtool-driver-query-output.patch
patches.drivers/bnx2x-Add-storm-FW-version-to-ethtool-driver-query-o.patch
patches.drivers/can-flexcan-flexcan_irq-fix-indention.patch
+ patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch
+ patches.drivers/0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch
+ patches.drivers/0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch
+ patches.drivers/0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch
+ patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch
+ patches.drivers/0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch
+ patches.drivers/0007-brcmfmac-Add-support-for-getting-nvram-contents-from.patch
+ patches.drivers/0008-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch
patches.drivers/wlcore-Fix-the-return-value-in-case-of-error-in-wlco.patch
patches.drivers/rtl8xxxu-Fix-missing-break-in-switch.patch
patches.drivers/wireless-airo-potential-buffer-overflow-in-sprintf.patch
@@ -42051,6 +42059,8 @@
patches.fixes/0001-fbdev-fbmem-behave-better-with-small-rotated-display.patch
patches.fixes/0001-fbdev-fbcon-Fix-unregister-crash-when-more-than-one-.patch
patches.suse/mm-page_alloc-do-not-wake-kswapd-with-zone-lock-held.patch
+ patches.drivers/brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch
+ patches.drivers/brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch
# dhowells/linux-fs keys-uefi
patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch