diff options
author | Woody Hung <Woody.Hung@mediatek.com> | 2012-07-31 09:53:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-02 13:51:47 -0400 |
commit | 16ebd60856bc5d980722cb85b259a4d5b301e94a (patch) | |
tree | b120303c0905700f03c93289b01f36a1dfb1d153 /drivers/net/wireless/rt2x00 | |
parent | 9d5d496c3464b7ad0ba942b4ada5f27c07e07079 (diff) |
rt2x00 : fix rt3290 resuming failed.
This patch is going to fix the resuming failed from S3/S4
for rt3290 chip.
Signed-off-by: Woody Hung <Woody.Hung@mediatek.com>
Cc: Kevin Chou <kevin.chou@mediatek.com>
Signed-off-by: Chen, Chien-Chia <machen@suse.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 68 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 71 |
2 files changed, 68 insertions, 71 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 88455b1b9fe0..cb8c2aca54e4 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -221,6 +221,67 @@ static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev, | |||
221 | mutex_unlock(&rt2x00dev->csr_mutex); | 221 | mutex_unlock(&rt2x00dev->csr_mutex); |
222 | } | 222 | } |
223 | 223 | ||
224 | static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev) | ||
225 | { | ||
226 | u32 reg; | ||
227 | int i, count; | ||
228 | |||
229 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
230 | if (rt2x00_get_field32(reg, WLAN_EN)) | ||
231 | return 0; | ||
232 | |||
233 | rt2x00_set_field32(®, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff); | ||
234 | rt2x00_set_field32(®, FRC_WL_ANT_SET, 1); | ||
235 | rt2x00_set_field32(®, WLAN_CLK_EN, 0); | ||
236 | rt2x00_set_field32(®, WLAN_EN, 1); | ||
237 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
238 | |||
239 | udelay(REGISTER_BUSY_DELAY); | ||
240 | |||
241 | count = 0; | ||
242 | do { | ||
243 | /* | ||
244 | * Check PLL_LD & XTAL_RDY. | ||
245 | */ | ||
246 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
247 | rt2800_register_read(rt2x00dev, CMB_CTRL, ®); | ||
248 | if (rt2x00_get_field32(reg, PLL_LD) && | ||
249 | rt2x00_get_field32(reg, XTAL_RDY)) | ||
250 | break; | ||
251 | udelay(REGISTER_BUSY_DELAY); | ||
252 | } | ||
253 | |||
254 | if (i >= REGISTER_BUSY_COUNT) { | ||
255 | |||
256 | if (count >= 10) | ||
257 | return -EIO; | ||
258 | |||
259 | rt2800_register_write(rt2x00dev, 0x58, 0x018); | ||
260 | udelay(REGISTER_BUSY_DELAY); | ||
261 | rt2800_register_write(rt2x00dev, 0x58, 0x418); | ||
262 | udelay(REGISTER_BUSY_DELAY); | ||
263 | rt2800_register_write(rt2x00dev, 0x58, 0x618); | ||
264 | udelay(REGISTER_BUSY_DELAY); | ||
265 | count++; | ||
266 | } else { | ||
267 | count = 0; | ||
268 | } | ||
269 | |||
270 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
271 | rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 0); | ||
272 | rt2x00_set_field32(®, WLAN_CLK_EN, 1); | ||
273 | rt2x00_set_field32(®, WLAN_RESET, 1); | ||
274 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
275 | udelay(10); | ||
276 | rt2x00_set_field32(®, WLAN_RESET, 0); | ||
277 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
278 | udelay(10); | ||
279 | rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff); | ||
280 | } while (count != 0); | ||
281 | |||
282 | return 0; | ||
283 | } | ||
284 | |||
224 | void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | 285 | void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, |
225 | const u8 command, const u8 token, | 286 | const u8 command, const u8 token, |
226 | const u8 arg0, const u8 arg1) | 287 | const u8 arg0, const u8 arg1) |
@@ -400,6 +461,13 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
400 | { | 461 | { |
401 | unsigned int i; | 462 | unsigned int i; |
402 | u32 reg; | 463 | u32 reg; |
464 | int retval; | ||
465 | |||
466 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
467 | retval = rt2800_enable_wlan_rt3290(rt2x00dev); | ||
468 | if (retval) | ||
469 | return -EBUSY; | ||
470 | } | ||
403 | 471 | ||
404 | /* | 472 | /* |
405 | * If driver doesn't wake up firmware here, | 473 | * If driver doesn't wake up firmware here, |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 235376e9cb04..98aa426a3564 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -980,66 +980,6 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
980 | return rt2800_validate_eeprom(rt2x00dev); | 980 | return rt2800_validate_eeprom(rt2x00dev); |
981 | } | 981 | } |
982 | 982 | ||
983 | static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev) | ||
984 | { | ||
985 | u32 reg; | ||
986 | int i, count; | ||
987 | |||
988 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
989 | if (rt2x00_get_field32(reg, WLAN_EN)) | ||
990 | return 0; | ||
991 | |||
992 | rt2x00_set_field32(®, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff); | ||
993 | rt2x00_set_field32(®, FRC_WL_ANT_SET, 1); | ||
994 | rt2x00_set_field32(®, WLAN_CLK_EN, 0); | ||
995 | rt2x00_set_field32(®, WLAN_EN, 1); | ||
996 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
997 | |||
998 | udelay(REGISTER_BUSY_DELAY); | ||
999 | |||
1000 | count = 0; | ||
1001 | do { | ||
1002 | /* | ||
1003 | * Check PLL_LD & XTAL_RDY. | ||
1004 | */ | ||
1005 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
1006 | rt2800_register_read(rt2x00dev, CMB_CTRL, ®); | ||
1007 | if (rt2x00_get_field32(reg, PLL_LD) && | ||
1008 | rt2x00_get_field32(reg, XTAL_RDY)) | ||
1009 | break; | ||
1010 | udelay(REGISTER_BUSY_DELAY); | ||
1011 | } | ||
1012 | |||
1013 | if (i >= REGISTER_BUSY_COUNT) { | ||
1014 | |||
1015 | if (count >= 10) | ||
1016 | return -EIO; | ||
1017 | |||
1018 | rt2800_register_write(rt2x00dev, 0x58, 0x018); | ||
1019 | udelay(REGISTER_BUSY_DELAY); | ||
1020 | rt2800_register_write(rt2x00dev, 0x58, 0x418); | ||
1021 | udelay(REGISTER_BUSY_DELAY); | ||
1022 | rt2800_register_write(rt2x00dev, 0x58, 0x618); | ||
1023 | udelay(REGISTER_BUSY_DELAY); | ||
1024 | count++; | ||
1025 | } else { | ||
1026 | count = 0; | ||
1027 | } | ||
1028 | |||
1029 | rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); | ||
1030 | rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 0); | ||
1031 | rt2x00_set_field32(®, WLAN_CLK_EN, 1); | ||
1032 | rt2x00_set_field32(®, WLAN_RESET, 1); | ||
1033 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
1034 | udelay(10); | ||
1035 | rt2x00_set_field32(®, WLAN_RESET, 0); | ||
1036 | rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); | ||
1037 | udelay(10); | ||
1038 | rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff); | ||
1039 | } while (count != 0); | ||
1040 | |||
1041 | return 0; | ||
1042 | } | ||
1043 | static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 983 | static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
1044 | { | 984 | { |
1045 | int retval; | 985 | int retval; |
@@ -1063,17 +1003,6 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1063 | return retval; | 1003 | return retval; |
1064 | 1004 | ||
1065 | /* | 1005 | /* |
1066 | * In probe phase call rt2800_enable_wlan_rt3290 to enable wlan | ||
1067 | * clk for rt3290. That avoid the MCU fail in start phase. | ||
1068 | */ | ||
1069 | if (rt2x00_rt(rt2x00dev, RT3290)) { | ||
1070 | retval = rt2800_enable_wlan_rt3290(rt2x00dev); | ||
1071 | |||
1072 | if (retval) | ||
1073 | return retval; | ||
1074 | } | ||
1075 | |||
1076 | /* | ||
1077 | * This device has multiple filters for control frames | 1006 | * This device has multiple filters for control frames |
1078 | * and has a separate filter for PS Poll frames. | 1007 | * and has a separate filter for PS Poll frames. |
1079 | */ | 1008 | */ |