zd1211rw firmware loading timeout
Hello,
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:
[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110
A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio on
The following small modification works around the issue:
zd_mac.c +5 -1
@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; + +msleep (10 ); + r =zd_chip_switch_radio_on (chip); -if (r <0 ) +if (r <0 ) { + dev_err(zd_chip_dev(chip), "%s: failed to set radio on\n",
__func__);
goto disable_int;
+ }
r = zd_chip_enable_rxtx(chip);
if (r < 0)
goto disable_radio;Is it possible that some chips require more time between a set_mc_hash and a radio on? Or in general that consequent writes to the PHY regs should be timed appropriately?
When I googled for this timeout issue, I could see quite some reports of other people having this error while the chip was already operating.
Thanks
Signature · 1 line
Florian
A message that is not in the archive (sent off-list or not yet received): CAFAL1Txx=qn3WXdRrtaYPVySY2vx+HinKk-NgthR+2ufcYNMwA@mail.gmail.com
Quoting Florian Fainelli <[email protected]>:
Quoted 49 lines
Hello,
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2
[ 955.108510] zd1211rw 1-3:1.0: firmware version 4725
[ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70AL2230_RFpa0 g--NS
[snip]
[ 955.204072] zd1211rw 1-3:1.0: errorioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onThe following small modification works around the issue:
zd_mac.c +6
-1@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r = set_mc_hash(mac); if (r) goto disable_int; + + msleep(10); + r = zd_chip_switch_radio_on(chip); - if (r < 0) + if (r < 0) { + dev_err(zd_chip_dev(chip), "%s: failed to set radio on\n", __func__); goto disable_int; + } r = zd_chip_enable_rxtx(chip); if (r < 0)goto
disable_radio;
Quoted 3 lines
Is it possible that some chips require more time between a
set_mc_hashand a radio on? Or in general that consequent writes to the PHY regs should be timed appropriately?
Yes, it is possible. Vendor driver appears to have quite alot sleeps spread around in RF-chip handling code. I might have seen this myself sometimes when zd1211 device has firmware freeze and has to be reseted. But since freeze is hard to reproduce and reset didn't fail always, I didn't bother with it.
Can you give your "Signed-off-by" line for the patch?
-Jussi
Quoted 13 lines
When I googled for this timeout issue, I could see quite some reports of other people having this error while the chip was already operating.
Thanks
--
Florian
--
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
Hello Jussi,
Quoted 52 lines · Jussi Kivilinna
Quoting Florian Fainelli <[email protected]>:
Quoted 50 lines
Hello,
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onThe following small modification works around the issue:
zd_mac.c +6
-1@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; + +msleep (10 ); + r =zd_chip_switch_radio_on (chip); -if (r <0 ) +if (r <0 ) { +dev_err (zd_chip_dev (chip),"%s: failed to set radio on\n", __func__); goto disable_int; + } r =zd_chip_enable_rxtx (chip);if (r < 0) goto disable_radio;
Quoted 7 lines
Quoted 3 lines
Is it possible that some chips require more time between a
set_mc_hashand a radio on? Or in general that consequent writes to the PHY regs should be timed appropriately?Yes, it is possible. Vendor driver appears to have quite alot sleeps spread around in RF-chip handling code. I might have seen this myself sometimes when zd1211 device has firmware freeze and has to be reseted. But since freeze is hard to reproduce and reset didn't fail always, I didn't bother with it.
Can you give your "Signed-off-by" line for the patch?
Sure, I will resubmit this patch, do you also want me to keep the line showing the error?
Quoted 22 lines
-Jussi
Quoted 13 lines
When I googled for this timeout issue, I could see quite some reports of other people having this error while the chip was already operating.
Thanks
Signature · 5 lines
Florian -- 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.htmlSignature · 3 lines
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
Quoting Florian Fainelli <[email protected]>:
Quoted 60 lines
Hello Jussi,
Quoted 57 lines · Jussi Kivilinna
Quoting Florian Fainelli <[email protected]>:
Quoted 49 lines
Hello,
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onThe following small modification works around the issue:
zd_mac.c +6
-1@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; + +msleep (10 ); + r =zd_chip_switch_radio_on (chip); -if (r <0 ) +if (r <0 ) { +dev_err (zd_chip_dev (chip),"%s: failed to set radio on\n" , __func__); goto disable_int; + } r =zd_chip_enable_rxtx (chip);if (r <0 )goto disable_radio;Quoted 3 lines
Is it possible that some chips require more time between a
set_mc_hashand a radio on? Or in general that consequent writes to the PHY regs should be timed appropriately?Yes, it is possible. Vendor driver appears to have quite alot sleeps spread around in RF-chip handling code. I might have seen this myself sometimes when zd1211 device has firmware freeze and has to be reseted. But since freeze is hard to reproduce and reset didn't fail always, I didn't bother with it.
Quoted 4 lines
Quoted 1 line
Can you give your "Signed-off-by" line for the patch?
Sure, I will resubmit this patch, do you also want me to keep the line showing the error?
Yes, do that or add URL to original mail. Thanks.
Quoted 25 lines
Quoted 22 lines
-Jussi
Quoted 13 lines
When I googled for this timeout issue, I could see quite some reports of other people having this error while the chip was already operating.
Thanks
Signature · 5 lines
Florian -- 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.htmlSignature · 3 lines
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
PATCH 1/1 zd1211rw: wait between setting hash table and powering radio on
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:
[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110
A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio on
Adding a 10 milliseconds delay between the call to set_mc_hash() and zd_chip_switch_radio_on() allows successful interface bringups in all cases and matches what the vendor driver did.
--- drivers/net/wireless/zd1211rw/zd_mac.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/wireless/zd1211rw/zd_mac.c +6 -1
@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; +msleep (10 ); + r =zd_chip_switch_radio_on (chip); -if (r <0 ) +if (r <0 ) { +dev_err (zd_chip_dev (chip), +"%s: failed to set radio on\n" , __func__); goto disable_int; + } r =zd_chip_enable_rxtx (chip);if (r <0 ) goto disable_radio;
Signature · 1 line
1.7.5.4
Re: [PATCH] zd1211rw: wait between setting hash table and powering radio on
Hi Florian,
A couple of minor points:
Quoted 36 lines · Florian Fainelli
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2
[ 955.108510] zd1211rw 1-3:1.0: firmware version 4725
[ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70AL2230_RFpa0 g--NS
[snip]
[ 955.204072] zd1211rw 1-3:1.0: errorioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onAdding a 10 milliseconds delay between the call to
set_mc_hash()andzd_chip_switch_radio_on()allows successful interface bringups in all cases and matches what the vendor driver did.Signed-off-by Florian Fainelli <[email protected]>---
drivers/net/wireless/zd1211rw/zd_mac.c | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)drivers/net/wireless/zd1211rw/zd_mac.c +0
-0
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 309
Quoted 4 lines
drivers/net/wireless/zd1211rw/zd_mac.c +1
-0@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r = set_mc_hash(mac); if (r) goto disable_int; + msleep(10);
You might want to stick a comment in here to tell future developers why we're doing this.
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 316
Quoted 8 lines
drivers/net/wireless/zd1211rw/zd_mac.c +5
-1+ r = zd_chip_switch_radio_on(chip); - if (r < 0) + if (r < 0) { + dev_err(zd_chip_dev(chip), + "%s: failed to set radio on\n", __func__); goto disable_int; + }
It might also be an idea to have it re-try powering on the radio after, say 100 msecs, just in case 10 msecs isn't enough for whatever is causing this issue.
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 319
Quoted 3 lines
drivers/net/wireless/zd1211rw/zd_mac.c +0
-0r = zd_chip_enable_rxtx(chip); if (r < 0) goto disable_radio;
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
Re: [PATCH] zd1211rw: wait between setting hash table and powering radio on
Hi Julian,
Quoted 36 lines · Julian Calaby
Hi Florian,
A couple of minor points:
Quoted 31 lines · Florian Fainelli
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onAdding a 10 milliseconds delay between the call to
set_mc_hash()andzd_chip_switch_radio_on()allows successful interface bringups in all cases and matches what the vendor driver did.Signed-off-by Florian Fainelli<[email protected]>--- drivers/net/wireless/zd1211rw/zd_mac.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
Quoted 11 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 309
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c +1
-0@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; +msleep (10 );You might want to stick a comment in here to tell future developers why we're doing this.
I was counting on the commit message to actually provide the detailed explanation, but you are right, some comment might be appropriate here as well.
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 316
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c +5
-1+ r =zd_chip_switch_radio_on (chip); -if (r<0 ) +if (r<0 ) { +dev_err (zd_chip_dev (chip), +"%s: failed to set radio on\n" , __func__); goto disable_int; + }
Quoted 3 lines
It might also be an idea to have it re-try powering on the radio after, say 100 msecs, just in case 10 msecs isn't enough for whatever is causing this issue.
Here I would rather let the error be printed in the kernel log for people to report an issue if 10 msecs proves not to be enough for some systems.
Quoted 6 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 319
Quoted 4 lines
drivers/net/wireless/zd1211rw/zd_mac.c +0
-0r =zd_chip_enable_rxtx (chip);if (r<0 ) goto disable_radio;Thanks,
Re: [PATCH] zd1211rw: wait between setting hash table and powering radio on
Hi Florian,
Quoted 75 lines · Florian Fainelli
Hi Julian,
Quoted 41 lines · Julian Calaby
Hi Florian,
A couple of minor points:
Quoted 34 lines · Florian Fainelli
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2
[ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70AL2230_RFpa0 g--NS
[snip]
[ 955.204072] zd1211rw 1-3:1.0: errorioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onAdding a 10 milliseconds delay between the call to
set_mc_hash()andzd_chip_switch_radio_on()allows successful interface bringups in all cases and matches what the vendor driver did.Signed-off-by Florian Fainelli<[email protected]>---
drivers/net/wireless/zd1211rw/zd_mac.c | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)Quoted 13 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 309
Quoted 10 lines
drivers/net/wireless/zd1211rw/zd_mac.c +1
-0@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r = set_mc_hash(mac); if (r) goto disable_int; + msleep(10);You might want to stick a comment in here to tell future developers why we're doing this.
I was counting on the commit message to actually provide the detailed explanation, but you are right, some comment might be appropriate here as well.
Quoted 10 lines
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c +5
-1+ r = zd_chip_switch_radio_on(chip); - if (r< 0) + if (r< 0) { + dev_err(zd_chip_dev(chip), + "%s: failed to set radio on\n", __func__); goto disable_int; + }
Quoted 7 lines
Quoted 3 lines
It might also be an idea to have it re-try powering on the radio after, say 100 msecs, just in case 10 msecs isn't enough for whatever is causing this issue.
Here I would rather let the error be printed in the kernel log for people to report an issue if 10 msecs proves not to be enough for some systems.
When I see timing like this added to established drivers it makes me think that maybe something has changed since the code was originally written, maybe there was a 10msec delay somewhere deep down in the USB code that's now been eliminated, or something else equally random, and maybe we'll need a longer wait in the future. Writing the code to try it, say, 5 times will probably never completely time out, but it will probably work until the driver is removed from the kernel, rather than having to change this to a larger value some time in the future. On the other hand, this fixes the bug you've found and maybe something like that can wait.
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
Re: [PATCH] zd1211rw: wait between setting hash table and powering radio on
Quoting Julian Calaby <[email protected]>:
Quoted 86 lines
Hi Florian,
Quoted 75 lines · Florian Fainelli
Hi Julian,
Quoted 41 lines · Julian Calaby
Hi Florian,
A couple of minor points:
Quoted 34 lines · Florian Fainelli
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2
[ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70AL2230_RFpa0 g--NS
[snip]
[ 955.204072] zd1211rw 1-3:1.0: errorioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onAdding a 10 milliseconds delay between the call to
set_mc_hash()andzd_chip_switch_radio_on()allows successful interface bringups in all cases and matches what the vendor driver did.Signed-off-by Florian Fainelli<[email protected]>---
drivers/net/wireless/zd1211rw/zd_mac.c | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)Quoted 13 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 309
Quoted 10 lines
drivers/net/wireless/zd1211rw/zd_mac.c +1
-0@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r = set_mc_hash(mac); if (r) goto disable_int; + msleep(10);You might want to stick a comment in here to tell future developers why we're doing this.
I was counting on the commit message to actually provide the detailed explanation, but you are right, some comment might be appropriate here as well.
Quoted 10 lines
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c +5
-1+ r = zd_chip_switch_radio_on(chip); - if (r< 0) + if (r< 0) { + dev_err(zd_chip_dev(chip), + "%s: failed to set radio on\n", __func__); goto disable_int; + }Quoted 7 lines
Quoted 3 lines
It might also be an idea to have it re-try powering on the radio after, say 100 msecs, just in case 10 msecs isn't enough for whatever is causing this issue.
Here I would rather let the error be printed in the kernel log for people to report an issue if 10 msecs proves not to be enough for some systems.
Quoted 10 lines
When I see timing like this added to established drivers it makes me think that maybe something has changed since the code was originally written, maybe there was a 10msec delay somewhere deep down in the USB code that's now been eliminated, or something else equally random, and maybe we'll need a longer wait in the future. Writing the code to try it, say, 5 times will probably never completely time out, but it will probably work until the driver is removed from the kernel, rather than having to change this to a larger value some time in the future. On the other hand, this fixes the bug you've found and maybe something like that can wait.
Quick search of "error ioread32(CR_REG1): -110" shows that first reports are from 2008/2.6.24. People have found following workarounds are "rmmod zd1211rw;modprobe zd1211rw", unplug/replug USB device, use motherboard USB connector instead of hub, etc.
-Jussi
Quoted 11 lines
Thanks,
--
Julian CalabyEmail: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
Re: [PATCH] zd1211rw: wait between setting hash table and powering radio on
Quoted 99 lines · Jussi Kivilinna
Quoting Julian Calaby <[email protected]>:
Quoted 86 lines
Hi Florian,
Quoted 75 lines · Florian Fainelli
Hi Julian,
Quoted 41 lines · Julian Calaby
Hi Florian,
A couple of minor points:
Quoted 34 lines · Florian Fainelli
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onAdding a 10 milliseconds delay between the call to
set_mc_hash()andzd_chip_switch_radio_on()allows successful interface bringups in all cases and matches what the vendor driver did.Signed-off-by Florian Fainelli<[email protected]>--- drivers/net/wireless/zd1211rw/zd_mac.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)Quoted 13 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 309
Quoted 10 lines
drivers/net/wireless/zd1211rw/zd_mac.c +1
-0@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; +msleep (10 );You might want to stick a comment in here to tell future developers why we're doing this.
I was counting on the commit message to actually provide the detailed explanation, but you are right, some comment might be appropriate here as well.
Quoted 10 lines
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c +5
-1+ r =zd_chip_switch_radio_on (chip); -if (r<0 ) +if (r<0 ) { +dev_err (zd_chip_dev (chip), +"%s: failed to set radio on\n" , __func__); goto disable_int; + }Quoted 7 lines
Quoted 3 lines
It might also be an idea to have it re-try powering on the radio after, say 100 msecs, just in case 10 msecs isn't enough for whatever is causing this issue.
Here I would rather let the error be printed in the kernel log for people to report an issue if 10 msecs proves not to be enough for some systems.
Quoted 10 lines
When I see timing like this added to established drivers it makes me think that maybe something has changed since the code was originally written, maybe there was a 10msec delay somewhere deep down in the USB code that's now been eliminated, or something else equally random, and maybe we'll need a longer wait in the future. Writing the code to try it, say, 5 times will probably never completely time out, but it will probably work until the driver is removed from the kernel, rather than having to change this to a larger value some time in the future. On the other hand, this fixes the bug you've found and maybe something like that can wait.
Quoted 1 line
Quick search of "error
ioread32(CR_REG1): -110" shows that first reports are from 2008/2.6.24. People have found following workarounds are "rmmod zd1211rw;modprobe zd1211rw", unplug/replug USB device, use motherboard USB connector instead of hub, etc.
So, is the patch as-is acceptable, or do you want me to resubmit with more comments around the msleep()?
Thank you.
--
Florian
Jussi Kivilinna
Acked-byRe: [PATCH] zd1211rw: wait between setting hash table and powering radio on
Quoting Florian Fainelli <[email protected]>:
Quoted 100 lines · Jussi Kivilinna
Quoted 99 lines
Quoting Julian Calaby <[email protected]>:
Quoted 96 lines
Hi Florian,
Quoted 75 lines · Florian Fainelli
Hi Julian,
Quoted 41 lines · Julian Calaby
Hi Florian,
A couple of minor points:
Quoted 34 lines · Florian Fainelli
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio onAdding a 10 milliseconds delay between the call to
set_mc_hash()andzd_chip_switch_radio_on()allows successful interface bringups in all cases and matches what the vendor driver did.Signed-off-by Florian Fainelli<[email protected]>---
drivers/net/wireless/zd1211rw/zd_mac.c| 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)Quoted 13 lines
drivers/net/wireless/zd1211rw/zd_mac.c int zd_op_start(struct ieee80211_hw *hw) · line 309
Quoted 10 lines
drivers/net/wireless/zd1211rw/zd_mac.c +1
-0@@ -306,9 +306,14 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; +msleep (10 );You might want to stick a comment in here to tell future developers why we're doing this.
I was counting on the commit message to actually provide the detailed explanation, but you are right, some comment might be appropriate here as well.
Quoted 10 lines
Quoted 9 lines
drivers/net/wireless/zd1211rw/zd_mac.c +5
-1+ r =zd_chip_switch_radio_on (chip); -if (r<0 ) +if (r<0 ) { +dev_err (zd_chip_dev (chip), +"%s: failed to set radio on\n" , __func__); goto disable_int; + }Quoted 7 lines
Quoted 3 lines
It might also be an idea to have it re-try powering on the radio after, say 100 msecs, just in case 10 msecs isn't enough for whatever is causing this issue.
Here I would rather let the error be printed in the kernel log for people to report an issue if 10 msecs proves not to be enough for some systems.
When I see timing like this added to established drivers it makes me think that maybe something has changed since the code was originally written, maybe there was a 10msec delay somewhere deep down in the USB code that's now been eliminated, or something else equally random, and maybe we'll need a longer wait in the future. Writing the code to try it, say, 5 times will probably never completely time out, but it will probably work until the driver is removed from the kernel, rather than having to change this to a larger value some time in the future. On the other hand, this fixes the bug you've found and maybe something like that can wait.
Quoted 3 lines
Quoted 1 line
Quick search of "error
ioread32(CR_REG1): -110" shows that first reports are from 2008/2.6.24. People have found following workarounds are "rmmod zd1211rw;modprobe zd1211rw", unplug/replug USB device, use motherboard USB connector instead of hub, etc.So, is the patch as-is acceptable, or do you want me to resubmit with more comments around the
msleep()?
Comment would be good to have. You can add my acked-by to patch message..
Quoted 6 lines
Thank you.
--
Florian
PATCH v2 1/1 zd1211rw: wait between setting hash table and powering radio on
I am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:
[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110
A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio on
Adding a 10 milliseconds delay between the call to set_mc_hash() and zd_chip_switch_radio_on() allows successful interface bringups in all cases and matches what the vendor driver did.
---
Changes since v1:
- added comment in the code as to why this delay is required
- added Jussi's acked-by tag
drivers/net/wireless/zd1211rw/zd_mac.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/net/wireless/zd1211rw/zd_mac.c +11 -1
@@ -306,9 +306,19 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; + +/* Wait after setting the mutlicast hash table and powering on +* the radio otherwise interface bring up will fail. This matches +* what the vendor driver did. +*/ +msleep (10 ); + r =zd_chip_switch_radio_on (chip); -if (r <0 ) +if (r <0 ) { +dev_err (zd_chip_dev (chip), +"%s: failed to set radio on\n" , __func__); goto disable_int; + } r =zd_chip_enable_rxtx (chip);if (r <0 ) goto disable_radio;
Signature · 1 line
1.7.5.4
Re: [PATCH v2] zd1211rw: wait between setting hash table and powering radio on
Hi Florian,
Quoted 1 line · Florian Fainelli
+ /* Wait after setting the mutlicast hash table and powering on
I hate to, but you've spelled multicast mutlicast.
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
PATCH v3 1/1 zd1211rw: wait between setting hash table and powering radio on
In reply to Florian FainelliI am running Debian testing kernel 3.1.0-1-amd64, using a 079b:0062 Sagem XG-76NA 802.11bg stick.
Upon zd1211rw interface
bringup (ifconfig wlan0 up) I get the following timeout:
[ 950.330573] zd1211rw 1-3:1.0: phy2 [ 955.108510] zd1211rw 1-3:1.0: firmware version 4725 [ 955.148532] zd1211rw 1-3:1.0: zd1211b chip 079b:0062 v4810 high 00-19-70 AL2230_RF pa0 g--NS [snip] [ 955.204072] zd1211rw 1-3:1.0: error ioread32(CR_REG1): -110
A second ifconfig wlan0 up brings the interface up without problems.
After a bit more debugging, the call trace is the following:
[10241.028130] zd1211rw 1-3:1.0: zd_chip_lock_phy_regs: error ioread32(CR_REG1): -110 [10241.028140] zd1211rw 1-3:1.0: zd_switch_radio_on: failed to lock PHY regs [10241.028148] zd1211rw 1-3:1.0: zd_op_start: failed to set radio on
Adding a 10 milliseconds delay between the call to set_mc_hash() and zd_chip_switch_radio_on() allows successful interface bringups in all cases and matches what the vendor driver did.
---
Changes since v2:
- fixed typo mutlicast instead of multicast in comment
Changes since v1:
- added comment in the code as to why this delay is required
- added Jussi's acked-by tag
drivers/net/wireless/zd1211rw/zd_mac.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/net/wireless/zd1211rw/zd_mac.c +11 -1
@@ -306,9 +306,19 @@ int zd_op_start(struct ieee80211_hw *hw) r =set_mc_hash (mac);if (r) goto disable_int; + +/* Wait after setting the multicast hash table and powering on +* the radio otherwise interface bring up will fail. This matches +* what the vendor driver did. +*/ +msleep (10 ); + r =zd_chip_switch_radio_on (chip); -if (r <0 ) +if (r <0 ) { +dev_err (zd_chip_dev (chip), +"%s: failed to set radio on\n" , __func__); goto disable_int; + } r =zd_chip_enable_rxtx (chip);if (r <0 ) goto disable_radio;
Signature · 1 line
1.7.5.4