mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>,
	nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com
Cc: Shayne Chen <shayne.chen@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>, Kalle Valo <kvalo@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Deren Wu <deren.wu@mediatek.com>,
	Leon Yen <Leon.Yen@mediatek.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] wifi: mt76: mt7921e: Perform FLR to recovery the device
Date: Wed, 14 Jun 2023 13:18:48 +0200	[thread overview]
Message-ID: <d9e3009b-1fd0-e81b-715e-d93c9343b55c@collabora.com> (raw)
In-Reply-To: <20230614063252.1650824-1-kai.heng.feng@canonical.com>

Il 14/06/23 08:32, Kai-Heng Feng ha scritto:
> When "Pre-boot WiFi" is enabled in BIOS, the mt7921e device may not
> work:
> mt7921e 0000:02:00.0: ASIC revision: 79220010
> mt7921e 0000:02:00.0: Message 00000010 (seq 1) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 2) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 3) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 4) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 5) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 6) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 7) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 8) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 9) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: Message 00000010 (seq 10) timeout
> mt7921e 0000:02:00.0: Failed to get patch semaphore
> mt7921e 0000:02:00.0: hardware init failed
> 
> After some trials and errors, it shows that PCI function level reset can
> recover the device back to a functional state.
> 
> So perform FLR at probe routine to workaround the issue.

Is there any way to check if the device was enabled before booting Linux?

I'm thinking of something like

if (device_is_already_enabled)
	ret = pci_reset_function_locked(....)

Regards,
Angelo

> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>   drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> index ddb1fa4ee01d..9671fbe35a8e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> @@ -262,6 +262,10 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
>   	int ret;
>   	u16 cmd;
>   
> +	ret = pci_reset_function_locked(pdev);
> +	if (ret)
> +		pci_info(pdev, "Unable to perform FLR\n");
> +
>   	ret = pcim_enable_device(pdev);
>   	if (ret)
>   		return ret;



  reply	other threads:[~2023-06-14 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14  6:32 Kai-Heng Feng
2023-06-14 11:18 ` AngeloGioacchino Del Regno [this message]
2023-06-16 14:17   ` Deren Wu (武德仁)

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=d9e3009b-1fd0-e81b-715e-d93c9343b55c@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Leon.Yen@mediatek.com \
    --cc=deren.wu@mediatek.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kvalo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@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®