linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long
@ 2022-05-12 21:38 sean.wang
  2022-05-12 21:38 ` [PATCH 2/2] Bluetooth: btmtksdio: fix possible FW initialization failure sean.wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sean.wang @ 2022-05-12 21:38 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
	ted.huang, Eric.Liang, Stella.Chang, Tom.Chou, steve.lee, jsiuda,
	frankgor, abhishekpandit, michaelfsun, mcchou, shawnku,
	linux-bluetooth, linux-mediatek, linux-kernel, Yake Yang

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

Sending WMT command during the reset in progress is invalid and would get
no response from firmware until the reset is complete, so we ignore the WMT
command here to resolve the issue which causes the whole reset process
taking too long.

Fixes: 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism")
Co-developed-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btmtksdio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 4ae6631a7c29..26e27fd79a21 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1189,6 +1189,10 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 	 */
 	pm_runtime_get_sync(bdev->dev);
 
+	/* wmt command only works until the reset is complete */
+	if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state))
+		goto ignore_wmt_cmd;
+
 	/* Disable the device */
 	wmt_params.op = BTMTK_WMT_FUNC_CTRL;
 	wmt_params.flag = 0;
@@ -1202,6 +1206,7 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 		return err;
 	}
 
+ignore_wmt_cmd:
 	pm_runtime_put_noidle(bdev->dev);
 	pm_runtime_disable(bdev->dev);
 
-- 
2.25.1


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

* [PATCH 2/2] Bluetooth: btmtksdio: fix possible FW initialization failure
  2022-05-12 21:38 [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long sean.wang
@ 2022-05-12 21:38 ` sean.wang
  2022-05-13 11:21 ` [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long patchwork-bot+bluetooth
  2022-05-13 14:41 ` AngeloGioacchino Del Regno
  2 siblings, 0 replies; 4+ messages in thread
From: sean.wang @ 2022-05-12 21:38 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
	ted.huang, Eric.Liang, Stella.Chang, Tom.Chou, steve.lee, jsiuda,
	frankgor, abhishekpandit, michaelfsun, mcchou, shawnku,
	linux-bluetooth, linux-mediatek, linux-kernel, Yake Yang

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

According to FW advised sequence, mt7921s need to re-acquire privilege
immediately after the firmware download is complete before normal running.
Otherwise, it is still possible the bus may be stuck in an abnormal status
that causes FW initialization failure in the current driver.

Fixes: 752aea58489f ("Bluetooth: mt7921s: fix bus hang with wrong privilege")
Co-developed-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btmtksdio.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 26e27fd79a21..d6700efcfe8c 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -864,6 +864,14 @@ static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)
 		return err;
 	}
 
+	err = btmtksdio_fw_pmctrl(bdev);
+	if (err < 0)
+		return err;
+
+	err = btmtksdio_drv_pmctrl(bdev);
+	if (err < 0)
+		return err;
+
 	/* Enable Bluetooth protocol */
 	wmt_params.op = BTMTK_WMT_FUNC_CTRL;
 	wmt_params.flag = 0;
@@ -1109,14 +1117,6 @@ static int btmtksdio_setup(struct hci_dev *hdev)
 		if (err < 0)
 			return err;
 
-		err = btmtksdio_fw_pmctrl(bdev);
-		if (err < 0)
-			return err;
-
-		err = btmtksdio_drv_pmctrl(bdev);
-		if (err < 0)
-			return err;
-
 		/* Enable SCO over I2S/PCM */
 		err = btmtksdio_sco_setting(hdev);
 		if (err < 0) {
-- 
2.25.1


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

* Re: [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long
  2022-05-12 21:38 [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long sean.wang
  2022-05-12 21:38 ` [PATCH 2/2] Bluetooth: btmtksdio: fix possible FW initialization failure sean.wang
@ 2022-05-13 11:21 ` patchwork-bot+bluetooth
  2022-05-13 14:41 ` AngeloGioacchino Del Regno
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2022-05-13 11:21 UTC (permalink / raw)
  To: Sean Wang
  Cc: marcel, johan.hedberg, Soul.Huang, YN.Chen, Leon.Yen,
	Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
	posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
	steve.lee, jsiuda, frankgor, abhishekpandit, michaelfsun, mcchou,
	shawnku, linux-bluetooth, linux-mediatek, linux-kernel,
	yake.yang

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:

On Fri, 13 May 2022 05:38:11 +0800 you wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Sending WMT command during the reset in progress is invalid and would get
> no response from firmware until the reset is complete, so we ignore the WMT
> command here to resolve the issue which causes the whole reset process
> taking too long.
> 
> [...]

Here is the summary with links:
  - [1/2] Bluetooth: btmtksdio: fix the reset takes too long
    https://git.kernel.org/bluetooth/bluetooth-next/c/baabb7f530e8
  - [2/2] Bluetooth: btmtksdio: fix possible FW initialization failure
    https://git.kernel.org/bluetooth/bluetooth-next/c/7469720563e0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long
  2022-05-12 21:38 [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long sean.wang
  2022-05-12 21:38 ` [PATCH 2/2] Bluetooth: btmtksdio: fix possible FW initialization failure sean.wang
  2022-05-13 11:21 ` [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long patchwork-bot+bluetooth
@ 2022-05-13 14:41 ` AngeloGioacchino Del Regno
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-05-13 14:41 UTC (permalink / raw)
  To: sean.wang, marcel, johan.hedberg
  Cc: Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
	robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang, Eric.Liang,
	Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor,
	abhishekpandit, michaelfsun, mcchou, shawnku, linux-bluetooth,
	linux-mediatek, linux-kernel, Yake Yang

Il 12/05/22 23:38, sean.wang@mediatek.com ha scritto:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Sending WMT command during the reset in progress is invalid and would get
> no response from firmware until the reset is complete, so we ignore the WMT
> command here to resolve the issue which causes the whole reset process
> taking too long.
> 
> Fixes: 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism")
> Co-developed-by: Yake Yang <yake.yang@mediatek.com>
> Signed-off-by: Yake Yang <yake.yang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

It may be too late but, in any case, for the entire series:

Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


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

end of thread, other threads:[~2022-05-13 14:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 21:38 [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long sean.wang
2022-05-12 21:38 ` [PATCH 2/2] Bluetooth: btmtksdio: fix possible FW initialization failure sean.wang
2022-05-13 11:21 ` [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long patchwork-bot+bluetooth
2022-05-13 14:41 ` AngeloGioacchino Del Regno

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