Message ID | 20240412095713.25641-1-hao.qin@mediatek.com |
---|---|
State | New |
Headers | show |
Series | Bluetooth: btusb: mediatek: Support auto revert for MT7922 | expand |
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 >
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 >
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.");
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(-)