aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-06-08 15:17:35 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-06-08 15:17:35 +0000
commit1a91d9f5573086c6e0543bb3b63fa1a698021143 (patch)
treea0c8e9250c4fd18c885db68b3a64ce707415a1dc /package
parentbef1dcfa0878cf72a4dec5f4a404a25ebc632470 (diff)
downloadupstream-1a91d9f5573086c6e0543bb3b63fa1a698021143.tar.gz
upstream-1a91d9f5573086c6e0543bb3b63fa1a698021143.tar.bz2
upstream-1a91d9f5573086c6e0543bb3b63fa1a698021143.zip
mac80211: add brcmfmac patch reading NVRAM from platform
This allows e.g. BCM43602 to work out of box, without dumping a proper MTD partition to /lib/firmware/ NVRAM file. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45931 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch b/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
new file mode 100644
index 0000000000..dbfb1585ec
--- /dev/null
+++ b/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
@@ -0,0 +1,80 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Mon, 8 Jun 2015 16:59:31 +0200
+Subject: [PATCH] brcmfmac: use bcm47xx platform NVRAM as fallback
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+---
+
+--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
+@@ -19,6 +19,9 @@
+ #include <linux/device.h>
+ #include <linux/firmware.h>
+ #include <linux/module.h>
++#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
++#include <linux/bcm47xx_nvram.h>
++#endif
+
+ #include "debug.h"
+ #include "firmware.h"
+@@ -424,17 +427,42 @@ struct brcmf_fw {
+ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
+ {
+ struct brcmf_fw *fwctx = ctx;
++#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
++ const u8 *bcm47xx_nvram = NULL;
++ size_t bcm47xx_nvram_len;
++#endif
++ const u8 *data = NULL;
++ size_t data_len;
+ u32 nvram_length = 0;
+ void *nvram = NULL;
+
+ brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
+- if (!fw && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
++ if (fw) {
++ data = fw->data;
++ data_len = fw->size;
++ }
++#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
++ else {
++ bcm47xx_nvram = bcm47xx_nvram_get_contents(&bcm47xx_nvram_len);
++ if (bcm47xx_nvram) {
++ data = bcm47xx_nvram;
++ data_len = bcm47xx_nvram_len;
++ brcmf_err("Found platform NVRAM (%zu B)\n", data_len);
++ }
++ }
++#endif
++ if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
+ goto fail;
+
+- if (fw) {
+- nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
++ if (data) {
++ nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length,
+ fwctx->domain_nr, fwctx->bus_nr);
+- release_firmware(fw);
++ if (fw)
++ release_firmware(fw);
++#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
++ if (bcm47xx_nvram)
++ bcm47xx_nvram_release_contents(bcm47xx_nvram);
++#endif
+ if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
+ goto fail;
+ }
+--- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
++++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
+@@ -17,6 +17,8 @@
+ #ifndef BRCMFMAC_DEBUG_H
+ #define BRCMFMAC_DEBUG_H
+
++#include <linux/net.h>
++
+ /* message levels */
+ #define BRCMF_TRACE_VAL 0x00000002
+ #define BRCMF_INFO_VAL 0x00000004