From: Arend van Spriel <arend@broadcom.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
"Hante Meuleman" <meuleman@broadcom.com>,
"Rafał Miłecki" <zajec5@gmail.com>,
"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH V2 1/7] brcmfmac: Add support for host platform NVRAM loading.
Date: Sun, 16 Aug 2015 08:55:33 +0200 [thread overview]
Message-ID: <1439708139-7527-2-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1439708139-7527-1-git-send-email-arend@broadcom.com>
From: Hante Meuleman <meuleman@broadcom.com>
Host platforms such as routers supported by OpenWRT can
support NVRAM reading directly from internal NVRAM store.
With this patch the nvram load routines will fall back to
this method when there is no nvram file and support is
available in the kernel.
Cc: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
V2:
- addressed comments from Rafał.
---
drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 40 ++++++++++++++--------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
index 743f16b..1296bb1 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
@@ -19,6 +19,7 @@
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/module.h>
+#include <linux/bcm47xx_nvram.h>
#include "debug.h"
#include "firmware.h"
@@ -426,19 +427,34 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
struct brcmf_fw *fwctx = ctx;
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));
- if (!fw && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
- goto fail;
+ 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 && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
+ goto fail;
+ raw_nvram = true;
+ }
- 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 (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
- goto fail;
+ if (raw_nvram)
+ bcm47xx_nvram_release_contents(data);
}
+ if (fw)
+ release_firmware(fw);
+ if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
+ goto fail;
+
fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
kfree(fwctx);
return;
@@ -473,15 +489,9 @@ static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx)
if (!ret)
return;
- /* when nvram is optional call .done() callback here */
- if (fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL) {
- fwctx->done(fwctx->dev, fw, NULL, 0);
- kfree(fwctx);
- return;
- }
+ brcmf_fw_request_nvram_done(NULL, fwctx);
+ return;
- /* failed nvram request */
- release_firmware(fw);
fail:
brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
device_release_driver(fwctx->dev);
--
1.9.1
next prev parent reply other threads:[~2015-08-16 6:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-16 6:55 [PATCH V2 0/7] brcmfmac: nvram loading and code rework Arend van Spriel
2015-08-16 6:55 ` Arend van Spriel [this message]
2015-08-19 16:38 ` [PATCH V2 1/7] brcmfmac: Add support for host platform NVRAM loading Rafał Miłecki
2015-08-19 20:55 ` Arend van Spriel
2015-08-20 19:50 ` Arend van Spriel
2015-08-24 19:28 ` Kalle Valo
2015-08-16 6:55 ` [PATCH V2 2/7] brcmfmac: correct interface combination info Arend van Spriel
2015-08-19 21:49 ` Rafał Miłecki
2015-08-19 21:59 ` Arend van Spriel
2015-08-16 6:55 ` [PATCH V2 3/7] brcmfmac: Increase nr of supported flowrings Arend van Spriel
2015-08-19 21:56 ` Rafał Miłecki
2015-08-24 14:15 ` Arend van Spriel
2015-08-24 20:02 ` Rafał Miłecki
2015-08-29 8:13 ` Arend van Spriel
2015-08-29 9:38 ` Rafał Miłecki
2015-08-29 10:48 ` Arend van Spriel
2015-08-20 16:16 ` Rafał Miłecki
2015-08-20 16:39 ` Arend van Spriel
2015-08-16 6:55 ` [PATCH V2 4/7] brcmfmac: add debugfs entry for msgbuf statistics Arend van Spriel
2015-08-16 6:55 ` [PATCH V2 5/7] brcmfmac: make use of cfg80211_check_combinations() Arend van Spriel
2015-08-16 6:55 ` [PATCH V2 6/7] brcmfmac: block the correct flowring when backup queue overflow Arend van Spriel
2015-08-16 6:55 ` [PATCH V2 7/7] brcmfmac: bump highest event number for 4339 firmware Arend van Spriel
2015-08-16 15:10 ` [PATCH V2 0/7] brcmfmac: nvram loading and code rework Rafał Miłecki
2015-08-17 8:01 ` Arend van Spriel
2015-08-17 14:25 ` Rafał Miłecki
-- strict thread matches above, loose matches on Subject: below --
2015-07-10 18:31 [PATCH " Arend van Spriel
2015-07-10 18:31 ` [PATCH 1/7] brcmfmac: Add support for host platform NVRAM loading Arend van Spriel
2015-07-11 17:09 ` Rafał Miłecki
2015-08-19 21:21 ` [PATCH v2 " Arend van Spriel
2015-08-19 21:43 ` Arend van Spriel
2015-08-20 15:53 ` Rafał Miłecki
2015-08-20 16:06 ` Arend van Spriel
2015-08-20 16:21 ` Rafał Miłecki
2015-08-20 15:59 ` Rafał Miłecki
2015-08-20 16:14 ` Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439708139-7527-2-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=meuleman@broadcom.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).