linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: mt7921: continue to probe driver when fw already downloaded
@ 2021-07-08 13:17 Aaron Ma
  2021-07-08 15:08 ` Deren Wu
  2021-07-08 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Aaron Ma @ 2021-07-08 13:17 UTC (permalink / raw)
  To: aaron.ma, nbd, lorenzo.bianconi83, ryder.lee, kvalo, davem, kuba,
	matthias.bgg, sean.wang, Soul.Huang, deren.wu, linux-wireless,
	netdev, linux-mediatek, linux-kernel, linux-arm-kernel

When reboot system, no power cycles, firmware is already downloaded,
return -EIO will break driver as error:
mt7921e: probe of 0000:03:00.0 failed with error -5

Skip firmware download and continue to probe.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
---
 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
index c2c4dc196802..cd690c64f65b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
@@ -931,7 +931,7 @@ static int mt7921_load_firmware(struct mt7921_dev *dev)
 	ret = mt76_get_field(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY);
 	if (ret) {
 		dev_dbg(dev->mt76.dev, "Firmware is already download\n");
-		return -EIO;
+		goto fw_loaded;
 	}
 
 	ret = mt7921_load_patch(dev);
@@ -949,6 +949,7 @@ static int mt7921_load_firmware(struct mt7921_dev *dev)
 		return -EIO;
 	}
 
+fw_loaded:
 	mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_FWDL], false);
 
 #ifdef CONFIG_PM
-- 
2.32.0


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

* Re: [PATCH] mt76: mt7921: continue to probe driver when fw already downloaded
  2021-07-08 13:17 [PATCH] mt76: mt7921: continue to probe driver when fw already downloaded Aaron Ma
@ 2021-07-08 15:08 ` Deren Wu
  2021-07-08 20:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Deren Wu @ 2021-07-08 15:08 UTC (permalink / raw)
  To: Aaron Ma, nbd, lorenzo.bianconi83, ryder.lee, kvalo, davem, kuba,
	matthias.bgg, sean.wang, Soul.Huang, linux-wireless, netdev,
	linux-mediatek, linux-kernel, linux-arm-kernel

Hi Aaron,

Thanks for this patch. We verified this is good here.

Could you please add fix tag as well? It's better to backport this
patch.

Fixes: 1c099ab44727c ("mt76: mt7921: add MCU support")


Thanks,
Deren


On Thu, 2021-07-08 at 21:17 +0800, Aaron Ma wrote:
> When reboot system, no power cycles, firmware is already downloaded,
> return -EIO will break driver as error:
> mt7921e: probe of 0000:03:00.0 failed with error -5
> 
> Skip firmware download and continue to probe.
> 
> Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> index c2c4dc196802..cd690c64f65b 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> @@ -931,7 +931,7 @@ static int mt7921_load_firmware(struct mt7921_dev
> *dev)
>  	ret = mt76_get_field(dev, MT_CONN_ON_MISC,
> MT_TOP_MISC2_FW_N9_RDY);
>  	if (ret) {
>  		dev_dbg(dev->mt76.dev, "Firmware is already
> download\n");
> -		return -EIO;
> +		goto fw_loaded;
>  	}
>  
>  	ret = mt7921_load_patch(dev);
> @@ -949,6 +949,7 @@ static int mt7921_load_firmware(struct mt7921_dev
> *dev)
>  		return -EIO;
>  	}
>  
> +fw_loaded:
>  	mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_FWDL],
> false);
>  
>  #ifdef CONFIG_PM

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

* Re: [PATCH] mt76: mt7921: continue to probe driver when fw already downloaded
  2021-07-08 13:17 [PATCH] mt76: mt7921: continue to probe driver when fw already downloaded Aaron Ma
  2021-07-08 15:08 ` Deren Wu
@ 2021-07-08 20:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-08 20:40 UTC (permalink / raw)
  To: Aaron Ma
  Cc: nbd, lorenzo.bianconi83, ryder.lee, kvalo, davem, kuba,
	matthias.bgg, sean.wang, Soul.Huang, deren.wu, linux-wireless,
	netdev, linux-mediatek, linux-kernel, linux-arm-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  8 Jul 2021 21:17:10 +0800 you wrote:
> When reboot system, no power cycles, firmware is already downloaded,
> return -EIO will break driver as error:
> mt7921e: probe of 0000:03:00.0 failed with error -5
> 
> Skip firmware download and continue to probe.
> 
> Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
> 
> [...]

Here is the summary with links:
  - mt76: mt7921: continue to probe driver when fw already downloaded
    https://git.kernel.org/netdev/net/c/c34269041185

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-07-08 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 13:17 [PATCH] mt76: mt7921: continue to probe driver when fw already downloaded Aaron Ma
2021-07-08 15:08 ` Deren Wu
2021-07-08 20:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).