Commit 064aee50 authored by Hao Qin's avatar Hao Qin Committed by Luiz Augusto von Dentz

Bluetooth: btusb: mediatek: add MT7922 subsystem reset

Add the support of MT7922 bluetooth subsystem reset that was called the
auto revert to self-recover from the fatal error in the controller like
the host encounters HCI cmd timeout or the controller crashes.
Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarHao Qin <hao.qin@mediatek.com>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent ccfc8948
...@@ -3039,7 +3039,16 @@ static int btusb_mtk_subsys_reset(struct hci_dev *hdev, u32 dev_id) ...@@ -3039,7 +3039,16 @@ static int btusb_mtk_subsys_reset(struct hci_dev *hdev, u32 dev_id)
u32 val; u32 val;
int err; int err;
if (dev_id == 0x7925) { if (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 (dev_id == 0x7925) {
btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val); btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
val |= (1 << 5); val |= (1 << 5);
btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val); btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
...@@ -3079,6 +3088,9 @@ static int btusb_mtk_subsys_reset(struct hci_dev *hdev, u32 dev_id) ...@@ -3079,6 +3088,9 @@ static int btusb_mtk_subsys_reset(struct hci_dev *hdev, u32 dev_id)
if (err < 0) if (err < 0)
bt_dev_err(hdev, "Reset timeout"); bt_dev_err(hdev, "Reset timeout");
if (dev_id == 0x7922)
btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
btusb_mtk_id_get(data, 0x70010200, &val); btusb_mtk_id_get(data, 0x70010200, &val);
if (!val) if (!val)
bt_dev_err(hdev, "Can't get device id, subsys reset fail."); bt_dev_err(hdev, "Can't get device id, subsys reset fail.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment