diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2010-05-13 15:16:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-24 15:07:41 -0400 |
commit | 9655a6ec19ca656af246fb80817aa337892aefbf (patch) | |
tree | dedf4a99d4ba98bb0260c7e3317db2750530921d /drivers/net/wireless/rt2x00/rt2500pci.c | |
parent | 3dc3fc52ea1537f5f37ab301d2b1468a0e79988f (diff) |
rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions.
(Based on a patch created by Ondrej Zary)
In some circumstances the Ralink devices do not properly go to sleep
or wake up, with timeouts occurring.
Fix this by retrying telling the device that it has to wake up or
sleep.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 89d132d4af12..41da3d218c65 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1084,7 +1084,7 @@ static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
1084 | static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, | 1084 | static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, |
1085 | enum dev_state state) | 1085 | enum dev_state state) |
1086 | { | 1086 | { |
1087 | u32 reg; | 1087 | u32 reg, reg2; |
1088 | unsigned int i; | 1088 | unsigned int i; |
1089 | char put_to_sleep; | 1089 | char put_to_sleep; |
1090 | char bbp_state; | 1090 | char bbp_state; |
@@ -1105,11 +1105,12 @@ static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, | |||
1105 | * device has entered the correct state. | 1105 | * device has entered the correct state. |
1106 | */ | 1106 | */ |
1107 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 1107 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
1108 | rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®); | 1108 | rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®2); |
1109 | bbp_state = rt2x00_get_field32(reg, PWRCSR1_BBP_CURR_STATE); | 1109 | bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE); |
1110 | rf_state = rt2x00_get_field32(reg, PWRCSR1_RF_CURR_STATE); | 1110 | rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE); |
1111 | if (bbp_state == state && rf_state == state) | 1111 | if (bbp_state == state && rf_state == state) |
1112 | return 0; | 1112 | return 0; |
1113 | rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); | ||
1113 | msleep(10); | 1114 | msleep(10); |
1114 | } | 1115 | } |
1115 | 1116 | ||