mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: "\"Mark-YW Chen (陳揚文)\"" <Mark-YW.Chen@mediatek.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	chris.lu@mediatek.com, will-cy.lee@mediatek.com,
	Sean Wang <sean.wang@mediatek.com>,
	Bluetooth Kernel Mailing List  <linux-bluetooth@vger.kernel.org>,
	linux-mediatek@lists.infradead.org,
	open list <linux-kernel@vger.kernel.org>,
	michaelfsun@google.com, shawnku@google.com, jemele@google.com,
	apusaka@google.com
Subject: Re: [PATCH v4 2/2] Bluetooth: btusb: Support Bluetooth Reset for Mediatek Chip(MT7921)
Date: Thu, 22 Jul 2021 16:03:48 +0200	[thread overview]
Message-ID: <0FDB7895-4ABF-4975-AF61-FCFA86597254@holtmann.org> (raw)
In-Reply-To: <20210701194243.5449-2-mark-yw.chen@mediatek.com>

Hi Mark,

> When the firmware hang or command no response, driver can reset the
> bluetooth mcu via USB to recovery it. The reset steps as follows.
> 
> 1. Cancel USB transfer requests before reset.
> 2. It use speicific USB HW Register to reset Bluetooth MCU, at the
>   same time, the USB Endpoint0 still keep alive.
> 3. Poll the USB HW register until reset is completed by Endpoint0.
> 4. To recovery unexpected USB state and behavior during resetting the
>   Bluetooth MCU, the driver need to reset the USB device for MT7921.
> 5. After the reset is completed, the Bluetooth MCU need to re-setup,
>   such as download patch, power-on sequence and etc.
> 
> Signed-off-by: mark-yw.chen <mark-yw.chen@mediatek.com>
> ---
> drivers/bluetooth/btusb.c | 127 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 127 insertions(+)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index b1249b664981..122a928ebcb5 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3076,6 +3076,17 @@ static int btusb_shutdown_intel_new(struct hci_dev *hdev)
> 	return 0;
> }
> 
> +/* UHW CR mapping */
> +#define BT_MISC			0x70002510
> +#define BT_SUBSYS_RST		0x70002610
> +#define UDMA_INT_STA_BT		0x74000024
> +#define UDMA_INT_STA_BT1	0x74000308
> +#define BT_WDT_STATUS		0x740003A0
> +#define EP_RST_OPT		0x74011890
> +#define EP_RST_IN_OUT_OPT	0x00010001
> +#define BT_RST_DONE		0x00000100
> +#define BT_RESET_WAIT_MS	100
> +#define BT_RESET_NUM_TRIES	10

you need to prefix these with MTK since otherwise we get confused.

And we need to work towards abstracting the vendor specific position out of btusb.c (and I include the Intel part here as well). The btusb.c is getting overloaded with vendor stuff.

Regards

Marcel


       reply	other threads:[~2021-07-22 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210701194243.5449-1-mark-yw.chen@mediatek.com>
     [not found] ` <20210701194243.5449-2-mark-yw.chen@mediatek.com>
2021-07-22 14:03   ` Marcel Holtmann [this message]
2021-07-27 15:16     ` Mark-YW Chen (陳揚文)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0FDB7895-4ABF-4975-AF61-FCFA86597254@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=Mark-YW.Chen@mediatek.com \
    --cc=apusaka@google.com \
    --cc=chris.lu@mediatek.com \
    --cc=jemele@google.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=michaelfsun@google.com \
    --cc=sean.wang@mediatek.com \
    --cc=shawnku@google.com \
    --cc=will-cy.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®