All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: mediatek: Support auto revert for MT7922
@ 2024-04-12  9:57 Hao Qin
  2024-04-12 10:32 ` bluez.test.bot
  2024-04-17 21:17 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 4+ messages in thread
From: Hao Qin @ 2024-04-12  9:57 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
  Cc: Sean Wang, Deren Wu, Aaron Hou, Chris Lu, Steve Lee,
	linux-bluetooth, linux-kernel, linux-mediatek, Hao Qin

Add support for auto reverting MT7922 during reset process.

Signed-off-by: Hao Qin <hao.qin@mediatek.com>
---
 drivers/bluetooth/btusb.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4c0cc13adb47..0ad96ec8d31d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3032,7 +3032,16 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
 	usb_kill_anchored_urbs(&data->tx_anchor);
 	mediatek = hci_get_priv(hdev);
 
-	if (mediatek->dev_id == 0x7925) {
+	if (mediatek->dev_id == 0x7922) {
+		btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
+		val |= 0x00002020;
+		btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
+		btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, 0x00010001);
+		btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
+		val |= BIT(0);
+		btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
+		msleep(100);
+	} else if (mediatek->dev_id == 0x7925) {
 		btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
 		val |= (1 << 5);
 		btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
@@ -3072,6 +3081,9 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
 	if (err < 0)
 		bt_dev_err(hdev, "Reset timeout");
 
+	if (mediatek->dev_id == 0x7922)
+		btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
+
 	btusb_mtk_id_get(data, 0x70010200, &val);
 	if (!val)
 		bt_dev_err(hdev, "Can't get device id, subsys reset fail.");
-- 
2.18.0


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

* RE: Bluetooth: btusb: mediatek: Support auto revert for MT7922
  2024-04-12  9:57 [PATCH] Bluetooth: btusb: mediatek: Support auto revert for MT7922 Hao Qin
@ 2024-04-12 10:32 ` bluez.test.bot
  2024-04-17 21:17 ` [PATCH] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-04-12 10:32 UTC (permalink / raw)
  To: linux-bluetooth, hao.qin

[-- Attachment #1: Type: text/plain, Size: 2580 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=843968

---Test result---

Test Summary:
CheckPatch                    PASS      0.65 seconds
GitLint                       PASS      0.30 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   PASS      30.20 seconds
CheckAllWarning               PASS      32.67 seconds
CheckSparse                   PASS      37.98 seconds
CheckSmatch                   FAIL      34.57 seconds
BuildKernel32                 PASS      28.89 seconds
TestRunnerSetup               PASS      520.17 seconds
TestRunner_l2cap-tester       PASS      18.41 seconds
TestRunner_iso-tester         PASS      31.10 seconds
TestRunner_bnep-tester        PASS      4.85 seconds
TestRunner_mgmt-tester        FAIL      111.40 seconds
TestRunner_rfcomm-tester      PASS      7.44 seconds
TestRunner_sco-tester         PASS      15.13 seconds
TestRunner_ioctl-tester       PASS      7.83 seconds
TestRunner_mesh-tester        PASS      6.05 seconds
TestRunner_smp-tester         PASS      6.88 seconds
TestRunner_userchan-tester    PASS      6.20 seconds
IncrementalBuild              PASS      28.97 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2

Failed Test Cases
LL Privacy - Remove Device 4 (Disable Adv)           Timed out    1.886 seconds


---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: btusb: mediatek: Support auto revert for MT7922
  2024-04-12  9:57 [PATCH] Bluetooth: btusb: mediatek: Support auto revert for MT7922 Hao Qin
  2024-04-12 10:32 ` bluez.test.bot
@ 2024-04-17 21:17 ` Luiz Augusto von Dentz
  2024-05-07 19:29   ` Sean Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-17 21:17 UTC (permalink / raw)
  To: Hao Qin
  Cc: Marcel Holtmann, Johan Hedberg, Sean Wang, Deren Wu, Aaron Hou,
	Chris Lu, Steve Lee, linux-bluetooth, linux-kernel,
	linux-mediatek

Hi,

On Fri, Apr 12, 2024 at 5:57 AM Hao Qin <hao.qin@mediatek.com> wrote:
>
> Add support for auto reverting MT7922 during reset process.

