Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-13 Thread Kalle Valo
Chung-Hsien Hsu  writes:

> On Fri, Nov 10, 2017 at 08:15:19AM +0200, Kalle Valo wrote:
>> Wright Feng  writes:
>> 
>> > From: Chung-Hsien Hsu 
>> >
>> > The firmware for brcmfmac devices includes information regarding
>> > regulatory constraints. For certain devices this information is kept
>> > separately in a binary form that needs to be downloaded to the device.
>> > This patch adds support to download this so-called CLM blob file. It
>> > uses the same naming scheme as the other firmware files with extension
>> > of .clm_blob.
>> >
>> > The CLM blob file is optional. If the file does not exist, the download
>> > process will be bypassed. It will not affect the driver loading.
>> >
>> > Signed-off-by: Chung-Hsien Hsu 
>> 
>> [...]
>> 
>> > +  err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf));
>> > +  if (err) {
>> > +  if (err == -23) {
>> 
>> No magic numbers, please. Is this supposed to be -ENFILE?
>
> It indicates "Unsupported". I will remove it since it will not affect
> the CLM downlaod and driver loading.

BTW you would not have to remove it, adding a define would have been
just fine. (I was travelling, hence the late reply.)

-- 
Kalle Valo


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-10 Thread Chung-Hsien Hsu
On Fri, Nov 10, 2017 at 08:15:19AM +0200, Kalle Valo wrote:
> Wright Feng  writes:
> 
> > From: Chung-Hsien Hsu 
> >
> > The firmware for brcmfmac devices includes information regarding
> > regulatory constraints. For certain devices this information is kept
> > separately in a binary form that needs to be downloaded to the device.
> > This patch adds support to download this so-called CLM blob file. It
> > uses the same naming scheme as the other firmware files with extension
> > of .clm_blob.
> >
> > The CLM blob file is optional. If the file does not exist, the download
> > process will be bypassed. It will not affect the driver loading.
> >
> > Signed-off-by: Chung-Hsien Hsu 
> 
> [...]
> 
> > +   err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf));
> > +   if (err) {
> > +   if (err == -23) {
> 
> No magic numbers, please. Is this supposed to be -ENFILE?

It indicates "Unsupported". I will remove it since it will not affect
the CLM downlaod and driver loading.

Regards,
Chung-Hsien 

> 
> -- 
> Kalle Valo


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-09 Thread Kalle Valo
Chung-Hsien Hsu  writes:

> On Fri, Nov 03, 2017 at 03:40:45PM +0200, Kalle Valo wrote:
>> Chung-Hsien Hsu  writes:
>> 
>> > On Fri, Nov 03, 2017 at 10:20:07AM +0100, Arend van Spriel wrote:
>> >> On 03-11-17 09:27, Chung-Hsien Hsu wrote:
>> >> >On Thu, Oct 05, 2017 at 03:31:18PM +0800, Wright Feng wrote:
>> >> >>From: Chung-Hsien Hsu 
>> >> >>
>> >> >>The firmware for brcmfmac devices includes information regarding
>> >> >>regulatory constraints. For certain devices this information is kept
>> >> >>separately in a binary form that needs to be downloaded to the device.
>> >> >>This patch adds support to download this so-called CLM blob file. It
>> >> >>uses the same naming scheme as the other firmware files with extension
>> >> >>of .clm_blob.
>> >> >>
>> >> >>The CLM blob file is optional. If the file does not exist, the download
>> >> >>process will be bypassed. It will not affect the driver loading.
>> >> >>
>> >> >>Signed-off-by: Chung-Hsien Hsu 
>> >> >>---
>> >> >>v2: Revise commit message to describe in more detail
>> >> >>v3: Add error handling in brcmf_c_get_clm_name function
>> >> >>v4: Correct the length of dload_buf in brcmf_c_download function
>> >> >>v5: Remove unnecessary cast and alignment
>> >> >>v6: Add debug log for the case of no CLM file present
>> >> >>---
>> >> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
>> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 
>> >> >> +
>> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
>> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
>> >> >>  .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
>> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
>> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
>> >> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
>> >> >>  8 files changed, 263 insertions(+)
>> >> >
>> >> >Any comments or feedback about this? I'm hoping to have it in v4.15.
>> 
>> This might not necessary make it to v4.15, it depends if Linus releases
>> the final v4.14 on Sunday or not.
>
> Since the final v4.14 was not released last Sunday, is it possible to get 
> this to v4.15?

Thanks for reminding, apparently I had forgotten to change the state of
the patch from Deferred to New. But unfortunately the patch failed to
apply so you need to rebase and submit v7.

-- 
Kalle Valo


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-09 Thread Kalle Valo
Wright Feng  writes:

> From: Chung-Hsien Hsu 
>
> The firmware for brcmfmac devices includes information regarding
> regulatory constraints. For certain devices this information is kept
> separately in a binary form that needs to be downloaded to the device.
> This patch adds support to download this so-called CLM blob file. It
> uses the same naming scheme as the other firmware files with extension
> of .clm_blob.
>
> The CLM blob file is optional. If the file does not exist, the download
> process will be bypassed. It will not affect the driver loading.
>
> Signed-off-by: Chung-Hsien Hsu 

[...]

> + err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf));
> + if (err) {
> + if (err == -23) {

No magic numbers, please. Is this supposed to be -ENFILE?

-- 
Kalle Valo


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-09 Thread Chung-Hsien Hsu
On Fri, Nov 03, 2017 at 03:40:45PM +0200, Kalle Valo wrote:
> Chung-Hsien Hsu  writes:
> 
> > On Fri, Nov 03, 2017 at 10:20:07AM +0100, Arend van Spriel wrote:
> >> On 03-11-17 09:27, Chung-Hsien Hsu wrote:
> >> >On Thu, Oct 05, 2017 at 03:31:18PM +0800, Wright Feng wrote:
> >> >>From: Chung-Hsien Hsu 
> >> >>
> >> >>The firmware for brcmfmac devices includes information regarding
> >> >>regulatory constraints. For certain devices this information is kept
> >> >>separately in a binary form that needs to be downloaded to the device.
> >> >>This patch adds support to download this so-called CLM blob file. It
> >> >>uses the same naming scheme as the other firmware files with extension
> >> >>of .clm_blob.
> >> >>
> >> >>The CLM blob file is optional. If the file does not exist, the download
> >> >>process will be bypassed. It will not affect the driver loading.
> >> >>
> >> >>Signed-off-by: Chung-Hsien Hsu 
> >> >>---
> >> >>v2: Revise commit message to describe in more detail
> >> >>v3: Add error handling in brcmf_c_get_clm_name function
> >> >>v4: Correct the length of dload_buf in brcmf_c_download function
> >> >>v5: Remove unnecessary cast and alignment
> >> >>v6: Add debug log for the case of no CLM file present
> >> >>---
> >> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 
> >> >> +
> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
> >> >>  .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
> >> >>  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
> >> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
> >> >>  8 files changed, 263 insertions(+)
> >> >
> >> >Any comments or feedback about this? I'm hoping to have it in v4.15.
> 
> This might not necessary make it to v4.15, it depends if Linus releases
> the final v4.14 on Sunday or not.

Since the final v4.14 was not released last Sunday, is it possible to get this 
to v4.15?

> 
> >> Sorry for not following up. The change log for v6 made me wonder if
> >> all my comments on v5 were addressed. I just checked and it looks
> >> fine to me. Kalle has set this patch to Deferred state in patchwork
> >> maybe awaiting my response.
> 
> Yup, I was waiting your comments.
> 
> >> I already gave my "Reviewed-by:" on v5 so you may add that for v6,
> >> but I am sure Kalle can do that.
> >> 
> >> Regards,
> >> Arend
> >
> > Hi Arend,
> >
> > Thanks for the confirmation and quick reply. How can I know the state of
> > a patch, e.g., a patch is set to Deferred state?
> 
> I have documented this in the wiki:
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#checking_state_of_patches_from_patchwork
> 
> > Could you please help to add Arend's "Reviewed-by:" on v6? Or should I
> > add it and resend v6?
> 
> Sure, I can add it. No need to resend.
> 
> And actually Arend should be able to add the tag automatically by
> replying to the patch with his tag, patchwork would then pick it up and
> add it when I apply the patch. To my knowledge patchwork supports
> Acked-by, Reviewed-by and Tested-by tags.

Thanks for the info.

Regards,
Chung-Hsien

> 
> -- 
> Kalle Valo


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-06 Thread Arend van Spriel

On 10/5/2017 9:31 AM, Wright Feng wrote:

From: Chung-Hsien Hsu 

The firmware for brcmfmac devices includes information regarding
regulatory constraints. For certain devices this information is kept
separately in a binary form that needs to be downloaded to the device.
This patch adds support to download this so-called CLM blob file. It
uses the same naming scheme as the other firmware files with extension
of .clm_blob.

The CLM blob file is optional. If the file does not exist, the download
process will be bypassed. It will not affect the driver loading.


Reviewed-by: Arend van Spriel 

Signed-off-by: Chung-Hsien Hsu 
---
v2: Revise commit message to describe in more detail
v3: Add error handling in brcmf_c_get_clm_name function
v4: Correct the length of dload_buf in brcmf_c_download function
v5: Remove unnecessary cast and alignment
v6: Add debug log for the case of no CLM file present
---




Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-03 Thread Kalle Valo
Chung-Hsien Hsu  writes:

> On Fri, Nov 03, 2017 at 10:20:07AM +0100, Arend van Spriel wrote:
>> On 03-11-17 09:27, Chung-Hsien Hsu wrote:
>> >On Thu, Oct 05, 2017 at 03:31:18PM +0800, Wright Feng wrote:
>> >>From: Chung-Hsien Hsu 
>> >>
>> >>The firmware for brcmfmac devices includes information regarding
>> >>regulatory constraints. For certain devices this information is kept
>> >>separately in a binary form that needs to be downloaded to the device.
>> >>This patch adds support to download this so-called CLM blob file. It
>> >>uses the same naming scheme as the other firmware files with extension
>> >>of .clm_blob.
>> >>
>> >>The CLM blob file is optional. If the file does not exist, the download
>> >>process will be bypassed. It will not affect the driver loading.
>> >>
>> >>Signed-off-by: Chung-Hsien Hsu 
>> >>---
>> >>v2: Revise commit message to describe in more detail
>> >>v3: Add error handling in brcmf_c_get_clm_name function
>> >>v4: Correct the length of dload_buf in brcmf_c_download function
>> >>v5: Remove unnecessary cast and alignment
>> >>v6: Add debug log for the case of no CLM file present
>> >>---
>> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
>> >>  .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 
>> >> +
>> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
>> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
>> >>  .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
>> >>  .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
>> >>  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
>> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
>> >>  8 files changed, 263 insertions(+)
>> >
>> >Any comments or feedback about this? I'm hoping to have it in v4.15.

This might not necessary make it to v4.15, it depends if Linus releases
the final v4.14 on Sunday or not.

>> Sorry for not following up. The change log for v6 made me wonder if
>> all my comments on v5 were addressed. I just checked and it looks
>> fine to me. Kalle has set this patch to Deferred state in patchwork
>> maybe awaiting my response.

Yup, I was waiting your comments.

>> I already gave my "Reviewed-by:" on v5 so you may add that for v6,
>> but I am sure Kalle can do that.
>> 
>> Regards,
>> Arend
>
> Hi Arend,
>
> Thanks for the confirmation and quick reply. How can I know the state of
> a patch, e.g., a patch is set to Deferred state?

I have documented this in the wiki:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#checking_state_of_patches_from_patchwork

> Could you please help to add Arend's "Reviewed-by:" on v6? Or should I
> add it and resend v6?

Sure, I can add it. No need to resend.

And actually Arend should be able to add the tag automatically by
replying to the patch with his tag, patchwork would then pick it up and
add it when I apply the patch. To my knowledge patchwork supports
Acked-by, Reviewed-by and Tested-by tags.

-- 
Kalle Valo


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-03 Thread Chung-Hsien Hsu
On Fri, Nov 03, 2017 at 10:20:07AM +0100, Arend van Spriel wrote:
> On 03-11-17 09:27, Chung-Hsien Hsu wrote:
> >On Thu, Oct 05, 2017 at 03:31:18PM +0800, Wright Feng wrote:
> >>From: Chung-Hsien Hsu 
> >>
> >>The firmware for brcmfmac devices includes information regarding
> >>regulatory constraints. For certain devices this information is kept
> >>separately in a binary form that needs to be downloaded to the device.
> >>This patch adds support to download this so-called CLM blob file. It
> >>uses the same naming scheme as the other firmware files with extension
> >>of .clm_blob.
> >>
> >>The CLM blob file is optional. If the file does not exist, the download
> >>process will be bypassed. It will not affect the driver loading.
> >>
> >>Signed-off-by: Chung-Hsien Hsu 
> >>---
> >>v2: Revise commit message to describe in more detail
> >>v3: Add error handling in brcmf_c_get_clm_name function
> >>v4: Correct the length of dload_buf in brcmf_c_download function
> >>v5: Remove unnecessary cast and alignment
> >>v6: Add debug log for the case of no CLM file present
> >>---
> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
> >>  .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 
> >> +
> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
> >>  .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
> >>  .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
> >>  .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
> >>  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
> >>  .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
> >>  8 files changed, 263 insertions(+)
> >
> >Any comments or feedback about this? I'm hoping to have it in v4.15.
> 
> Hi Chung-Hsien,
> 
> Sorry for not following up. The change log for v6 made me wonder if
> all my comments on v5 were addressed. I just checked and it looks
> fine to me. Kalle has set this patch to Deferred state in patchwork
> maybe awaiting my response. I already gave my "Reviewed-by:" on v5
> so you may add that for v6, but I am sure Kalle can do that.
> 
> Regards,
> Arend

Hi Arend,

Thanks for the confirmation and quick reply. How can I know the state of
a patch, e.g., a patch is set to Deferred state?


Hi Kalle,

Could you please help to add Arend's "Reviewed-by:" on v6? Or should I
add it and resend v6?

Regards,
Chung-Hsien


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-03 Thread Arend van Spriel

On 03-11-17 09:27, Chung-Hsien Hsu wrote:

On Thu, Oct 05, 2017 at 03:31:18PM +0800, Wright Feng wrote:

From: Chung-Hsien Hsu 

The firmware for brcmfmac devices includes information regarding
regulatory constraints. For certain devices this information is kept
separately in a binary form that needs to be downloaded to the device.
This patch adds support to download this so-called CLM blob file. It
uses the same naming scheme as the other firmware files with extension
of .clm_blob.

The CLM blob file is optional. If the file does not exist, the download
process will be bypassed. It will not affect the driver loading.

Signed-off-by: Chung-Hsien Hsu 
---
v2: Revise commit message to describe in more detail
v3: Add error handling in brcmf_c_get_clm_name function
v4: Correct the length of dload_buf in brcmf_c_download function
v5: Remove unnecessary cast and alignment
v6: Add debug log for the case of no CLM file present
---
  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
  .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 +
  .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
  .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
  .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
  .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
  .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
  8 files changed, 263 insertions(+)


Any comments or feedback about this? I'm hoping to have it in v4.15.


Hi Chung-Hsien,

Sorry for not following up. The change log for v6 made me wonder if all 
my comments on v5 were addressed. I just checked and it looks fine to 
me. Kalle has set this patch to Deferred state in patchwork maybe 
awaiting my response. I already gave my "Reviewed-by:" on v5 so you may 
add that for v6, but I am sure Kalle can do that.


Regards,
Arend


Re: [PATCH v6] brcmfmac: add CLM download support

2017-11-03 Thread Chung-Hsien Hsu
On Thu, Oct 05, 2017 at 03:31:18PM +0800, Wright Feng wrote:
> From: Chung-Hsien Hsu 
> 
> The firmware for brcmfmac devices includes information regarding
> regulatory constraints. For certain devices this information is kept
> separately in a binary form that needs to be downloaded to the device.
> This patch adds support to download this so-called CLM blob file. It
> uses the same naming scheme as the other firmware files with extension
> of .clm_blob.
> 
> The CLM blob file is optional. If the file does not exist, the download
> process will be bypassed. It will not affect the driver loading.
> 
> Signed-off-by: Chung-Hsien Hsu 
> ---
> v2: Revise commit message to describe in more detail
> v3: Add error handling in brcmf_c_get_clm_name function
> v4: Correct the length of dload_buf in brcmf_c_download function
> v5: Remove unnecessary cast and alignment
> v6: Add debug log for the case of no CLM file present
> ---
>  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
>  .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 
> +
>  .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
>  .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
>  .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
>  .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
>  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
>  .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
>  8 files changed, 263 insertions(+)

Any comments or feedback about this? I'm hoping to have it in v4.15.

Regards,
Chung-Hsien


[PATCH v6] brcmfmac: add CLM download support

2017-10-05 Thread Wright Feng
From: Chung-Hsien Hsu 

The firmware for brcmfmac devices includes information regarding
regulatory constraints. For certain devices this information is kept
separately in a binary form that needs to be downloaded to the device.
This patch adds support to download this so-called CLM blob file. It
uses the same naming scheme as the other firmware files with extension
of .clm_blob.

The CLM blob file is optional. If the file does not exist, the download
process will be bypassed. It will not affect the driver loading.

Signed-off-by: Chung-Hsien Hsu 
---
v2: Revise commit message to describe in more detail
v3: Add error handling in brcmf_c_get_clm_name function
v4: Correct the length of dload_buf in brcmf_c_download function
v5: Remove unnecessary cast and alignment
v6: Add debug log for the case of no CLM file present
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h |  10 ++
 .../wireless/broadcom/brcm80211/brcmfmac/common.c  | 162 +
 .../wireless/broadcom/brcm80211/brcmfmac/core.c|   2 +
 .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
 .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  31 
 .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|  19 +++
 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|  19 +++
 .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |  18 +++
 8 files changed, 263 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
index b55c329..df42e09 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
@@ -71,6 +71,7 @@ struct brcmf_bus_dcmd {
  * @wowl_config: specify if dongle is configured for wowl when going to suspend
  * @get_ramsize: obtain size of device memory.
  * @get_memdump: obtain device memory dump in provided buffer.
+ * @get_fwname: obtain firmware name.
  *
  * This structure provides an abstract interface towards the
  * bus specific driver. For control messages to common driver
@@ -87,6 +88,8 @@ struct brcmf_bus_ops {
void (*wowl_config)(struct device *dev, bool enabled);
size_t (*get_ramsize)(struct device *dev);
int (*get_memdump)(struct device *dev, void *data, size_t len);
+   int (*get_fwname)(struct device *dev, uint chip, uint chiprev,
+ unsigned char *fw_name);
 };
 
 
@@ -214,6 +217,13 @@ int brcmf_bus_get_memdump(struct brcmf_bus *bus, void 
*data, size_t len)
return bus->ops->get_memdump(bus->dev, data, len);
 }
 
+static inline
+int brcmf_bus_get_fwname(struct brcmf_bus *bus, uint chip, uint chiprev,
+unsigned char *fw_name)
+{
+   return bus->ops->get_fwname(bus->dev, chip, chiprev, fw_name);
+}
+
 /*
  * interface functions from common layer
  */
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 7a2b495..5397727 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "core.h"
@@ -28,6 +29,7 @@
 #include "tracepoint.h"
 #include "common.h"
 #include "of.h"
+#include "firmware.h"
 
 MODULE_AUTHOR("Broadcom Corporation");
 MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
@@ -104,12 +106,140 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
brcmf_err("Set join_pref error (%d)\n", err);
 }
 
+static int brcmf_c_download(struct brcmf_if *ifp, u16 flag,
+   struct brcmf_dload_data_le *dload_buf,
+   u32 len)
+{
+   s32 err;
+
+   flag |= (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT);
+   dload_buf->flag = cpu_to_le16(flag);
+   dload_buf->dload_type = cpu_to_le16(DL_TYPE_CLM);
+   dload_buf->len = cpu_to_le32(len);
+   dload_buf->crc = cpu_to_le32(0);
+   len = sizeof(*dload_buf) + len - 1;
+
+   err = brcmf_fil_iovar_data_set(ifp, "clmload", dload_buf, len);
+
+   return err;
+}
+
+static int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name)
+{
+   struct brcmf_bus *bus = ifp->drvr->bus_if;
+   struct brcmf_rev_info *ri = &ifp->drvr->revinfo;
+   u8 fw_name[BRCMF_FW_NAME_LEN];
+   u8 *ptr;
+   size_t len;
+   s32 err;
+
+   memset(fw_name, 0, BRCMF_FW_NAME_LEN);
+   err = brcmf_bus_get_fwname(bus, ri->chipnum, ri->chiprev, fw_name);
+   if (err) {
+   brcmf_err("get firmware name failed (%d)\n", err);
+   goto done;
+   }
+
+   /* generate CLM blob file name */
+   ptr = strrchr(fw_name, '.');
+   if (!ptr) {
+   err = -ENOENT;
+   goto done;
+   }
+
+   len = ptr - fw_name + 1;
+   if (len + strlen(".clm_blob") > BRCMF_FW_NAME_LEN) {
+   err = -E2BIG;
+