linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: support download nvm with different board id for wcn6855
@ 2020-12-01  2:59 Zijun Hu
  2020-12-01  4:03 ` [v1] " bluez.test.bot
  2020-12-02  1:51 ` [PATCH v1] " Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: Zijun Hu @ 2020-12-01  2:59 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: linux-kernel, linux-bluetooth, linux-arm-msm, bgodavar, c-hbandi,
	hemantg, mka, rjliao, zijuhu, tjiang

From: Tim Jiang <tjiang@codeaurora.org>

we define many nvm files for wcn6855 btsoc and host driver
should find the correct nvm file based on board ID and then
download it.

Signed-off-by: Tim Jiang <tjiang@codeaurora.org>
---
 drivers/bluetooth/btusb.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 3bbe8f43e7fa..66e19085e0fa 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3474,7 +3474,8 @@ struct qca_version {
 	__le32	rom_version;
 	__le32	patch_version;
 	__le32	ram_version;
-	__le32	ref_clock;
+	__u16	board_id;
+	__u8	flag[2];
 	__u8	reserved[4];
 } __packed;
 
@@ -3657,8 +3658,13 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
 	char fwname[64];
 	int err;
 
-	snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin",
-		 le32_to_cpu(ver->rom_version));
+	if (ver->flag[1] == 0x80) { //check board id for wcn6855
+		snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x_%04x.bin",
+			le32_to_cpu(ver->rom_version), le16_to_cpu(ver->board_id));
+	} else {
+		snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin",
+			le32_to_cpu(ver->rom_version));
+	}
 
 	err = request_firmware(&fw, fwname, &hdev->dev);
 	if (err) {
@@ -3725,6 +3731,11 @@ static int btusb_setup_qca(struct hci_dev *hdev)
 			return err;
 	}
 
+	err = btusb_qca_send_vendor_req(udev, QCA_GET_TARGET_VERSION, &ver,
+					sizeof(ver));
+	if (err < 0)
+		return err;
+
 	if (!(status & QCA_SYSCFG_UPDATED)) {
 		err = btusb_setup_qca_load_nvm(hdev, &ver, info);
 		if (err < 0)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [v1] Bluetooth: support download nvm with different board id for wcn6855
  2020-12-01  2:59 [PATCH v1] Bluetooth: support download nvm with different board id for wcn6855 Zijun Hu
@ 2020-12-01  4:03 ` bluez.test.bot
  2020-12-02  1:51 ` [PATCH v1] " Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2020-12-01  4:03 UTC (permalink / raw)
  To: linux-bluetooth, zijuhu

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=393653

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuildK - PASS



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] Bluetooth: support download nvm with different board id for wcn6855
  2020-12-01  2:59 [PATCH v1] Bluetooth: support download nvm with different board id for wcn6855 Zijun Hu
  2020-12-01  4:03 ` [v1] " bluez.test.bot
@ 2020-12-02  1:51 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2020-12-02  1:51 UTC (permalink / raw)
  To: Zijun Hu
  Cc: marcel, johan.hedberg, linux-kernel, linux-bluetooth,
	linux-arm-msm, bgodavar, c-hbandi, hemantg, mka, rjliao, tjiang

On Mon 30 Nov 20:59 CST 2020, Zijun Hu wrote:

> From: Tim Jiang <tjiang@codeaurora.org>
> 
> we define many nvm files for wcn6855 btsoc and host driver
> should find the correct nvm file based on board ID and then
> download it.
> 
> Signed-off-by: Tim Jiang <tjiang@codeaurora.org>
> ---
>  drivers/bluetooth/btusb.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 3bbe8f43e7fa..66e19085e0fa 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3474,7 +3474,8 @@ struct qca_version {
>  	__le32	rom_version;
>  	__le32	patch_version;
>  	__le32	ram_version;
> -	__le32	ref_clock;
> +	__u16	board_id;

You should follow the scheme of describing the endianess of the fields.

> +	__u8	flag[2];

It seems more reasonable to make this a 16-bit flags. And either way
there are more than one of these, so plural "flags" seems appropriate.


PS. Can you confirm that no firmware actually used these 16 bits of the
"ref_clock"? Why wasn't the reserved bytes used to add the new
properties?

>  	__u8	reserved[4];
>  } __packed;
>  
> @@ -3657,8 +3658,13 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
>  	char fwname[64];
>  	int err;
>  
> -	snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin",
> -		 le32_to_cpu(ver->rom_version));
> +	if (ver->flag[1] == 0x80) { //check board id for wcn6855

Is this BIT(7) in the second byte of the flags, or is the second flag
0x80?

Based on the comment you should be able to provide a

#define QCA_VERSION_SECOND_FLAG_IS_WCN6855 0x80

to use instead of this magic number.

Regards,
Bjorn

> +		snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x_%04x.bin",
> +			le32_to_cpu(ver->rom_version), le16_to_cpu(ver->board_id));
> +	} else {
> +		snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin",
> +			le32_to_cpu(ver->rom_version));
> +	}
>  
>  	err = request_firmware(&fw, fwname, &hdev->dev);
>  	if (err) {
> @@ -3725,6 +3731,11 @@ static int btusb_setup_qca(struct hci_dev *hdev)
>  			return err;
>  	}
>  
> +	err = btusb_qca_send_vendor_req(udev, QCA_GET_TARGET_VERSION, &ver,
> +					sizeof(ver));
> +	if (err < 0)
> +		return err;
> +
>  	if (!(status & QCA_SYSCFG_UPDATED)) {
>  		err = btusb_setup_qca_load_nvm(hdev, &ver, info);
>  		if (err < 0)
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-02  1:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-01  2:59 [PATCH v1] Bluetooth: support download nvm with different board id for wcn6855 Zijun Hu
2020-12-01  4:03 ` [v1] " bluez.test.bot
2020-12-02  1:51 ` [PATCH v1] " Bjorn Andersson

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