Need some more information of what auto reverting means in this
context and what problem does it solves?

>
> Signed-off-by: Hao Qin <hao.qin@mediatek.com>
> ---
>  drivers/bluetooth/btusb.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 4c0cc13adb47..0ad96ec8d31d 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3032,7 +3032,16 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
>         usb_kill_anchored_urbs(&data->tx_anchor);
>         mediatek = hci_get_priv(hdev);
>
> -       if (mediatek->dev_id == 0x7925) {
> +       if (mediatek->dev_id == 0x7922) {
> +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> +               val |= 0x00002020;
> +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> +               btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, 0x00010001);
> +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> +               val |= BIT(0);
> +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> +               msleep(100);
> +       } else if (mediatek->dev_id == 0x7925) {
>                 btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
>                 val |= (1 << 5);
>                 btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
> @@ -3072,6 +3081,9 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
>         if (err < 0)
>                 bt_dev_err(hdev, "Reset timeout");
>
> +       if (mediatek->dev_id == 0x7922)
> +               btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
> +
>         btusb_mtk_id_get(data, 0x70010200, &val);
>         if (!val)
>                 bt_dev_err(hdev, "Can't get device id, subsys reset fail.");
> --
> 2.18.0
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH] Bluetooth: btusb: mediatek: Support auto revert for MT7922
  2024-04-17 21:17 ` [PATCH] " Luiz Augusto von Dentz
@ 2024-05-07 19:29   ` Sean Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Wang @ 2024-05-07 19:29 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Hao Qin, Marcel Holtmann, Johan Hedberg, Sean Wang, Deren Wu,
	Aaron Hou, Chris Lu, Steve Lee, linux-bluetooth, linux-kernel,
	linux-mediatek

Hi Luiz,

Please disregard the patch. We will proceed with the journey using the
latest patchset I provided in the following link
https://lists.infradead.org/pipermail/linux-mediatek/2024-May/079017.html

                 Sean

On Wed, Apr 17, 2024 at 2:18 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi,
>
> On Fri, Apr 12, 2024 at 5:57 AM Hao Qin <hao.qin@mediatek.com> wrote:
> >
> > Add support for auto reverting MT7922 during reset process.
>
> Need some more information of what auto reverting means in this
> context and what problem does it solves?
>
> >
> > Signed-off-by: Hao Qin <hao.qin@mediatek.com>
> > ---
> >  drivers/bluetooth/btusb.c | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> > index 4c0cc13adb47..0ad96ec8d31d 100644
> > --- a/drivers/bluetooth/btusb.c
> > +++ b/drivers/bluetooth/btusb.c
> > @@ -3032,7 +3032,16 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
> >         usb_kill_anchored_urbs(&data->tx_anchor);
> >         mediatek = hci_get_priv(hdev);
> >
> > -       if (mediatek->dev_id == 0x7925) {
> > +       if (mediatek->dev_id == 0x7922) {
> > +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> > +               val |= 0x00002020;
> > +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> > +               btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, 0x00010001);
> > +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> > +               val |= BIT(0);
> > +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> > +               msleep(100);
> > +       } else if (mediatek->dev_id == 0x7925) {
> >                 btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
> >                 val |= (1 << 5);
> >                 btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
> > @@ -3072,6 +3081,9 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
> >         if (err < 0)
> >                 bt_dev_err(hdev, "Reset timeout");
> >
> > +       if (mediatek->dev_id == 0x7922)
> > +               btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
> > +
> >         btusb_mtk_id_get(data, 0x70010200, &val);
> >         if (!val)
> >                 bt_dev_err(hdev, "Can't get device id, subsys reset fail.");
> > --
> > 2.18.0
> >
>
>
> --
> Luiz Augusto von Dentz
>

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

end of thread, other threads:[~2024-05-07 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12  9:57 [PATCH] Bluetooth: btusb: mediatek: Support auto revert for MT7922 Hao Qin
2024-04-12 10:32 ` bluez.test.bot
2024-04-17 21:17 ` [PATCH] " Luiz Augusto von Dentz
2024-05-07 19:29   ` Sean Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.