Soeren Moch <smoch@xxxxxx> wrote:OK, I'm happy to move this to the formal commit message if you
Occasionally there is an EPROTO error during firmware download.These can be in formal commit message.
This error is converted to EAGAIN in the download function.
But nobody tries again and so device probe fails.
Implement download retry to fix this.
Signed-off-by: Soeren Moch <smoch@xxxxxx>
---
Cc: Jes Sorensen <Jes.Sorensen@xxxxxxxxx>
Cc: Kalle Valo <kvalo@xxxxxxxxxx>
Cc: linux-wireless@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
This error was observed (and fix tested) on a tbs2910 board [1]
with an embedded RTL8188EU (0bda:8179) device behind a USB hub.
[1] arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
Correct. After seeing the patch in my Inbox I already realized that
---It looks like 'if (retry)' is always true and unnecessary.
drivers/net/wireless/realtek/rtl8xxxu/core.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 7891c988dd5f..cd7d904eae62 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -4064,8 +4064,14 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
*/
rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, fops->trxff_boundary);
- ret = rtl8xxxu_download_firmware(priv);
- dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
+ for (int retry = 5; retry ; retry--) {
+ ret = rtl8xxxu_download_firmware(priv);
+ dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
+ if (ret != -EAGAIN)
+ break;
+ if (retry)
+ dev_info(dev, "retry firmware download\n");
Also, this messageI think this message is important since there is the "failed to write block"
isn't so important to user, so dev_dbg() is more suitable, but already printing
"%s: download_firmware %i\n" for every retry is enough? Or move it out of loop?
+ }
if (ret)
goto exit;
ret = rtl8xxxu_start_firmware(priv);
--
2.43.0