diff mbox

[V2,1/7] brcmfmac: Add support for host platform NVRAM loading.

Message ID 1439708139-7527-2-git-send-email-arend@broadcom.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Arend van Spriel Aug. 16, 2015, 6:55 a.m. UTC
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(-)

Comments

Rafał Miłecki Aug. 19, 2015, 4:38 p.m. UTC | #1
On 16 August 2015 at 08:55, Arend van Spriel <arend@broadcom.com> wrote:
> 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?.

Well, you dropped unneeded change to the brcmf_nvram_handle_value
function, but you ignored the rest of my comments. Take a look at them
again please:
https://patchwork.kernel.org/patch/6767961/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel Aug. 19, 2015, 8:55 p.m. UTC | #2
On 08/19/2015 06:38 PM, Rafa? Mi?ecki wrote:
> On 16 August 2015 at 08:55, Arend van Spriel <arend@broadcom.com> wrote:
>> 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?.
>
> Well, you dropped unneeded change to the brcmf_nvram_handle_value
> function, but you ignored the rest of my comments. Take a look at them
> again please:
> https://patchwork.kernel.org/patch/6767961/

Kalle,

Can you remove this patch from the series and apply the rest. Just 
verified over here the remaining patches apply cleanly on 
wireless-drivers-next.

Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel Aug. 20, 2015, 7:50 p.m. UTC | #3
On 08/19/2015 10:55 PM, Arend van Spriel wrote:
> On 08/19/2015 06:38 PM, Rafa? Mi?ecki wrote:
>> On 16 August 2015 at 08:55, Arend van Spriel <arend@broadcom.com> wrote:
>>> 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?.
>>
>> Well, you dropped unneeded change to the brcmf_nvram_handle_value
>> function, but you ignored the rest of my comments. Take a look at them
>> again please:
>> https://patchwork.kernel.org/patch/6767961/
>
> Kalle,
>
> Can you remove this patch from the series and apply the rest. Just
> verified over here the remaining patches apply cleanly on
> wireless-drivers-next.

Hi Kalle,

Just drop this series. I will send a V3 shortly.

Regards,
Arend

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo Aug. 24, 2015, 7:28 p.m. UTC | #4
Arend van Spriel <arend@broadcom.com> writes:

>> Can you remove this patch from the series and apply the rest. Just
>> verified over here the remaining patches apply cleanly on
>> wireless-drivers-next.
>
> Hi Kalle,
>
> Just drop this series. I will send a V3 shortly.

Ok, v2 dropped.
diff mbox

Patch

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);