diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-09-07 15:07:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-07 15:07:55 -0400 |
commit | fac805f8c198092de9a2842efd7f5022e2937b18 (patch) | |
tree | 7557809c373f97a343c427d8fded0696060394ce /drivers/net/wireless/rt2x00 | |
parent | 2461c7d60f9f3821274e4acf9019cba8b82c94b5 (diff) | |
parent | f10723841e624c0726c70356b31d91befed01dd6 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.h | 17 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 69 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 80 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.h | 3 |
13 files changed, 160 insertions, 85 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 8b9dbd76a252..64328af496f5 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1611,6 +1611,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1611 | static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 1611 | static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
1612 | { | 1612 | { |
1613 | int retval; | 1613 | int retval; |
1614 | u32 reg; | ||
1614 | 1615 | ||
1615 | /* | 1616 | /* |
1616 | * Allocate eeprom data. | 1617 | * Allocate eeprom data. |
@@ -1624,6 +1625,14 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1624 | return retval; | 1625 | return retval; |
1625 | 1626 | ||
1626 | /* | 1627 | /* |
1628 | * Enable rfkill polling by setting GPIO direction of the | ||
1629 | * rfkill switch GPIO pin correctly. | ||
1630 | */ | ||
1631 | rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); | ||
1632 | rt2x00_set_field32(®, GPIOCSR_BIT8, 1); | ||
1633 | rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg); | ||
1634 | |||
1635 | /* | ||
1627 | * Initialize hw specifications. | 1636 | * Initialize hw specifications. |
1628 | */ | 1637 | */ |
1629 | retval = rt2400pci_probe_hw_mode(rt2x00dev); | 1638 | retval = rt2400pci_probe_hw_mode(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.h b/drivers/net/wireless/rt2x00/rt2400pci.h index d3a4a68cc439..7564ae992b73 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.h +++ b/drivers/net/wireless/rt2x00/rt2400pci.h | |||
@@ -670,6 +670,7 @@ | |||
670 | #define GPIOCSR_BIT5 FIELD32(0x00000020) | 670 | #define GPIOCSR_BIT5 FIELD32(0x00000020) |
671 | #define GPIOCSR_BIT6 FIELD32(0x00000040) | 671 | #define GPIOCSR_BIT6 FIELD32(0x00000040) |
672 | #define GPIOCSR_BIT7 FIELD32(0x00000080) | 672 | #define GPIOCSR_BIT7 FIELD32(0x00000080) |
673 | #define GPIOCSR_BIT8 FIELD32(0x00000100) | ||
673 | 674 | ||
674 | /* | 675 | /* |
675 | * BBPPCSR: BBP Pin control register. | 676 | * BBPPCSR: BBP Pin control register. |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index d2cf8a4bc8b5..3de0406735f6 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1929,6 +1929,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1929 | static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 1929 | static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
1930 | { | 1930 | { |
1931 | int retval; | 1931 | int retval; |
1932 | u32 reg; | ||
1932 | 1933 | ||
1933 | /* | 1934 | /* |
1934 | * Allocate eeprom data. | 1935 | * Allocate eeprom data. |
@@ -1942,6 +1943,14 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1942 | return retval; | 1943 | return retval; |
1943 | 1944 | ||
1944 | /* | 1945 | /* |
1946 | * Enable rfkill polling by setting GPIO direction of the | ||
1947 | * rfkill switch GPIO pin correctly. | ||
1948 | */ | ||
1949 | rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); | ||
1950 | rt2x00_set_field32(®, GPIOCSR_DIR0, 1); | ||
1951 | rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg); | ||
1952 | |||
1953 | /* | ||
1945 | * Initialize hw specifications. | 1954 | * Initialize hw specifications. |
1946 | */ | 1955 | */ |
1947 | retval = rt2500pci_probe_hw_mode(rt2x00dev); | 1956 | retval = rt2500pci_probe_hw_mode(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 3aae36bb0a9e..89fee311d8fd 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -283,7 +283,7 @@ static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
283 | u16 reg; | 283 | u16 reg; |
284 | 284 | ||
285 | rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); | 285 | rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); |
286 | return rt2x00_get_field32(reg, MAC_CSR19_BIT7); | 286 | return rt2x00_get_field16(reg, MAC_CSR19_BIT7); |
287 | } | 287 | } |
288 | 288 | ||
289 | #ifdef CONFIG_RT2X00_LIB_LEDS | 289 | #ifdef CONFIG_RT2X00_LIB_LEDS |
@@ -1768,6 +1768,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1768 | static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) | 1768 | static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) |
1769 | { | 1769 | { |
1770 | int retval; | 1770 | int retval; |
1771 | u16 reg; | ||
1771 | 1772 | ||
1772 | /* | 1773 | /* |
1773 | * Allocate eeprom data. | 1774 | * Allocate eeprom data. |
@@ -1781,6 +1782,14 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1781 | return retval; | 1782 | return retval; |
1782 | 1783 | ||
1783 | /* | 1784 | /* |
1785 | * Enable rfkill polling by setting GPIO direction of the | ||
1786 | * rfkill switch GPIO pin correctly. | ||
1787 | */ | ||
1788 | rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); | ||
1789 | rt2x00_set_field16(®, MAC_CSR19_BIT8, 0); | ||
1790 | rt2500usb_register_write(rt2x00dev, MAC_CSR19, reg); | ||
1791 | |||
1792 | /* | ||
1784 | * Initialize hw specifications. | 1793 | * Initialize hw specifications. |
1785 | */ | 1794 | */ |
1786 | retval = rt2500usb_probe_hw_mode(rt2x00dev); | 1795 | retval = rt2500usb_probe_hw_mode(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h index b493306a7eed..196bd5103e4f 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.h +++ b/drivers/net/wireless/rt2x00/rt2500usb.h | |||
@@ -189,14 +189,15 @@ | |||
189 | * MAC_CSR19: GPIO control register. | 189 | * MAC_CSR19: GPIO control register. |
190 | */ | 190 | */ |
191 | #define MAC_CSR19 0x0426 | 191 | #define MAC_CSR19 0x0426 |
192 | #define MAC_CSR19_BIT0 FIELD32(0x0001) | 192 | #define MAC_CSR19_BIT0 FIELD16(0x0001) |
193 | #define MAC_CSR19_BIT1 FIELD32(0x0002) | 193 | #define MAC_CSR19_BIT1 FIELD16(0x0002) |
194 | #define MAC_CSR19_BIT2 FIELD32(0x0004) | 194 | #define MAC_CSR19_BIT2 FIELD16(0x0004) |
195 | #define MAC_CSR19_BIT3 FIELD32(0x0008) | 195 | #define MAC_CSR19_BIT3 FIELD16(0x0008) |
196 | #define MAC_CSR19_BIT4 FIELD32(0x0010) | 196 | #define MAC_CSR19_BIT4 FIELD16(0x0010) |
197 | #define MAC_CSR19_BIT5 FIELD32(0x0020) | 197 | #define MAC_CSR19_BIT5 FIELD16(0x0020) |
198 | #define MAC_CSR19_BIT6 FIELD32(0x0040) | 198 | #define MAC_CSR19_BIT6 FIELD16(0x0040) |
199 | #define MAC_CSR19_BIT7 FIELD32(0x0080) | 199 | #define MAC_CSR19_BIT7 FIELD16(0x0080) |
200 | #define MAC_CSR19_BIT8 FIELD16(0x0100) | ||
200 | 201 | ||
201 | /* | 202 | /* |
202 | * MAC_CSR20: LED control register. | 203 | * MAC_CSR20: LED control register. |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 88455b1b9fe0..b93516d832fb 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, |
@@ -4021,6 +4089,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
4021 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | 4089 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); |
4022 | msleep(1); | 4090 | msleep(1); |
4023 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); | 4091 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); |
4092 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); | ||
4024 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | 4093 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); |
4025 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | 4094 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); |
4026 | } | 4095 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 235376e9cb04..4765bbd654cd 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -980,69 +980,10 @@ 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; |
986 | u32 reg; | ||
1046 | 987 | ||
1047 | /* | 988 | /* |
1048 | * Allocate eeprom data. | 989 | * Allocate eeprom data. |
@@ -1056,6 +997,14 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1056 | return retval; | 997 | return retval; |
1057 | 998 | ||
1058 | /* | 999 | /* |
1000 | * Enable rfkill polling by setting GPIO direction of the | ||
1001 | * rfkill switch GPIO pin correctly. | ||
1002 | */ | ||
1003 | rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); | ||
1004 | rt2x00_set_field32(®, GPIO_CTRL_CFG_GPIOD_BIT2, 1); | ||
1005 | rt2x00pci_register_write(rt2x00dev, GPIO_CTRL_CFG, reg); | ||
1006 | |||
1007 | /* | ||
1059 | * Initialize hw specifications. | 1008 | * Initialize hw specifications. |
1060 | */ | 1009 | */ |
1061 | retval = rt2800_probe_hw_mode(rt2x00dev); | 1010 | retval = rt2800_probe_hw_mode(rt2x00dev); |
@@ -1063,17 +1012,6 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1063 | return retval; | 1012 | return retval; |
1064 | 1013 | ||
1065 | /* | 1014 | /* |
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 | 1015 | * This device has multiple filters for control frames |
1078 | * and has a separate filter for PS Poll frames. | 1016 | * and has a separate filter for PS Poll frames. |
1079 | */ | 1017 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 6cf336595e25..6b4226b71618 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -667,8 +667,16 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
667 | skb_pull(entry->skb, RXINFO_DESC_SIZE); | 667 | skb_pull(entry->skb, RXINFO_DESC_SIZE); |
668 | 668 | ||
669 | /* | 669 | /* |
670 | * FIXME: we need to check for rx_pkt_len validity | 670 | * Check for rx_pkt_len validity. Return if invalid, leaving |
671 | * rxdesc->size zeroed out by the upper level. | ||
671 | */ | 672 | */ |
673 | if (unlikely(rx_pkt_len == 0 || | ||
674 | rx_pkt_len > entry->queue->data_size)) { | ||
675 | ERROR(entry->queue->rt2x00dev, | ||
676 | "Bad frame size %d, forcing to 0\n", rx_pkt_len); | ||
677 | return; | ||
678 | } | ||
679 | |||
672 | rxd = (__le32 *)(entry->skb->data + rx_pkt_len); | 680 | rxd = (__le32 *)(entry->skb->data + rx_pkt_len); |
673 | 681 | ||
674 | /* | 682 | /* |
@@ -736,6 +744,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
736 | static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) | 744 | static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) |
737 | { | 745 | { |
738 | int retval; | 746 | int retval; |
747 | u32 reg; | ||
739 | 748 | ||
740 | /* | 749 | /* |
741 | * Allocate eeprom data. | 750 | * Allocate eeprom data. |
@@ -749,6 +758,14 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
749 | return retval; | 758 | return retval; |
750 | 759 | ||
751 | /* | 760 | /* |
761 | * Enable rfkill polling by setting GPIO direction of the | ||
762 | * rfkill switch GPIO pin correctly. | ||
763 | */ | ||
764 | rt2x00usb_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); | ||
765 | rt2x00_set_field32(®, GPIO_CTRL_CFG_GPIOD_BIT2, 1); | ||
766 | rt2x00usb_register_write(rt2x00dev, GPIO_CTRL_CFG, reg); | ||
767 | |||
768 | /* | ||
752 | * Initialize hw specifications. | 769 | * Initialize hw specifications. |
753 | */ | 770 | */ |
754 | retval = rt2800_probe_hw_mode(rt2x00dev); | 771 | retval = rt2800_probe_hw_mode(rt2x00dev); |
@@ -1157,6 +1174,8 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1157 | { USB_DEVICE(0x1690, 0x0744) }, | 1174 | { USB_DEVICE(0x1690, 0x0744) }, |
1158 | { USB_DEVICE(0x1690, 0x0761) }, | 1175 | { USB_DEVICE(0x1690, 0x0761) }, |
1159 | { USB_DEVICE(0x1690, 0x0764) }, | 1176 | { USB_DEVICE(0x1690, 0x0764) }, |
1177 | /* ASUS */ | ||
1178 | { USB_DEVICE(0x0b05, 0x179d) }, | ||
1160 | /* Cisco */ | 1179 | /* Cisco */ |
1161 | { USB_DEVICE(0x167b, 0x4001) }, | 1180 | { USB_DEVICE(0x167b, 0x4001) }, |
1162 | /* EnGenius */ | 1181 | /* EnGenius */ |
@@ -1222,7 +1241,6 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1222 | { USB_DEVICE(0x0b05, 0x1760) }, | 1241 | { USB_DEVICE(0x0b05, 0x1760) }, |
1223 | { USB_DEVICE(0x0b05, 0x1761) }, | 1242 | { USB_DEVICE(0x0b05, 0x1761) }, |
1224 | { USB_DEVICE(0x0b05, 0x1790) }, | 1243 | { USB_DEVICE(0x0b05, 0x1790) }, |
1225 | { USB_DEVICE(0x0b05, 0x179d) }, | ||
1226 | /* AzureWave */ | 1244 | /* AzureWave */ |
1227 | { USB_DEVICE(0x13d3, 0x3262) }, | 1245 | { USB_DEVICE(0x13d3, 0x3262) }, |
1228 | { USB_DEVICE(0x13d3, 0x3284) }, | 1246 | { USB_DEVICE(0x13d3, 0x3284) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index a59048ffa092..10cf67267775 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -629,7 +629,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp) | |||
629 | */ | 629 | */ |
630 | if (unlikely(rxdesc.size == 0 || | 630 | if (unlikely(rxdesc.size == 0 || |
631 | rxdesc.size > entry->queue->data_size)) { | 631 | rxdesc.size > entry->queue->data_size)) { |
632 | WARNING(rt2x00dev, "Wrong frame size %d max %d.\n", | 632 | ERROR(rt2x00dev, "Wrong frame size %d max %d.\n", |
633 | rxdesc.size, entry->queue->data_size); | 633 | rxdesc.size, entry->queue->data_size); |
634 | dev_kfree_skb(entry->skb); | 634 | dev_kfree_skb(entry->skb); |
635 | goto renew_skb; | 635 | goto renew_skb; |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index f32259686b45..b8ec96163922 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2243,8 +2243,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
2243 | 2243 | ||
2244 | static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev) | 2244 | static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev) |
2245 | { | 2245 | { |
2246 | struct ieee80211_conf conf = { .flags = 0 }; | 2246 | struct rt2x00lib_conf libconf = { .conf = &rt2x00dev->hw->conf }; |
2247 | struct rt2x00lib_conf libconf = { .conf = &conf }; | ||
2248 | 2247 | ||
2249 | rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); | 2248 | rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); |
2250 | } | 2249 | } |
@@ -2833,6 +2832,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2833 | static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 2832 | static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
2834 | { | 2833 | { |
2835 | int retval; | 2834 | int retval; |
2835 | u32 reg; | ||
2836 | 2836 | ||
2837 | /* | 2837 | /* |
2838 | * Disable power saving. | 2838 | * Disable power saving. |
@@ -2851,6 +2851,14 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
2851 | return retval; | 2851 | return retval; |
2852 | 2852 | ||
2853 | /* | 2853 | /* |
2854 | * Enable rfkill polling by setting GPIO direction of the | ||
2855 | * rfkill switch GPIO pin correctly. | ||
2856 | */ | ||
2857 | rt2x00pci_register_read(rt2x00dev, MAC_CSR13, ®); | ||
2858 | rt2x00_set_field32(®, MAC_CSR13_BIT13, 1); | ||
2859 | rt2x00pci_register_write(rt2x00dev, MAC_CSR13, reg); | ||
2860 | |||
2861 | /* | ||
2854 | * Initialize hw specifications. | 2862 | * Initialize hw specifications. |
2855 | */ | 2863 | */ |
2856 | retval = rt61pci_probe_hw_mode(rt2x00dev); | 2864 | retval = rt61pci_probe_hw_mode(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h index e3cd6db76b0e..8f3da5a56766 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.h +++ b/drivers/net/wireless/rt2x00/rt61pci.h | |||
@@ -372,6 +372,7 @@ struct hw_pairwise_ta_entry { | |||
372 | #define MAC_CSR13_BIT10 FIELD32(0x00000400) | 372 | #define MAC_CSR13_BIT10 FIELD32(0x00000400) |
373 | #define MAC_CSR13_BIT11 FIELD32(0x00000800) | 373 | #define MAC_CSR13_BIT11 FIELD32(0x00000800) |
374 | #define MAC_CSR13_BIT12 FIELD32(0x00001000) | 374 | #define MAC_CSR13_BIT12 FIELD32(0x00001000) |
375 | #define MAC_CSR13_BIT13 FIELD32(0x00002000) | ||
375 | 376 | ||
376 | /* | 377 | /* |
377 | * MAC_CSR14: LED control register. | 378 | * MAC_CSR14: LED control register. |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index ba6e434b859d..248436c13ce0 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2177 | static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) | 2177 | static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) |
2178 | { | 2178 | { |
2179 | int retval; | 2179 | int retval; |
2180 | u32 reg; | ||
2180 | 2181 | ||
2181 | /* | 2182 | /* |
2182 | * Allocate eeprom data. | 2183 | * Allocate eeprom data. |
@@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
2190 | return retval; | 2191 | return retval; |
2191 | 2192 | ||
2192 | /* | 2193 | /* |
2194 | * Enable rfkill polling by setting GPIO direction of the | ||
2195 | * rfkill switch GPIO pin correctly. | ||
2196 | */ | ||
2197 | rt2x00usb_register_read(rt2x00dev, MAC_CSR13, ®); | ||
2198 | rt2x00_set_field32(®, MAC_CSR13_BIT15, 0); | ||
2199 | rt2x00usb_register_write(rt2x00dev, MAC_CSR13, reg); | ||
2200 | |||
2201 | /* | ||
2193 | * Initialize hw specifications. | 2202 | * Initialize hw specifications. |
2194 | */ | 2203 | */ |
2195 | retval = rt73usb_probe_hw_mode(rt2x00dev); | 2204 | retval = rt73usb_probe_hw_mode(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h index 9f6b470414d3..df1cc116b83b 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.h +++ b/drivers/net/wireless/rt2x00/rt73usb.h | |||
@@ -282,6 +282,9 @@ struct hw_pairwise_ta_entry { | |||
282 | #define MAC_CSR13_BIT10 FIELD32(0x00000400) | 282 | #define MAC_CSR13_BIT10 FIELD32(0x00000400) |
283 | #define MAC_CSR13_BIT11 FIELD32(0x00000800) | 283 | #define MAC_CSR13_BIT11 FIELD32(0x00000800) |
284 | #define MAC_CSR13_BIT12 FIELD32(0x00001000) | 284 | #define MAC_CSR13_BIT12 FIELD32(0x00001000) |
285 | #define MAC_CSR13_BIT13 FIELD32(0x00002000) | ||
286 | #define MAC_CSR13_BIT14 FIELD32(0x00004000) | ||
287 | #define MAC_CSR13_BIT15 FIELD32(0x00008000) | ||
285 | 288 | ||
286 | /* | 289 | /* |
287 | * MAC_CSR14: LED control register. | 290 | * MAC_CSR14: LED control register. |