linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence
@ 2020-06-19 17:52 sean.wang
  2020-06-19 17:52 ` [PATCH v2 2/2] Bluetooth: btmtksdio: " sean.wang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: sean.wang @ 2020-06-19 17:52 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: linux-bluetooth, linux-mediatek, linux-kernel, Sean Wang, Mark Chen

From: Sean Wang <sean.wang@mediatek.com>

Data RAM on the device have to be powered on before starting to download
the firmware.

v1->v2:
	rebased to bluetooth-next

Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btusb.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index c7cc8e594166..e42fdd625eb0 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2934,7 +2934,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname)
 	const u8 *fw_ptr;
 	size_t fw_size;
 	int err, dlen;
-	u8 flag;
+	u8 flag, param;
 
 	err = request_firmware(&fw, fwname, &hdev->dev);
 	if (err < 0) {
@@ -2942,6 +2942,20 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname)
 		return err;
 	}
 
+	/* Power on data RAM the firmware relies on. */
+	param = 1;
+	wmt_params.op = BTMTK_WMT_FUNC_CTRL;
+	wmt_params.flag = 3;
+	wmt_params.dlen = sizeof(param);
+	wmt_params.data = &param;
+	wmt_params.status = NULL;
+
+	err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params);
+	if (err < 0) {
+		bt_dev_err(hdev, "Failed to power on data RAM (%d)", err);
+		return err;
+	}
+
 	fw_ptr = fw->data;
 	fw_size = fw->size;
 
-- 
2.25.1

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

* [PATCH v2 2/2] Bluetooth: btmtksdio: fix up firmware download sequence
  2020-06-19 17:52 [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence sean.wang
@ 2020-06-19 17:52 ` sean.wang
  2020-06-23 12:38   ` Marcel Holtmann
  2020-06-22  7:15 ` [PATCH v2 1/2] Bluetooth: btusb: " Marcel Holtmann
  2020-06-23 12:38 ` Marcel Holtmann
  2 siblings, 1 reply; 7+ messages in thread
From: sean.wang @ 2020-06-19 17:52 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: linux-bluetooth, linux-mediatek, linux-kernel, Sean Wang, Mark Chen

From: Sean Wang <sean.wang@mediatek.com>

Data RAM on the device have to be powered on before starting to download
the firmware.

v1->v2:
	rebased to bluetooth-next

Fixes: 9aebfd4a2200 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices")
Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btmtksdio.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 519788c442ca..11494cd2a982 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -685,7 +685,7 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname)
 	const u8 *fw_ptr;
 	size_t fw_size;
 	int err, dlen;
-	u8 flag;
+	u8 flag, param;
 
 	err = request_firmware(&fw, fwname, &hdev->dev);
 	if (err < 0) {
@@ -693,6 +693,20 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname)
 		return err;
 	}
 
+	/* Power on data RAM the firmware relies on. */
+	param = 1;
+	wmt_params.op = MTK_WMT_FUNC_CTRL;
+	wmt_params.flag = 3;
+	wmt_params.dlen = sizeof(param);
+	wmt_params.data = &param;
+	wmt_params.status = NULL;
+
+	err = mtk_hci_wmt_sync(hdev, &wmt_params);
+	if (err < 0) {
+		bt_dev_err(hdev, "Failed to power on data RAM (%d)", err);
+		return err;
+	}
+
 	fw_ptr = fw->data;
 	fw_size = fw->size;
 
-- 
2.25.1

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

* Re: [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence
  2020-06-19 17:52 [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence sean.wang
  2020-06-19 17:52 ` [PATCH v2 2/2] Bluetooth: btmtksdio: " sean.wang
@ 2020-06-22  7:15 ` Marcel Holtmann
  2020-06-22 18:28   ` sean.wang
  2020-06-23 12:38 ` Marcel Holtmann
  2 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2020-06-22  7:15 UTC (permalink / raw)
  To: Sean Wang; +Cc: Johan Hedberg, BlueZ, linux-mediatek, open list, Mark Chen

Hi Sean,

> From: Sean Wang <sean.wang@mediatek.com>
> 
> Data RAM on the device have to be powered on before starting to download
> the firmware.
> 
> v1->v2:
> 	rebased to bluetooth-next
> 
> Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
> Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
> Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/bluetooth/btusb.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)

something is fishy here. git am still fails.

Regards

Marcel


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

* Re: [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence
  2020-06-22  7:15 ` [PATCH v2 1/2] Bluetooth: btusb: " Marcel Holtmann
