Skip to content

Commit 692a820

Browse files
s-mochSasha Levin
authored andcommitted
wifi: rtl8xxxu: retry firmware download on error
[ Upstream commit 3d3e28f ] Occasionally there is an EPROTO error during firmware download. 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. 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 Signed-off-by: Soeren Moch <[email protected]> Acked-by: Ping-Ke Shih <[email protected]> Signed-off-by: Ping-Ke Shih <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent b494602 commit 692a820

File tree

1 file changed

+12
-5
lines changed
  • drivers/net/wireless/realtek/rtl8xxxu

1 file changed

+12
-5
lines changed

drivers/net/wireless/realtek/rtl8xxxu/core.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,9 +860,10 @@ rtl8xxxu_writeN(struct rtl8xxxu_priv *priv, u16 addr, u8 *buf, u16 len)
860860
return len;
861861

862862
write_error:
863-
dev_info(&udev->dev,
864-
"%s: Failed to write block at addr: %04x size: %04x\n",
865-
__func__, addr, blocksize);
863+
if (rtl8xxxu_debug & RTL8XXXU_DEBUG_REG_WRITE)
864+
dev_info(&udev->dev,
865+
"%s: Failed to write block at addr: %04x size: %04x\n",
866+
__func__, addr, blocksize);
866867
return -EAGAIN;
867868
}
868869

@@ -4064,8 +4065,14 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
40644065
*/
40654066
rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, fops->trxff_boundary);
40664067

4067-
ret = rtl8xxxu_download_firmware(priv);
4068-
dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
4068+
for (int retry = 5; retry >= 0 ; retry--) {
4069+
ret = rtl8xxxu_download_firmware(priv);
4070+
dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
4071+
if (ret != -EAGAIN)
4072+
break;
4073+
if (retry)
4074+
dev_dbg(dev, "%s: retry firmware download\n", __func__);
4075+
}
40694076
if (ret)
40704077
goto exit;
40714078
ret = rtl8xxxu_start_firmware(priv);

0 commit comments

Comments
 (0)