rtl8xxxu: increase polling timeout for firmware startup
cover rtl8xxxu: increase polling timeout for firmware startup
Here are patches patch to increase the polling timeout for rtl8xxxu firmware startup, and to make it configurable.
Resubmitting with changes per Julian Calaby's comments.
Dan Lenski (2):
rtl8xxxu: Increase default polling timeout for firmware startup
rtl8xxxu: Make polling timeout for firmware configurable
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 11 +++++++---- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.8.2
PATCH 1/2 rtl8xxxu: Increase default polling timeout for firmware startup
This patch increases the default value for the maximum number of polling loops to wait for the rtl8xxxu MCU to start after the firmware is loaded (from 1000 to 5000).
With RTL8723AU chipset, I frequently encounter "Firmware failed to start" errors from rtl8xxxu after a cold boot.
It appears that other chipsets supported by the driver have the same problem. Here are a couple of relevant bug reports:
- http://ubuntuforums.org/showthread.php?t=2321756
- https://www.mail-archive.com/[email protected]/msg4942468.html
This issue seems to occur because RTL8XXXU_FIRMWARE_POLL_MAX (1000) is too short, and the MCU fails to start up as quickly as expected.
With a longer value (5000), the driver starts up consistently and successfully after cold-boot.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1 -1
@@ -49,7 +49,7 @@#define TX_PAGE_NUM_NORM_PQ 0x02#define RTL_FW_PAGE_SIZE 4096 -#define RTL8XXXU_FIRMWARE_POLL_MAX 1000 +#define RTL8XXXU_FIRMWARE_POLL_MAX 5000#define RTL8723A_CHANNEL_GROUPS 3#define RTL8723A_MAX_RF_PATHS 2
Signature · 1 line
2.8.2
Re: [PATCH 1/2] rtl8xxxu: Increase default polling timeout for firmware startup
Hi,
Quoted 12 lines · Dan Lenski
This patch increases the default value for the maximum number of polling loops to wait for the rtl8xxxu MCU to start after the firmware is loaded (from 1000 to 5000).
With RTL8723AU chipset, I frequently encounter "Firmware failed to start" errors from rtl8xxxu after a cold boot.
It appears that other chipsets supported by the driver have the same problem. Here are a couple of relevant bug reports:
- http://ubuntuforums.org/showthread.php?t=2321756
- https://www.mail-archive.com/[email protected]/msg4942468.html
Quoted 7 lines
This issue seems to occur because
RTL8XXXU_FIRMWARE_POLL_MAX(1000) is too short, and the MCU fails to start up as quickly as expected.With a longer value (5000), the driver starts up consistently and successfully after cold-boot.
Signed-off-by Dan Lenski <[email protected]>
This looks good to me.
Quoted 24 lines
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1
-2@@ -49,7 +49,7 @@#define TX_PAGE_NUM_NORM_PQ 0x02#define RTL_FW_PAGE_SIZE 4096 -#define RTL8XXXU_FIRMWARE_POLL_MAX 1000 +#define RTL8XXXU_FIRMWARE_POLL_MAX 5000#define RTL8723A_CHANNEL_GROUPS 3#define RTL8723A_MAX_RF_PATHS 2 --2.8.2
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
Re: [PATCH 1/2] rtl8xxxu: Increase default polling timeout for firmware startup
In reply to Dan LenskiQuoted 15 lines · Dan Lenski
This patch increases the default value for the maximum number of polling loops to wait for the rtl8xxxu MCU to start after the firmware is loaded (from 1000 to 5000).
With RTL8723AU chipset, I frequently encounter "Firmware failed to start" errors from rtl8xxxu after a cold boot.
It appears that other chipsets supported by the driver have the same problem. Here are a couple of relevant bug reports:
- http://ubuntuforums.org/showthread.php?t=2321756
- https://www.mail-archive.com/[email protected]/msg4942468.htmlThis issue seems to occur because
RTL8XXXU_FIRMWARE_POLL_MAX(1000) is too short, and the MCU fails to start up as quickly as expected.
Quoted 7 lines
With a longer value (5000), the driver starts up consistently and successfully after cold-boot.
Signed-off-by Dan Lenski <[email protected]>--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
As previously pointed out, please provide some details about the system where this goes wrong.
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h line 52
Quoted 11 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1
-1@@ -49,7 +49,7 @@#define TX_PAGE_NUM_NORM_PQ 0x02#define RTL_FW_PAGE_SIZE 4096 -#define RTL8XXXU_FIRMWARE_POLL_MAX 1000 +#define RTL8XXXU_FIRMWARE_POLL_MAX 5000
This is a long delay - how about 2000?
Jes
Re: [PATCH 1/2] rtl8xxxu: Increase default polling timeout for firmware startup
Quoted 9 lines · Jes Sorensen
Quoted 8 lines · Dan Lenski
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +0
-0@@ -49,7 +49,7 @@#define TX_PAGE_NUM_NORM_PQ 0x02
Quoted 5 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h line 52
Quoted 3 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1
-1#define RTL_FW_PAGE_SIZE 4096 -#define RTL8XXXU_FIRMWARE_POLL_MAX 1000 +#define RTL8XXXU_FIRMWARE_POLL_MAX 5000This is a long delay - how about 2000?
I tried 2000 first, and it worked for me on only 1 out of 3 cold boots.
Dan
Re: [PATCH 1/2] rtl8xxxu: Increase default polling timeout for firmware startup
Quoted 10 lines · Daniel Lenski
Quoted 9 lines · Jes Sorensen
Quoted 8 lines · Dan Lenski
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +0
-0@@ -49,7 +49,7 @@#define TX_PAGE_NUM_NORM_PQ 0x02
Quoted 7 lines
Quoted 5 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h line 52
Quoted 3 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1
-1#define RTL_FW_PAGE_SIZE 4096 -#define RTL8XXXU_FIRMWARE_POLL_MAX 1000 +#define RTL8XXXU_FIRMWARE_POLL_MAX 5000This is a long delay - how about 2000?
I tried 2000 first, and it worked for me on only 1 out of 3 cold boots.
OK, lets go for 5000 then to be safe.
Cheers,
Jes
PATCH 2/2 rtl8xxxu: Make polling timeout for firmware configurable
In reply to Dan LenskiThis patch makes RTL8XXXU_FIRMWARE_POLL_MAX into a configurable module parameter, firmware_poll_max.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c +7 -4
@@ -44,6 +44,7 @@static int rtl8xxxu_debug;static bool rtl8xxxu_ht40_2g; +static int rtl8xxxu_firmware_poll_max =RTL8XXXU_FIRMWARE_POLL_MAX ;MODULE_AUTHOR ("Jes Sorensen <[email protected]>" );MODULE_DESCRIPTION ("RTL8XXXu USB mac80211 Wireless LAN Driver" );
@@ -59,6 +60,8 @@ module_param_named(debug, rtl8xxxu_debug, int, 0600);MODULE_PARM_DESC (debug,"Set debug mask" );module_param_named (ht40_2g, rtl8xxxu_ht40_2g, bool,0600 );MODULE_PARM_DESC (ht40_2g,"Enable HT40 support on the 2.4GHz band" ); +module_param_named (firmware_poll_max, rtl8xxxu_firmware_poll_max, int,0600 ); +MODULE_PARM_DESC (firmware_poll_max,"Maximum polling count for firmware startup (increase if firmware fails to start)" );#define USB_VENDOR_ID_REALTEK 0x0bda/* Minimum IEEE80211_MAX_FRAME_LEN */
@@ -2050,13 +2053,13 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)u32 val32;/* Poll checksum report */ -for (i =0 ; i <RTL8XXXU_FIRMWARE_POLL_MAX ; i++) { +for (i =0 ; i < rtl8xxxu_firmware_poll_max; i++) { val32 =rtl8xxxu_read32 (priv,REG_MCU_FW_DL );if (val32 &MCU_FW_DL_CSUM_REPORT )break ; } -if (i ==RTL8XXXU_FIRMWARE_POLL_MAX ) { +if (i == rtl8xxxu_firmware_poll_max) {dev_warn (dev,"Firmware checksum poll timed out\n" ); ret = -EAGAIN ; goto exit;
@@ -2068,7 +2071,7 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)rtl8xxxu_write32 (priv,REG_MCU_FW_DL , val32);/* Wait for firmware to become ready */ -for (i =0 ; i <RTL8XXXU_FIRMWARE_POLL_MAX ; i++) { +for (i =0 ; i < rtl8xxxu_firmware_poll_max; i++) { val32 =rtl8xxxu_read32 (priv,REG_MCU_FW_DL );if (val32 &MCU_WINT_INIT_READY )break ;
@@ -2076,7 +2079,7 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)udelay (100 ); } -if (i ==RTL8XXXU_FIRMWARE_POLL_MAX ) { +if (i == rtl8xxxu_firmware_poll_max) {dev_warn (dev,"Firmware failed to start\n" ); ret = -EAGAIN ; goto exit;
Signature · 1 line
2.8.2
Re: [PATCH 2/2] rtl8xxxu: Make polling timeout for firmware configurable
Hi,
Quoted 4 lines · Dan Lenski
This patch makes
RTL8XXXU_FIRMWARE_POLL_MAXinto a configurable module parameter,firmware_poll_max.Signed-off-by Dan Lenski <[email protected]>
This looks good to me.
Quoted 66 lines
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c +7
-5@@ -44,6 +44,7 @@static int rtl8xxxu_debug;static bool rtl8xxxu_ht40_2g; +static int rtl8xxxu_firmware_poll_max =RTL8XXXU_FIRMWARE_POLL_MAX ;MODULE_AUTHOR ("Jes Sorensen <[email protected]>" );MODULE_DESCRIPTION ("RTL8XXXu USB mac80211 Wireless LAN Driver" );@@ -59,6 +60,8 @@ module_param_named(debug, rtl8xxxu_debug, int, 0600);MODULE_PARM_DESC (debug,"Set debug mask" );module_param_named (ht40_2g, rtl8xxxu_ht40_2g, bool,0600 );MODULE_PARM_DESC (ht40_2g,"Enable HT40 support on the 2.4GHz band" ); +module_param_named (firmware_poll_max, rtl8xxxu_firmware_poll_max, int,0600 ); +MODULE_PARM_DESC (firmware_poll_max,"Maximum polling count for firmware startup (increase if firmware fails to start)" );#define USB_VENDOR_ID_REALTEK 0x0bda/* Minimum IEEE80211_MAX_FRAME_LEN */ @@ -2050,13 +2053,13 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)u32 val32;/* Poll checksum report */ -for (i =0 ; i <RTL8XXXU_FIRMWARE_POLL_MAX ; i++) { +for (i =0 ; i < rtl8xxxu_firmware_poll_max; i++) { val32 =rtl8xxxu_read32 (priv,REG_MCU_FW_DL );if (val32 &MCU_FW_DL_CSUM_REPORT )break ; } -if (i ==RTL8XXXU_FIRMWARE_POLL_MAX ) { +if (i == rtl8xxxu_firmware_poll_max) {dev_warn (dev,"Firmware checksum poll timed out\n" ); ret = -EAGAIN ; goto exit;@@ -2068,7 +2071,7 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)rtl8xxxu_write32 (priv,REG_MCU_FW_DL , val32);/* Wait for firmware to become ready */ -for (i =0 ; i <RTL8XXXU_FIRMWARE_POLL_MAX ; i++) { +for (i =0 ; i < rtl8xxxu_firmware_poll_max; i++) { val32 =rtl8xxxu_read32 (priv,REG_MCU_FW_DL );if (val32 &MCU_WINT_INIT_READY )break ;@@ -2076,7 +2079,7 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)udelay (100 ); } -if (i ==RTL8XXXU_FIRMWARE_POLL_MAX ) { +if (i == rtl8xxxu_firmware_poll_max) {dev_warn (dev,"Firmware failed to start\n" ); ret = -EAGAIN ; goto exit; --2.8.2
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
Re: [PATCH 2/2] rtl8xxxu: Make polling timeout for firmware configurable
In reply to Dan LenskiQuoted 7 lines · Dan Lenski
This patch makes
RTL8XXXU_FIRMWARE_POLL_MAXinto a configurable module parameter,firmware_poll_max.Signed-off-by Dan Lenski <[email protected]>--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
I really see no use for this one - it's an extremely rare case, and not something that I'd expect anyone ever using.
Again, please submit patches against the correct git tree.
Jes