@ 2020-06-22 18:28   ` sean.wang
  2020-06-23 12:38     ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: sean.wang @ 2020-06-22 18:28 UTC (permalink / raw)
  To: marcel
  Cc: johan.hedberg, Sean.Wang, linux-bluetooth, linux-mediatek,
	linux-kernel, Mark-YW.Chen, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

>Hi Sean,
>
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> Data RAM on the device have to be powered on before starting to
>> download the firmware.
>>
>> v1->v2:
>>	rebased to bluetooth-next
>>
>> Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for
>> MediaTek MT7668U USB devices")
>> Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
>> Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> ---
>> drivers/bluetooth/btusb.c | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>
>something is fishy here. git am still fails.
>

a little weird. I will try to git format-patch and send the patch again with another machine to you.

>Regards
>
>Marcel

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

* Re: [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence
  2020-06-22 18:28   ` sean.wang
@ 2020-06-23 12:38     ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2020-06-23 12:38 UTC (permalink / raw)
  To: Sean Wang
  Cc: Johan Hedberg, linux-bluetooth, linux-mediatek, linux-kernel,
	Mark-YW.Chen

Hi Sean,

>>> Data RAM on the device have to be powered on before starting to
>>> download the firmware.
>>> 
>>> v1->v2:
>>> 	rebased to bluetooth-next
>>> 
>>> Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for
>>> MediaTek MT7668U USB devices")
>>> Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
>>> Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
>>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>>> ---
>>> drivers/bluetooth/btusb.c | 16 +++++++++++++++-
>>> 1 file changed, 15 insertions(+), 1 deletion(-)
>> 
>> something is fishy here. git am still fails.
>> 
> 
> a little weird. I will try to git format-patch and send the patch again with another machine to you.

I think it is more important that you use git send-email to ensure that patch is delivered correctly. It looks like it got base64 encoded for no reason.

Regards

Marcel


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

* Re: [PATCH v2 2/2] Bluetooth: btmtksdio: fix up firmware download sequence
  2020-06-19 17:52 ` [PATCH v2 2/2] Bluetooth: btmtksdio: " sean.wang
@ 2020-06-23 12:38   ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2020-06-23 12:38 UTC (permalink / raw)
  To: Sean Wang
  Cc: Johan Hedberg, linux-bluetooth, linux-mediatek, linux-kernel, Mark Chen

Hi Sean,

> Data RAM on the device have to be powered on before starting to download
> the firmware.
> 
> v1->v2:
> 	rebased to bluetooth-next
> 
> Fixes: 9aebfd4a2200 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices")
> Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
> Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/bluetooth/btmtksdio.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence
  2020-06-19 17:52 [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence sean.wang
  2020-06-19 17:52 ` [PATCH v2 2/2] Bluetooth: btmtksdio: " sean.wang
  2020-06-22  7:15 ` [PATCH v2 1/2] Bluetooth: btusb: " Marcel Holtmann
@ 2020-06-23 12:38 ` Marcel Holtmann
  2 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2020-06-23 12:38 UTC (permalink / raw)
  To: Sean Wang; +Cc: Johan Hedberg, BlueZ, linux-mediatek, linux-kernel, Mark Chen

Hi Sean,

> Data RAM on the device have to be powered on before starting to download
> the firmware.
> 
> v1->v2:
> 	rebased to bluetooth-next
> 
> Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
> Co-developed-by: Mark Chen <Mark-YW.Chen@mediatek.com>
> Signed-off-by: Mark Chen <Mark-YW.Chen@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/bluetooth/btusb.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2020-06-23 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 17:52 [PATCH v2 1/2] Bluetooth: btusb: fix up firmware download sequence sean.wang
2020-06-19 17:52 ` [PATCH v2 2/2] Bluetooth: btmtksdio: " sean.wang
2020-06-23 12:38   ` Marcel Holtmann
2020-06-22  7:15 ` [PATCH v2 1/2] Bluetooth: btusb: " Marcel Holtmann
2020-06-22 18:28   ` sean.wang
2020-06-23 12:38     ` Marcel Holtmann
2020-06-23 12:38 ` Marcel Holtmann

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