rt2x00: Fixes and cleanups.
cover rt2x00: Fixes and cleanups.
This patch series contains:
1. Moving the ASUS USB-N53 device ID from the set of unknown devices to the set of RT3572 devices.
2. A large set of fixes for the various rt2x00 drivers to fix the issue that the value of the rfkill switch wasn't read properly at device startup, preventing users to create an interface on the device and start that interface.
Thanks to Andreas Messer for reporting the issue and
finding the root cause of the issue.
3. A clean-up of the rt2800 drivers, in which now more code is shared between rt2800pci and rt2800usb.
John, all but the last patches are marked to be included in stable as well, so the logical tree would be wireless for them. The last patch is a cleanup, however, which would be targetted at wireless-next. Unfortunately, that patch depends on the first 13 in the series.
I'll leave it up to you to decide how that handle the series.
---
Gertjan.
Gertjan van Wingerde (14):
rt2x00: Identify ASUS USB-N53 device.
rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
rt2x00: Fix rt2400pci rfkill polling prior to interface start.
rt2x00: Align rt2500pci GPIOCSR definition with datasheet.
rt2x00: Fix rt2500pci rfkill polling prior to interface start.
rt2x00: Align rt2500usb MAC_CSR19 definition with datasheet.
rt2x00: Fix rt2500usb rfkill polling prior to interface start.
rt2x00: Align rt61pci MAC_CSR13 definition with datasheet.
rt2x00: Fix rt61pci rfkill polling prior to interface start.
rt2x00: Align rt73usb MAC_CSR13 definition with datasheet.
rt2x00: Fix rt73usb rfkill polling prior to interface start.
rt2x00: Align rt2800 GPIO_CTRL definition with datasheet.
rt2x00: Fix rt2800 rfkill polling prior to interface start.
rt2x00: rt2800 - Make probe_hw function common between PCI and USB.
drivers/net/wireless/rt2x00/rt2400pci.c | 11 ++- drivers/net/wireless/rt2x00/rt2400pci.h | 26 +++++-- drivers/net/wireless/rt2x00/rt2500pci.c | 11 ++- drivers/net/wireless/rt2x00/rt2500pci.h | 18 +++-- drivers/net/wireless/rt2x00/rt2500usb.c | 11 ++- drivers/net/wireless/rt2x00/rt2500usb.h | 26 +++++-- drivers/net/wireless/rt2x00/rt2800.h | 47 +++++++----- drivers/net/wireless/rt2x00/rt2800lib.c | 125 +++++++++++++++++++++++++------- drivers/net/wireless/rt2x00/rt2800lib.h | 14 +++- drivers/net/wireless/rt2x00/rt2800pci.c | 74 +------------------ drivers/net/wireless/rt2x00/rt2800usb.c | 56 ++------------ drivers/net/wireless/rt2x00/rt61pci.c | 19 +++-- drivers/net/wireless/rt2x00/rt61pci.h | 27 +++---- drivers/net/wireless/rt2x00/rt73usb.c | 11 ++- drivers/net/wireless/rt2x00/rt73usb.h | 31 ++++---- 15 files changed, 280 insertions(+), 227 deletions(-)
Signature · 1 line
1.7.11.1
PATCH 2/14 rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
In reply to Gertjan van WingerdeDatasheet indicates additional fields to set the GPIO direction. At the same time rename GPIOCSR_BIT<x> to GPIOCSR_VAL<x> to represent the actual meaning better.
drivers/net/wireless/rt2x00/rt2400pci.c +1 -1
@@ -205,7 +205,7 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)u32 reg;rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®); -return rt2x00_get_field32 (reg,GPIOCSR_BIT0 ); +return rt2x00_get_field32 (reg,GPIOCSR_VAL0 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
drivers/net/wireless/rt2x00/rt2400pci.h +18 -8
@@ -660,16 +660,26 @@/* * GPIOCSR: GPIO control register. +* GPIOCSR_VALx: Actual GPIO pin x value +* GPIOCSR_DIRx: GPIO direction: 0 = output; 1 = input */ #define GPIOCSR 0x0120 -#define GPIOCSR_BIT0 FIELD32(0x00000001) -#define GPIOCSR_BIT1 FIELD32(0x00000002) -#define GPIOCSR_BIT2 FIELD32(0x00000004) -#define GPIOCSR_BIT3 FIELD32(0x00000008) -#define GPIOCSR_BIT4 FIELD32(0x00000010) -#define GPIOCSR_BIT5 FIELD32(0x00000020) -#define GPIOCSR_BIT6 FIELD32(0x00000040) -#define GPIOCSR_BIT7 FIELD32(0x00000080) +#define GPIOCSR_VAL0 FIELD32(0x00000001) +#define GPIOCSR_VAL1 FIELD32(0x00000002) +#define GPIOCSR_VAL2 FIELD32(0x00000004) +#define GPIOCSR_VAL3 FIELD32(0x00000008) +#define GPIOCSR_VAL4 FIELD32(0x00000010) +#define GPIOCSR_VAL5 FIELD32(0x00000020) +#define GPIOCSR_VAL6 FIELD32(0x00000040) +#define GPIOCSR_VAL7 FIELD32(0x00000080) +#define GPIOCSR_DIR0 FIELD32(0x00000100) +#define GPIOCSR_DIR1 FIELD32(0x00000200) +#define GPIOCSR_DIR2 FIELD32(0x00000400) +#define GPIOCSR_DIR3 FIELD32(0x00000800) +#define GPIOCSR_DIR4 FIELD32(0x00001000) +#define GPIOCSR_DIR5 FIELD32(0x00002000) +#define GPIOCSR_DIR6 FIELD32(0x00004000) +#define GPIOCSR_DIR7 FIELD32(0x00008000)/* * BBPPCSR: BBP Pin control register.
Signature · 1 line
1.7.11.1
PATCH 3/14 rt2x00: Fix rt2400pci rfkill polling prior to interface start.
We need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt2400pci.c +9 -0
@@ -1611,6 +1611,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt2400pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -1624,6 +1625,14 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®); +rt2x00_set_field32 (®,GPIOCSR_DIR0 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIOCSR , reg); + +/* * Initialize hw specifications. */ retval =rt2400pci_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 4/14 rt2x00: Align rt2500pci GPIOCSR definition with datasheet.
Rename GPIOCSR_BIT<x> to GPIOCSR_VAL<x> to represent the actual meaning better.
drivers/net/wireless/rt2x00/rt2500pci.c +1 -1
@@ -205,7 +205,7 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)u32 reg;rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®); -return rt2x00_get_field32 (reg,GPIOCSR_BIT0 ); +return rt2x00_get_field32 (reg,GPIOCSR_VAL0 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
drivers/net/wireless/rt2x00/rt2500pci.h +10 -8
@@ -789,16 +789,18 @@/* * GPIOCSR: GPIO control register. +* GPIOCSR_VALx: GPIO value +* GPIOCSR_DIRx: GPIO direction: 0 = output; 1 = input */ #define GPIOCSR 0x0120 -#define GPIOCSR_BIT0 FIELD32(0x00000001) -#define GPIOCSR_BIT1 FIELD32(0x00000002) -#define GPIOCSR_BIT2 FIELD32(0x00000004) -#define GPIOCSR_BIT3 FIELD32(0x00000008) -#define GPIOCSR_BIT4 FIELD32(0x00000010) -#define GPIOCSR_BIT5 FIELD32(0x00000020) -#define GPIOCSR_BIT6 FIELD32(0x00000040) -#define GPIOCSR_BIT7 FIELD32(0x00000080) +#define GPIOCSR_VAL0 FIELD32(0x00000001) +#define GPIOCSR_VAL1 FIELD32(0x00000002) +#define GPIOCSR_VAL2 FIELD32(0x00000004) +#define GPIOCSR_VAL3 FIELD32(0x00000008) +#define GPIOCSR_VAL4 FIELD32(0x00000010) +#define GPIOCSR_VAL5 FIELD32(0x00000020) +#define GPIOCSR_VAL6 FIELD32(0x00000040) +#define GPIOCSR_VAL7 FIELD32(0x00000080)#define GPIOCSR_DIR0 FIELD32(0x00000100)#define GPIOCSR_DIR1 FIELD32(0x00000200)#define GPIOCSR_DIR2 FIELD32(0x00000400)
Signature · 1 line
1.7.11.1
PATCH 8/14 rt2x00: Align rt61pci MAC_CSR13 definition with datasheet.
In reply to Gertjan van WingerdeRename MAC_CSR13_BIT<x> to MAC_CSR13_VAL<x> and MAC_CSR13_DIR<x> to represent the actual meaning better.
Clean up list to only mention the active GPIO pins, not just all bits.
drivers/net/wireless/rt2x00/rt61pci.c +5 -5
@@ -243,7 +243,7 @@ static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)u32 reg;rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); -return rt2x00_get_field32 (reg,MAC_CSR13_BIT5 ); +return rt2x00_get_field32 (reg,MAC_CSR13_VAL5 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
@@ -715,11 +715,11 @@ static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev,rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); -rt2x00_set_field32 (®,MAC_CSR13_BIT4 , p1); -rt2x00_set_field32 (®,MAC_CSR13_BIT12 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_DIR4 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_VAL4 , p1); -rt2x00_set_field32 (®,MAC_CSR13_BIT3 , !p2); -rt2x00_set_field32 (®,MAC_CSR13_BIT11 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_DIR3 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_VAL3 , !p2);rt2x00pci_register_write (rt2x00dev,MAC_CSR13 , reg); }
drivers/net/wireless/rt2x00/rt61pci.h +14 -13
@@ -357,21 +357,22 @@ struct hw_pairwise_ta_entry {/* * MAC_CSR13: GPIO. +* MAC_CSR13_VALx: GPIO value +* MAC_CSR13_DIRx: GPIO direction: 0 = output; 1 = input */ #define MAC_CSR13 0x3034 -#define MAC_CSR13_BIT0 FIELD32(0x00000001) -#define MAC_CSR13_BIT1 FIELD32(0x00000002) -#define MAC_CSR13_BIT2 FIELD32(0x00000004) -#define MAC_CSR13_BIT3 FIELD32(0x00000008) -#define MAC_CSR13_BIT4 FIELD32(0x00000010) -#define MAC_CSR13_BIT5 FIELD32(0x00000020) -#define MAC_CSR13_BIT6 FIELD32(0x00000040) -#define MAC_CSR13_BIT7 FIELD32(0x00000080) -#define MAC_CSR13_BIT8 FIELD32(0x00000100) -#define MAC_CSR13_BIT9 FIELD32(0x00000200) -#define MAC_CSR13_BIT10 FIELD32(0x00000400) -#define MAC_CSR13_BIT11 FIELD32(0x00000800) -#define MAC_CSR13_BIT12 FIELD32(0x00001000) +#define MAC_CSR13_VAL0 FIELD32(0x00000001) +#define MAC_CSR13_VAL1 FIELD32(0x00000002) +#define MAC_CSR13_VAL2 FIELD32(0x00000004) +#define MAC_CSR13_VAL3 FIELD32(0x00000008) +#define MAC_CSR13_VAL4 FIELD32(0x00000010) +#define MAC_CSR13_VAL5 FIELD32(0x00000020) +#define MAC_CSR13_DIR0 FIELD32(0x00000100) +#define MAC_CSR13_DIR1 FIELD32(0x00000200) +#define MAC_CSR13_DIR2 FIELD32(0x00000400) +#define MAC_CSR13_DIR3 FIELD32(0x00000800) +#define MAC_CSR13_DIR4 FIELD32(0x00001000) +#define MAC_CSR13_DIR5 FIELD32(0x00002000)/* * MAC_CSR14: LED control register.
Signature · 1 line
1.7.11.1
PATCH 6/14 rt2x00: Align rt2500usb MAC_CSR19 definition with datasheet.
In reply to Gertjan van WingerdeDatasheet indicates additional fields to set the GPIO direction. At the same time rename MAC_CSR19_BIT<x> to MAC_CSR19_VAL<x> to represent the actual meaning better.
Also, rt2500usb has 16-bit register values, not 32-bit register values.
drivers/net/wireless/rt2x00/rt2500usb.c +1 -1
@@ -283,7 +283,7 @@ static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)u16 reg;rt2500usb_register_read (rt2x00dev,MAC_CSR19 , ®); -return rt2x00_get_field32 (reg,MAC_CSR19_BIT7 ); +return rt2x00_get_field16 (reg,MAC_CSR19_VAL7 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
drivers/net/wireless/rt2x00/rt2500usb.h +18 -8
@@ -187,16 +187,26 @@/* * MAC_CSR19: GPIO control register. +* MAC_CSR19_VALx: GPIO value +* MAC_CSR19_DIRx: GPIO direction: 0 = input; 1 = output */ #define MAC_CSR19 0x0426 -#define MAC_CSR19_BIT0 FIELD32(0x0001) -#define MAC_CSR19_BIT1 FIELD32(0x0002) -#define MAC_CSR19_BIT2 FIELD32(0x0004) -#define MAC_CSR19_BIT3 FIELD32(0x0008) -#define MAC_CSR19_BIT4 FIELD32(0x0010) -#define MAC_CSR19_BIT5 FIELD32(0x0020) -#define MAC_CSR19_BIT6 FIELD32(0x0040) -#define MAC_CSR19_BIT7 FIELD32(0x0080) +#define MAC_CSR19_VAL0 FIELD16(0x0001) +#define MAC_CSR19_VAL1 FIELD16(0x0002) +#define MAC_CSR19_VAL2 FIELD16(0x0004) +#define MAC_CSR19_VAL3 FIELD16(0x0008) +#define MAC_CSR19_VAL4 FIELD16(0x0010) +#define MAC_CSR19_VAL5 FIELD16(0x0020) +#define MAC_CSR19_VAL6 FIELD16(0x0040) +#define MAC_CSR19_VAL7 FIELD16(0x0080) +#define MAC_CSR19_DIR0 FIELD16(0x0100) +#define MAC_CSR19_DIR1 FIELD16(0x0200) +#define MAC_CSR19_DIR2 FIELD16(0x0400) +#define MAC_CSR19_DIR3 FIELD16(0x0800) +#define MAC_CSR19_DIR4 FIELD32(0x1000) +#define MAC_CSR19_DIR5 FIELD16(0x2000) +#define MAC_CSR19_DIR6 FIELD16(0x4000) +#define MAC_CSR19_DIR7 FIELD16(0x8000)/* * MAC_CSR20: LED control register.
Signature · 1 line
1.7.11.1
PATCH 9/14 rt2x00: Fix rt61pci rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt61pci.c +9 -0
@@ -2832,6 +2832,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt61pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Disable power saving.
@@ -2850,6 +2851,14 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); +rt2x00_set_field32 (®,MAC_CSR13_DIR5 ,1 ); +rt2x00pci_register_write (rt2x00dev,MAC_CSR13 , reg); + +/* * Initialize hw specifications. */ retval =rt61pci_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 5/14 rt2x00: Fix rt2500pci rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt2500pci.c +9 -0
@@ -1929,6 +1929,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt2500pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -1942,6 +1943,14 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®); +rt2x00_set_field32 (®,GPIOCSR_DIR0 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIOCSR , reg); + +/* * Initialize hw specifications. */ retval =rt2500pci_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 7/14 rt2x00: Fix rt2500usb rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt2500usb.c +9 -0
@@ -1768,6 +1768,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt2500usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u16 reg;/* * Allocate eeprom data.
@@ -1781,6 +1782,14 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2500usb_register_read (rt2x00dev,MAC_CSR19 , ®); +rt2x00_set_field16 (®,MAC_CSR19_DIR0 ,0 ); +rt2500usb_register_write (rt2x00dev,MAC_CSR19 , reg); + +/* * Initialize hw specifications. */ retval =rt2500usb_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 1/14 rt2x00: Identify ASUS USB-N53 device.
In reply to Gertjan van WingerdeThis is an RT3572 based device.
drivers/net/wireless/rt2x00/rt2800usb.c +2 -1
@@ -1157,6 +1157,8 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x1690, 0x0744) }, { USB_DEVICE(0x1690, 0x0761) }, { USB_DEVICE(0x1690, 0x0764) }, +/* ASUS */ + { USB_DEVICE(0x0b05, 0x179d) },/* Cisco */ { USB_DEVICE(0x167b, 0x4001) },/* EnGenius */
@@ -1222,7 +1224,6 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x0b05, 0x1760) }, { USB_DEVICE(0x0b05, 0x1761) }, { USB_DEVICE(0x0b05, 0x1790) }, - { USB_DEVICE(0x0b05, 0x179d) },/* AzureWave */ { USB_DEVICE(0x13d3, 0x3262) }, { USB_DEVICE(0x13d3, 0x3284) },
Signature · 1 line
1.7.11.1
Re: [PATCH 02/14] rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
In reply to Gertjan van WingerdeHi,
Quoted 3 lines · Gertjan van Wingerde
Datasheet indicates additional fields to set the GPIO direction. At the same time rename GPIOCSR_BIT<x> to GPIOCSR_VAL<x> to represent the actual meaning better.
Micronit: could the latter be split into a separate patch from the former, to make life easier e.g. when bisecting?
Only the first part would be needed for stable@.
Thanks,
Jonathan
PATCH 10/17 rt2x00: Fix rt2500usb rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt2500usb.c +9 -0
@@ -1768,6 +1768,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt2500usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u16 reg;/* * Allocate eeprom data.
@@ -1781,6 +1782,14 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2500usb_register_read (rt2x00dev,MAC_CSR19 , ®); +rt2x00_set_field16 (®,MAC_CSR19_DIR0 ,0 ); +rt2500usb_register_write (rt2x00dev,MAC_CSR19 , reg); + +/* * Initialize hw specifications. */ retval =rt2500usb_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 11/17 rt2x00: Align rt61pci MAC_CSR13 definition with datasheet.
Rename MAC_CSR13_BIT<x> to MAC_CSR13_VAL<x> and MAC_CSR13_DIR<x> to represent the actual meaning better.
Clean up list to only mention the active GPIO pins, not just all bits.
drivers/net/wireless/rt2x00/rt61pci.c +5 -5
@@ -243,7 +243,7 @@ static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)u32 reg;rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); -return rt2x00_get_field32 (reg,MAC_CSR13_BIT5 ); +return rt2x00_get_field32 (reg,MAC_CSR13_VAL5 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
@@ -715,11 +715,11 @@ static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev,rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); -rt2x00_set_field32 (®,MAC_CSR13_BIT4 , p1); -rt2x00_set_field32 (®,MAC_CSR13_BIT12 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_DIR4 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_VAL4 , p1); -rt2x00_set_field32 (®,MAC_CSR13_BIT3 , !p2); -rt2x00_set_field32 (®,MAC_CSR13_BIT11 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_DIR3 ,0 ); +rt2x00_set_field32 (®,MAC_CSR13_VAL3 , !p2);rt2x00pci_register_write (rt2x00dev,MAC_CSR13 , reg); }
drivers/net/wireless/rt2x00/rt61pci.h +14 -13
@@ -357,21 +357,22 @@ struct hw_pairwise_ta_entry {/* * MAC_CSR13: GPIO. +* MAC_CSR13_VALx: GPIO value +* MAC_CSR13_DIRx: GPIO direction: 0 = output; 1 = input */ #define MAC_CSR13 0x3034 -#define MAC_CSR13_BIT0 FIELD32(0x00000001) -#define MAC_CSR13_BIT1 FIELD32(0x00000002) -#define MAC_CSR13_BIT2 FIELD32(0x00000004) -#define MAC_CSR13_BIT3 FIELD32(0x00000008) -#define MAC_CSR13_BIT4 FIELD32(0x00000010) -#define MAC_CSR13_BIT5 FIELD32(0x00000020) -#define MAC_CSR13_BIT6 FIELD32(0x00000040) -#define MAC_CSR13_BIT7 FIELD32(0x00000080) -#define MAC_CSR13_BIT8 FIELD32(0x00000100) -#define MAC_CSR13_BIT9 FIELD32(0x00000200) -#define MAC_CSR13_BIT10 FIELD32(0x00000400) -#define MAC_CSR13_BIT11 FIELD32(0x00000800) -#define MAC_CSR13_BIT12 FIELD32(0x00001000) +#define MAC_CSR13_VAL0 FIELD32(0x00000001) +#define MAC_CSR13_VAL1 FIELD32(0x00000002) +#define MAC_CSR13_VAL2 FIELD32(0x00000004) +#define MAC_CSR13_VAL3 FIELD32(0x00000008) +#define MAC_CSR13_VAL4 FIELD32(0x00000010) +#define MAC_CSR13_VAL5 FIELD32(0x00000020) +#define MAC_CSR13_DIR0 FIELD32(0x00000100) +#define MAC_CSR13_DIR1 FIELD32(0x00000200) +#define MAC_CSR13_DIR2 FIELD32(0x00000400) +#define MAC_CSR13_DIR3 FIELD32(0x00000800) +#define MAC_CSR13_DIR4 FIELD32(0x00001000) +#define MAC_CSR13_DIR5 FIELD32(0x00002000)/* * MAC_CSR14: LED control register.
Signature · 1 line
1.7.11.1
PATCH 10/14 rt2x00: Align rt73usb MAC_CSR13 definition with datasheet.
In reply to Gertjan van WingerdeRename MAC_CSR13_BIT<x> to MAC_CSR13_VAL<x> and MAC_CSR13_DIR<x> to represent the actual meaning better.
Clean up list to only mention the active GPIO pins, not just all bits.
drivers/net/wireless/rt2x00/rt73usb.c +1 -1
@@ -189,7 +189,7 @@ static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)u32 reg;rt2x00usb_register_read (rt2x00dev,MAC_CSR13 , ®); -return rt2x00_get_field32 (reg,MAC_CSR13_BIT7 ); +return rt2x00_get_field32 (reg,MAC_CSR13_VAL7 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
drivers/net/wireless/rt2x00/rt73usb.h +18 -13
@@ -267,21 +267,26 @@ struct hw_pairwise_ta_entry {/* * MAC_CSR13: GPIO. +* MAC_CSR13_VALx: GPIO value +* MAC_CSR13_DIRx: GPIO direction: 0 = input; 1 = output */ #define MAC_CSR13 0x3034 -#define MAC_CSR13_BIT0 FIELD32(0x00000001) -#define MAC_CSR13_BIT1 FIELD32(0x00000002) -#define MAC_CSR13_BIT2 FIELD32(0x00000004) -#define MAC_CSR13_BIT3 FIELD32(0x00000008) -#define MAC_CSR13_BIT4 FIELD32(0x00000010) -#define MAC_CSR13_BIT5 FIELD32(0x00000020) -#define MAC_CSR13_BIT6 FIELD32(0x00000040) -#define MAC_CSR13_BIT7 FIELD32(0x00000080) -#define MAC_CSR13_BIT8 FIELD32(0x00000100) -#define MAC_CSR13_BIT9 FIELD32(0x00000200) -#define MAC_CSR13_BIT10 FIELD32(0x00000400) -#define MAC_CSR13_BIT11 FIELD32(0x00000800) -#define MAC_CSR13_BIT12 FIELD32(0x00001000) +#define MAC_CSR13_VAL0 FIELD32(0x00000001) +#define MAC_CSR13_VAL1 FIELD32(0x00000002) +#define MAC_CSR13_VAL2 FIELD32(0x00000004) +#define MAC_CSR13_VAL3 FIELD32(0x00000008) +#define MAC_CSR13_VAL4 FIELD32(0x00000010) +#define MAC_CSR13_VAL5 FIELD32(0x00000020) +#define MAC_CSR13_VAL6 FIELD32(0x00000040) +#define MAC_CSR13_VAL7 FIELD32(0x00000080) +#define MAC_CSR13_DIR0 FIELD32(0x00000100) +#define MAC_CSR13_DIR1 FIELD32(0x00000200) +#define MAC_CSR13_DIR2 FIELD32(0x00000400) +#define MAC_CSR13_DIR3 FIELD32(0x00000800) +#define MAC_CSR13_DIR4 FIELD32(0x00001000) +#define MAC_CSR13_DIR5 FIELD32(0x00002000) +#define MAC_CSR13_DIR6 FIELD32(0x00004000) +#define MAC_CSR13_DIR7 FIELD32(0x00008000)/* * MAC_CSR14: LED control register.
Signature · 1 line
1.7.11.1
PATCH 11/14 rt2x00: Fix rt73usb rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt73usb.c +9 -0
@@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt73usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00usb_register_read (rt2x00dev,MAC_CSR13 , ®); +rt2x00_set_field32 (®,MAC_CSR13_DIR7 ,0 ); +rt2x00usb_register_write (rt2x00dev,MAC_CSR13 , reg); + +/* * Initialize hw specifications. */ retval =rt73usb_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 12/14 rt2x00: Align rt2800 GPIO_CTRL definition with datasheet.
Rename GPIO_CTRL_CFG to GPIO_CTRL as that is the name according to the datasheet.
Rename GPIO_CTRL_CFG_BIT<x> to GPIO_CTRL_VAL<x> and GPIO_CTRL_CFG_GPIOD_BIT<x> to GPIO_CTRL_DIR<x> to represent the actual meanings better.
Clean up list to mention all the active GPIO pins, not just a subset.
drivers/net/wireless/rt2x00/rt2800.h +27 -20
@@ -439,26 +439,33 @@#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)/* -* GPIO_CTRL_CFG: -* GPIOD: GPIO direction, 0: Output, 1: Input -*/ -#define GPIO_CTRL_CFG 0x0228 -#define GPIO_CTRL_CFG_BIT0 FIELD32(0x00000001) -#define GPIO_CTRL_CFG_BIT1 FIELD32(0x00000002) -#define GPIO_CTRL_CFG_BIT2 FIELD32(0x00000004) -#define GPIO_CTRL_CFG_BIT3 FIELD32(0x00000008) -#define GPIO_CTRL_CFG_BIT4 FIELD32(0x00000010) -#define GPIO_CTRL_CFG_BIT5 FIELD32(0x00000020) -#define GPIO_CTRL_CFG_BIT6 FIELD32(0x00000040) -#define GPIO_CTRL_CFG_BIT7 FIELD32(0x00000080) -#define GPIO_CTRL_CFG_GPIOD_BIT0 FIELD32(0x00000100) -#define GPIO_CTRL_CFG_GPIOD_BIT1 FIELD32(0x00000200) -#define GPIO_CTRL_CFG_GPIOD_BIT2 FIELD32(0x00000400) -#define GPIO_CTRL_CFG_GPIOD_BIT3 FIELD32(0x00000800) -#define GPIO_CTRL_CFG_GPIOD_BIT4 FIELD32(0x00001000) -#define GPIO_CTRL_CFG_GPIOD_BIT5 FIELD32(0x00002000) -#define GPIO_CTRL_CFG_GPIOD_BIT6 FIELD32(0x00004000) -#define GPIO_CTRL_CFG_GPIOD_BIT7 FIELD32(0x00008000) +* GPIO_CTRL: +* GPIO_CTRL_VALx: GPIO value +* GPIO_CTRL_DIRx: GPIO direction: 0 = output; 1 = input +*/ +#define GPIO_CTRL 0x0228 +#define GPIO_CTRL_VAL0 FIELD32(0x00000001) +#define GPIO_CTRL_VAL1 FIELD32(0x00000002) +#define GPIO_CTRL_VAL2 FIELD32(0x00000004) +#define GPIO_CTRL_VAL3 FIELD32(0x00000008) +#define GPIO_CTRL_VAL4 FIELD32(0x00000010) +#define GPIO_CTRL_VAL5 FIELD32(0x00000020) +#define GPIO_CTRL_VAL6 FIELD32(0x00000040) +#define GPIO_CTRL_VAL7 FIELD32(0x00000080) +#define GPIO_CTRL_DIR0 FIELD32(0x00000100) +#define GPIO_CTRL_DIR1 FIELD32(0x00000200) +#define GPIO_CTRL_DIR2 FIELD32(0x00000400) +#define GPIO_CTRL_DIR3 FIELD32(0x00000800) +#define GPIO_CTRL_DIR4 FIELD32(0x00001000) +#define GPIO_CTRL_DIR5 FIELD32(0x00002000) +#define GPIO_CTRL_DIR6 FIELD32(0x00004000) +#define GPIO_CTRL_DIR7 FIELD32(0x00008000) +#define GPIO_CTRL_VAL8 FIELD32(0x00010000) +#define GPIO_CTRL_VAL9 FIELD32(0x00020000) +#define GPIO_CTRL_VAL10 FIELD32(0x00040000) +#define GPIO_CTRL_DIR8 FIELD32(0x01000000) +#define GPIO_CTRL_DIR9 FIELD32(0x02000000) +#define GPIO_CTRL_DIR10 FIELD32(0x04000000)/* * MCU_CMD_CFG
drivers/net/wireless/rt2x00/rt2800lib.c +19 -19
@@ -923,8 +923,8 @@ int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2800_register_read (rt2x00dev,WLAN_FUN_CTRL , ®);return rt2x00_get_field32 (reg,WLAN_GPIO_IN_BIT0 ); }else { -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -return rt2x00_get_field32 (reg,GPIO_CTRL_CFG_BIT2 ); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +return rt2x00_get_field32 (reg,GPIO_CTRL_VAL2 ); } }EXPORT_SYMBOL_GPL (rt2800_rfkill_poll);
@@ -1570,10 +1570,10 @@ static void rt2800_set_ant_diversity(struct rt2x00_dev *rt2x00dev,rt2800_mcu_request (rt2x00dev,MCU_ANT_SELECT ,0xff , eesk_pin,0 ); -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT3 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT3 , gpio_bit3); -rt2800_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR3 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL3 , gpio_bit3); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg); }void rt2800_config_ant (struct rt2x00_dev *rt2x00dev,struct antenna_setup *ant)
@@ -1995,13 +1995,13 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,rt2800_rfcsr_write (rt2x00dev,29 ,0x9f ); } -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT7 ,0 ); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR7 ,0 );if (rf->channel <=14 ) -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT7 ,1 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL7 ,1 );else -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT7 ,0 ); -rt2800_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); +rt2x00_set_field32 (®,GPIO_CTRL_VAL7 ,0 ); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg);rt2800_rfcsr_read (rt2x00dev,7 , &rfcsr);rt2x00_set_field8 (&rfcsr,RFCSR7_RF_TUNING ,1 );
@@ -3587,16 +3587,16 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)if (test_bit (CAPABILITY_BT_COEXIST , &rt2x00dev->cap_flags)) {u32 reg; -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT3 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT6 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT3 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT6 ,0 ); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR3 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_DIR6 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL3 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL6 ,0 );if (ant ==0 ) -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT3 ,1 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL3 ,1 );else if (ant ==1 ) -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT6 ,1 ); -rt2800_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); +rt2x00_set_field32 (®,GPIO_CTRL_VAL6 ,1 ); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg); }/* This chip has hardware antenna diversity*/
Signature · 1 line
1.7.11.1
PATCH 12/17 rt2x00: Fix rt61pci rfkill polling prior to interface start.
We need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt61pci.c +9 -0
@@ -2832,6 +2832,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt61pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Disable power saving.
@@ -2850,6 +2851,14 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); +rt2x00_set_field32 (®,MAC_CSR13_DIR5 ,1 ); +rt2x00pci_register_write (rt2x00dev,MAC_CSR13 , reg); + +/* * Initialize hw specifications. */ retval =rt61pci_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 14/17 rt2x00: Fix rt73usb rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt73usb.c +9 -0
@@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)static int rt73usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00usb_register_read (rt2x00dev,MAC_CSR13 , ®); +rt2x00_set_field32 (®,MAC_CSR13_DIR7 ,0 ); +rt2x00usb_register_write (rt2x00dev,MAC_CSR13 , reg); + +/* * Initialize hw specifications. */ retval =rt73usb_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 14/14 rt2x00: rt2800 - Make probe_hw function common between PCI and USB.
Refactor the probe_hw code so that more code can be shared between rt2800pci and rt2800usb.
drivers/net/wireless/rt2x00/rt2800lib.c +81 -6
@@ -44,6 +44,13 @@#include "rt2800.h" /* +* Allow hardware encryption to be disabled. +*/ +static bool modparam_nohwcrypt = false; +module_param_named (nohwcrypt, modparam_nohwcrypt, bool,S_IRUGO ); +MODULE_PARM_DESC (nohwcrypt,"Disable hardware encryption." ); + +/* * Register access. * All access to the CSR registers will go through the methods * rt2800_register_read and rt2800_register_write.
@@ -4391,7 +4398,7 @@ void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) }EXPORT_SYMBOL_GPL (rt2800_read_eeprom_efuse); -int rt2800_validate_eeprom (struct rt2x00_dev *rt2x00dev) +static int rt2800_validate_eeprom (struct rt2x00_dev *rt2x00dev) {struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;u16 word;
@@ -4399,6 +4406,11 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)u8 default_lna_gain;/* +* Read the EEPROM. +*/ +rt2800_read_eeprom (rt2x00dev); + +/* * Start validation of the data that has been read. */ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );
@@ -4520,9 +4532,8 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_validate_eeprom); -int rt2800_init_eeprom (struct rt2x00_dev *rt2x00dev) +static int rt2800_init_eeprom (struct rt2x00_dev *rt2x00dev) {u32 reg;u16 value;
@@ -4680,7 +4691,6 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_init_eeprom);/* * RF value list for rt28xx
@@ -4823,7 +4833,7 @@ static const struct rf_channel rf_vals_3x[] = { {173, 0x61, 0, 9}, }; -int rt2800_probe_hw_mode (struct rt2x00_dev *rt2x00dev) +static int rt2800_probe_hw_mode (struct rt2x00_dev *rt2x00dev) {struct hw_mode_spec *spec = &rt2x00dev->spec;struct channel_info *info;
@@ -4999,7 +5009,72 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_probe_hw_mode); + +int rt2800_probe_hw (struct rt2x00_dev *rt2x00dev) +{ +int retval; +u32 reg; + +/* +* Allocate eeprom data. +*/ + retval =rt2800_validate_eeprom (rt2x00dev); +if (retval) +return retval; + + retval =rt2800_init_eeprom (rt2x00dev); +if (retval) +return retval; + +/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR2 ,1 ); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg); + +/* +* Initialize hw specifications. +*/ + retval =rt2800_probe_hw_mode (rt2x00dev); +if (retval) +return retval; + +/* +* Set device capabilities. +*/ +__set_bit (CAPABILITY_CONTROL_FILTERS , &rt2x00dev->cap_flags); +__set_bit (CAPABILITY_CONTROL_FILTER_PSPOLL , &rt2x00dev->cap_flags); +if (!rt2x00_is_usb (rt2x00dev)) +__set_bit (CAPABILITY_PRE_TBTT_INTERRUPT , &rt2x00dev->cap_flags); + +/* +* Set device requirements. +*/ +if (!rt2x00_is_soc (rt2x00dev)) +__set_bit (REQUIRE_FIRMWARE , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_L2PAD , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_TXSTATUS_FIFO , &rt2x00dev->cap_flags); +if (!modparam_nohwcrypt) +__set_bit (CAPABILITY_HW_CRYPTO , &rt2x00dev->cap_flags); +__set_bit (CAPABILITY_LINK_TUNING , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_HT_TX_DESC , &rt2x00dev->cap_flags); +if (rt2x00_is_usb (rt2x00dev)) +__set_bit (REQUIRE_PS_AUTOWAKE , &rt2x00dev->cap_flags); +else { +__set_bit (REQUIRE_DMA , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_TASKLET_CONTEXT , &rt2x00dev->cap_flags); + } + +/* +* Set the rssi offset. +*/ + rt2x00dev->rssi_offset =DEFAULT_RSSI_OFFSET ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (rt2800_probe_hw);/* * IEEE80211 stack callback functions.
drivers/net/wireless/rt2x00/rt2800lib.h +11 -3
@@ -43,6 +43,8 @@ struct rt2800_ops {const unsigned int offset, const struct rt2x00_field32 field, u32 *reg); +void (*read_eeprom)(struct rt2x00_dev *rt2x00dev); +int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,const u8 *data,const size_t len);int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
@@ -114,6 +116,13 @@ static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,return rt2800ops->regbusy_read (rt2x00dev, offset, field, reg); } +static inline void rt2800_read_eeprom (struct rt2x00_dev *rt2x00dev) +{ +const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; + + rt2800ops->read_eeprom (rt2x00dev); +} +static inline int rt2800_drv_write_firmware (struct rt2x00_dev *rt2x00dev,const u8 *data,const size_t len) {
@@ -191,9 +200,8 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);int rt2800_efuse_detect (struct rt2x00_dev *rt2x00dev);void rt2800_read_eeprom_efuse (struct rt2x00_dev *rt2x00dev); -int rt2800_validate_eeprom (struct rt2x00_dev *rt2x00dev); -int rt2800_init_eeprom (struct rt2x00_dev *rt2x00dev); -int rt2800_probe_hw_mode (struct rt2x00_dev *rt2x00dev); + +int rt2800_probe_hw (struct rt2x00_dev *rt2x00dev);void rt2800_get_tkip_seq (struct ieee80211_hw *hw,u8 hw_key_idx,u32 *iv32,u16 *iv16);
drivers/net/wireless/rt2x00/rt2800pci.c +3 -80
114 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2800usb.c +5 -57
97 lines not on this page · raw message
Signature · 1 line
1.7.11.1
PATCH 16/17 rt2x00: Fix rt2800 rfkill polling prior to interface start.
In reply to Gertjan van WingerdeWe need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt2800pci.c +9 -0
@@ -983,6 +983,7 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)static int rt2800pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -996,6 +997,14 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR2 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIO_CTRL , reg); + +/* * Initialize hw specifications. */ retval =rt2800_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt2800usb.c +9 -0
@@ -736,6 +736,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)static int rt2800usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -749,6 +750,14 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00usb_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR2 ,1 ); +rt2x00usb_register_write (rt2x00dev,GPIO_CTRL , reg); + +/* * Initialize hw specifications. */ retval =rt2800_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 17/17 rt2x00: rt2800 - Make probe_hw function common between PCI and USB.
Refactor the probe_hw code so that more code can be shared between rt2800pci and rt2800usb.
drivers/net/wireless/rt2x00/rt2800lib.c +81 -6
@@ -44,6 +44,13 @@#include "rt2800.h" /* +* Allow hardware encryption to be disabled. +*/ +static bool modparam_nohwcrypt = false; +module_param_named (nohwcrypt, modparam_nohwcrypt, bool,S_IRUGO ); +MODULE_PARM_DESC (nohwcrypt,"Disable hardware encryption." ); + +/* * Register access. * All access to the CSR registers will go through the methods * rt2800_register_read and rt2800_register_write.
@@ -4391,7 +4398,7 @@ void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) }EXPORT_SYMBOL_GPL (rt2800_read_eeprom_efuse); -int rt2800_validate_eeprom (struct rt2x00_dev *rt2x00dev) +static int rt2800_validate_eeprom (struct rt2x00_dev *rt2x00dev) {struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;u16 word;
@@ -4399,6 +4406,11 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)u8 default_lna_gain;/* +* Read the EEPROM. +*/ +rt2800_read_eeprom (rt2x00dev); + +/* * Start validation of the data that has been read. */ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );
@@ -4520,9 +4532,8 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_validate_eeprom); -int rt2800_init_eeprom (struct rt2x00_dev *rt2x00dev) +static int rt2800_init_eeprom (struct rt2x00_dev *rt2x00dev) {u32 reg;u16 value;
@@ -4680,7 +4691,6 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_init_eeprom);/* * RF value list for rt28xx
@@ -4823,7 +4833,7 @@ static const struct rf_channel rf_vals_3x[] = { {173, 0x61, 0, 9}, }; -int rt2800_probe_hw_mode (struct rt2x00_dev *rt2x00dev) +static int rt2800_probe_hw_mode (struct rt2x00_dev *rt2x00dev) {struct hw_mode_spec *spec = &rt2x00dev->spec;struct channel_info *info;
@@ -4999,7 +5009,72 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_probe_hw_mode); + +int rt2800_probe_hw (struct rt2x00_dev *rt2x00dev) +{ +int retval; +u32 reg; + +/* +* Allocate eeprom data. +*/ + retval =rt2800_validate_eeprom (rt2x00dev); +if (retval) +return retval; + + retval =rt2800_init_eeprom (rt2x00dev); +if (retval) +return retval; + +/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR2 ,1 ); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg); + +/* +* Initialize hw specifications. +*/ + retval =rt2800_probe_hw_mode (rt2x00dev); +if (retval) +return retval; + +/* +* Set device capabilities. +*/ +__set_bit (CAPABILITY_CONTROL_FILTERS , &rt2x00dev->cap_flags); +__set_bit (CAPABILITY_CONTROL_FILTER_PSPOLL , &rt2x00dev->cap_flags); +if (!rt2x00_is_usb (rt2x00dev)) +__set_bit (CAPABILITY_PRE_TBTT_INTERRUPT , &rt2x00dev->cap_flags); + +/* +* Set device requirements. +*/ +if (!rt2x00_is_soc (rt2x00dev)) +__set_bit (REQUIRE_FIRMWARE , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_L2PAD , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_TXSTATUS_FIFO , &rt2x00dev->cap_flags); +if (!modparam_nohwcrypt) +__set_bit (CAPABILITY_HW_CRYPTO , &rt2x00dev->cap_flags); +__set_bit (CAPABILITY_LINK_TUNING , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_HT_TX_DESC , &rt2x00dev->cap_flags); +if (rt2x00_is_usb (rt2x00dev)) +__set_bit (REQUIRE_PS_AUTOWAKE , &rt2x00dev->cap_flags); +else { +__set_bit (REQUIRE_DMA , &rt2x00dev->cap_flags); +__set_bit (REQUIRE_TASKLET_CONTEXT , &rt2x00dev->cap_flags); + } + +/* +* Set the rssi offset. +*/ + rt2x00dev->rssi_offset =DEFAULT_RSSI_OFFSET ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (rt2800_probe_hw);/* * IEEE80211 stack callback functions.
drivers/net/wireless/rt2x00/rt2800lib.h +11 -3
@@ -43,6 +43,8 @@ struct rt2800_ops {const unsigned int offset, const struct rt2x00_field32 field, u32 *reg); +void (*read_eeprom)(struct rt2x00_dev *rt2x00dev); +int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,const u8 *data,const size_t len);int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
@@ -114,6 +116,13 @@ static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,return rt2800ops->regbusy_read (rt2x00dev, offset, field, reg); } +static inline void rt2800_read_eeprom (struct rt2x00_dev *rt2x00dev) +{ +const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; + + rt2800ops->read_eeprom (rt2x00dev); +} +static inline int rt2800_drv_write_firmware (struct rt2x00_dev *rt2x00dev,const u8 *data,const size_t len) {
@@ -191,9 +200,8 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);int rt2800_efuse_detect (struct rt2x00_dev *rt2x00dev);void rt2800_read_eeprom_efuse (struct rt2x00_dev *rt2x00dev); -int rt2800_validate_eeprom (struct rt2x00_dev *rt2x00dev); -int rt2800_init_eeprom (struct rt2x00_dev *rt2x00dev); -int rt2800_probe_hw_mode (struct rt2x00_dev *rt2x00dev); + +int rt2800_probe_hw (struct rt2x00_dev *rt2x00dev);void rt2800_get_tkip_seq (struct ieee80211_hw *hw,u8 hw_key_idx,u32 *iv32,u16 *iv16);
drivers/net/wireless/rt2x00/rt2800pci.c +3 -80
114 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2800usb.c +5 -57
97 lines not on this page · raw message
Signature · 1 line
1.7.11.1
PATCH 13/17 rt2x00: Align rt73usb MAC_CSR13 definition with datasheet.
In reply to Gertjan van WingerdeRename MAC_CSR13_BIT<x> to MAC_CSR13_VAL<x> and MAC_CSR13_DIR<x> to represent the actual meaning better.
Clean up list to only mention the active GPIO pins, not just all bits.
drivers/net/wireless/rt2x00/rt73usb.c +1 -1
@@ -189,7 +189,7 @@ static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)u32 reg;rt2x00usb_register_read (rt2x00dev,MAC_CSR13 , ®); -return rt2x00_get_field32 (reg,MAC_CSR13_BIT7 ); +return rt2x00_get_field32 (reg,MAC_CSR13_VAL7 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
drivers/net/wireless/rt2x00/rt73usb.h +18 -13
@@ -267,21 +267,26 @@ struct hw_pairwise_ta_entry {/* * MAC_CSR13: GPIO. +* MAC_CSR13_VALx: GPIO value +* MAC_CSR13_DIRx: GPIO direction: 0 = input; 1 = output */ #define MAC_CSR13 0x3034 -#define MAC_CSR13_BIT0 FIELD32(0x00000001) -#define MAC_CSR13_BIT1 FIELD32(0x00000002) -#define MAC_CSR13_BIT2 FIELD32(0x00000004) -#define MAC_CSR13_BIT3 FIELD32(0x00000008) -#define MAC_CSR13_BIT4 FIELD32(0x00000010) -#define MAC_CSR13_BIT5 FIELD32(0x00000020) -#define MAC_CSR13_BIT6 FIELD32(0x00000040) -#define MAC_CSR13_BIT7 FIELD32(0x00000080) -#define MAC_CSR13_BIT8 FIELD32(0x00000100) -#define MAC_CSR13_BIT9 FIELD32(0x00000200) -#define MAC_CSR13_BIT10 FIELD32(0x00000400) -#define MAC_CSR13_BIT11 FIELD32(0x00000800) -#define MAC_CSR13_BIT12 FIELD32(0x00001000) +#define MAC_CSR13_VAL0 FIELD32(0x00000001) +#define MAC_CSR13_VAL1 FIELD32(0x00000002) +#define MAC_CSR13_VAL2 FIELD32(0x00000004) +#define MAC_CSR13_VAL3 FIELD32(0x00000008) +#define MAC_CSR13_VAL4 FIELD32(0x00000010) +#define MAC_CSR13_VAL5 FIELD32(0x00000020) +#define MAC_CSR13_VAL6 FIELD32(0x00000040) +#define MAC_CSR13_VAL7 FIELD32(0x00000080) +#define MAC_CSR13_DIR0 FIELD32(0x00000100) +#define MAC_CSR13_DIR1 FIELD32(0x00000200) +#define MAC_CSR13_DIR2 FIELD32(0x00000400) +#define MAC_CSR13_DIR3 FIELD32(0x00000800) +#define MAC_CSR13_DIR4 FIELD32(0x00001000) +#define MAC_CSR13_DIR5 FIELD32(0x00002000) +#define MAC_CSR13_DIR6 FIELD32(0x00004000) +#define MAC_CSR13_DIR7 FIELD32(0x00008000)/* * MAC_CSR14: LED control register.
Signature · 1 line
1.7.11.1
PATCH 13/14 rt2x00: Fix rt2800 rfkill polling prior to interface start.
We need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
drivers/net/wireless/rt2x00/rt2800pci.c +9 -0
@@ -983,6 +983,7 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)static int rt2800pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -996,6 +997,14 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR2 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIO_CTRL , reg); + +/* * Initialize hw specifications. */ retval =rt2800_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt2800usb.c +9 -0
@@ -736,6 +736,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)static int rt2800usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -749,6 +750,14 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00usb_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR2 ,1 ); +rt2x00usb_register_write (rt2x00dev,GPIO_CTRL , reg); + +/* * Initialize hw specifications. */ retval =rt2800_probe_hw_mode (rt2x00dev);
Signature · 1 line
1.7.11.1
PATCH 15/17 rt2x00: Align rt2800 GPIO_CTRL definition with datasheet.
In reply to Gertjan van WingerdeRename GPIO_CTRL_CFG to GPIO_CTRL as that is the name according to the datasheet.
Rename GPIO_CTRL_CFG_BIT<x> to GPIO_CTRL_VAL<x> and GPIO_CTRL_CFG_GPIOD_BIT<x> to GPIO_CTRL_DIR<x> to represent the actual meanings better.
Clean up list to mention all the active GPIO pins, not just a subset.
drivers/net/wireless/rt2x00/rt2800.h +27 -20
@@ -439,26 +439,33 @@#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)/* -* GPIO_CTRL_CFG: -* GPIOD: GPIO direction, 0: Output, 1: Input -*/ -#define GPIO_CTRL_CFG 0x0228 -#define GPIO_CTRL_CFG_BIT0 FIELD32(0x00000001) -#define GPIO_CTRL_CFG_BIT1 FIELD32(0x00000002) -#define GPIO_CTRL_CFG_BIT2 FIELD32(0x00000004) -#define GPIO_CTRL_CFG_BIT3 FIELD32(0x00000008) -#define GPIO_CTRL_CFG_BIT4 FIELD32(0x00000010) -#define GPIO_CTRL_CFG_BIT5 FIELD32(0x00000020) -#define GPIO_CTRL_CFG_BIT6 FIELD32(0x00000040) -#define GPIO_CTRL_CFG_BIT7 FIELD32(0x00000080) -#define GPIO_CTRL_CFG_GPIOD_BIT0 FIELD32(0x00000100) -#define GPIO_CTRL_CFG_GPIOD_BIT1 FIELD32(0x00000200) -#define GPIO_CTRL_CFG_GPIOD_BIT2 FIELD32(0x00000400) -#define GPIO_CTRL_CFG_GPIOD_BIT3 FIELD32(0x00000800) -#define GPIO_CTRL_CFG_GPIOD_BIT4 FIELD32(0x00001000) -#define GPIO_CTRL_CFG_GPIOD_BIT5 FIELD32(0x00002000) -#define GPIO_CTRL_CFG_GPIOD_BIT6 FIELD32(0x00004000) -#define GPIO_CTRL_CFG_GPIOD_BIT7 FIELD32(0x00008000) +* GPIO_CTRL: +* GPIO_CTRL_VALx: GPIO value +* GPIO_CTRL_DIRx: GPIO direction: 0 = output; 1 = input +*/ +#define GPIO_CTRL 0x0228 +#define GPIO_CTRL_VAL0 FIELD32(0x00000001) +#define GPIO_CTRL_VAL1 FIELD32(0x00000002) +#define GPIO_CTRL_VAL2 FIELD32(0x00000004) +#define GPIO_CTRL_VAL3 FIELD32(0x00000008) +#define GPIO_CTRL_VAL4 FIELD32(0x00000010) +#define GPIO_CTRL_VAL5 FIELD32(0x00000020) +#define GPIO_CTRL_VAL6 FIELD32(0x00000040) +#define GPIO_CTRL_VAL7 FIELD32(0x00000080) +#define GPIO_CTRL_DIR0 FIELD32(0x00000100) +#define GPIO_CTRL_DIR1 FIELD32(0x00000200) +#define GPIO_CTRL_DIR2 FIELD32(0x00000400) +#define GPIO_CTRL_DIR3 FIELD32(0x00000800) +#define GPIO_CTRL_DIR4 FIELD32(0x00001000) +#define GPIO_CTRL_DIR5 FIELD32(0x00002000) +#define GPIO_CTRL_DIR6 FIELD32(0x00004000) +#define GPIO_CTRL_DIR7 FIELD32(0x00008000) +#define GPIO_CTRL_VAL8 FIELD32(0x00010000) +#define GPIO_CTRL_VAL9 FIELD32(0x00020000) +#define GPIO_CTRL_VAL10 FIELD32(0x00040000) +#define GPIO_CTRL_DIR8 FIELD32(0x01000000) +#define GPIO_CTRL_DIR9 FIELD32(0x02000000) +#define GPIO_CTRL_DIR10 FIELD32(0x04000000)/* * MCU_CMD_CFG
drivers/net/wireless/rt2x00/rt2800lib.c +19 -19
@@ -923,8 +923,8 @@ int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2800_register_read (rt2x00dev,WLAN_FUN_CTRL , ®);return rt2x00_get_field32 (reg,WLAN_GPIO_IN_BIT0 ); }else { -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -return rt2x00_get_field32 (reg,GPIO_CTRL_CFG_BIT2 ); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +return rt2x00_get_field32 (reg,GPIO_CTRL_VAL2 ); } }EXPORT_SYMBOL_GPL (rt2800_rfkill_poll);
@@ -1570,10 +1570,10 @@ static void rt2800_set_ant_diversity(struct rt2x00_dev *rt2x00dev,rt2800_mcu_request (rt2x00dev,MCU_ANT_SELECT ,0xff , eesk_pin,0 ); -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT3 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT3 , gpio_bit3); -rt2800_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR3 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL3 , gpio_bit3); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg); }void rt2800_config_ant (struct rt2x00_dev *rt2x00dev,struct antenna_setup *ant)
@@ -1995,13 +1995,13 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,rt2800_rfcsr_write (rt2x00dev,29 ,0x9f ); } -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT7 ,0 ); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR7 ,0 );if (rf->channel <=14 ) -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT7 ,1 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL7 ,1 );else -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT7 ,0 ); -rt2800_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); +rt2x00_set_field32 (®,GPIO_CTRL_VAL7 ,0 ); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg);rt2800_rfcsr_read (rt2x00dev,7 , &rfcsr);rt2x00_set_field8 (&rfcsr,RFCSR7_RF_TUNING ,1 );
@@ -3587,16 +3587,16 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)if (test_bit (CAPABILITY_BT_COEXIST , &rt2x00dev->cap_flags)) {u32 reg; -rt2800_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT3 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT6 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT3 ,0 ); -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT6 ,0 ); +rt2800_register_read (rt2x00dev,GPIO_CTRL , ®); +rt2x00_set_field32 (®,GPIO_CTRL_DIR3 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_DIR6 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL3 ,0 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL6 ,0 );if (ant ==0 ) -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT3 ,1 ); +rt2x00_set_field32 (®,GPIO_CTRL_VAL3 ,1 );else if (ant ==1 ) -rt2x00_set_field32 (®,GPIO_CTRL_CFG_BIT6 ,1 ); -rt2800_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); +rt2x00_set_field32 (®,GPIO_CTRL_VAL6 ,1 ); +rt2800_register_write (rt2x00dev,GPIO_CTRL , reg); }/* This chip has hardware antenna diversity*/
Signature · 1 line
1.7.11.1
Re: [PATCH 04/14] rt2x00: Align rt2500pci GPIOCSR definition with datasheet.
In reply to Gertjan van WingerdeQuoted 4 lines · Gertjan van Wingerde
Rename GPIOCSR_BIT<x> to GPIOCSR_VAL<x> to represent the actual meaning better.
Signed-off-by Gertjan van Wingerde <[email protected]>
Sounds good.
Quoted 1 line
Cc <[email protected]>
Should not be needed.
Thanks,
Jonathan
Re: [PATCH 02/14] rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
In reply to Jonathan NiederQuoted 4 lines · Jonathan Nieder
Hi,
Gertjan van Wingerde wrote:
Quoted 9 lines
Quoted 3 lines
Datasheet indicates additional fields to set the GPIO direction. At the same time rename GPIOCSR_BIT<x> to GPIOCSR_VAL<x> to represent the actual meaning better.
Micronit: could the latter be split into a separate patch from the former, to make life easier e.g. when bisecting?
Only the first part would be needed for stable@.
I guess it could be split up, but I don't see the point. Technically this patch is not needed in stable, but the next patch in the series depends on this one and that one is targeted at stable, so therefore this one is targeted at stable as well.
---
Gertjan
Re: [PATCH 10/17] rt2x00: Fix rt2500usb rfkill polling prior to interface start.
In reply to Gertjan van WingerdeQuoted 8 lines · Gertjan van Wingerde
We need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
Signed-off-by Gertjan van Wingerde <[email protected]>Cc <[email protected]>
All, I seem to have goofed up somewhere. Please disregard all patches that claim to be from a 17 patch series. These are strange duplicates that should not have been sent.
---
Gertjan.
Re: [PATCH 02/14] rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
In reply to Gertjan van WingerdeQuoted 4 lines · Gertjan van Wingerde
I guess it could be split up, but I don't see the point. Technically this patch is not needed in stable, but the next patch in the series depends on this one and that one is targeted at stable, so therefore this one is targeted at stable as well.
If I were to reroll the series without unnecessary changes, would that be useful to you?
The whole point of point releases is to fix bugs while avoiding pointless changes, providing a stable codebase that is easy to build on and keeping the volume of new changes to sift through when regressions are introduced low.
Thanks,
Jonathan
Re: [PATCH 02/14] rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
Hi Jonathan,
Quoted 9 lines · Jonathan Nieder
Quoted 4 lines · Gertjan van Wingerde
I guess it could be split up, but I don't see the point. Technically this patch is not needed in stable, but the next patch in the series depends on this one and that one is targeted at stable, so therefore this one is targeted at stable as well.
If I were to reroll the series without unnecessary changes, would that be useful to you?
Nevermind, I'll refactor the series myself to reduce the number of patches and to better separate the fixes from the clean-ups. I can probably do that much faster (within an hour) than you can.
Quoted 6 lines
The whole point of point releases is to fix bugs while avoiding pointless changes, providing a stable codebase that is easy to build on and keeping the volume of new changes to sift through when regressions are introduced low.
I agree. However, in this case I tried to balance new development with bug fixing to prevent a lot of double work (and failed to do so).
---
Gertjan
Re: [PATCH 02/14] rt2x00: Align rt2400pci GPIOCSR definition with datasheet.
Quoted 2 lines · Gertjan van Wingerde
I'll refactor the series myself to reduce the number of
patches and to better separate the fixes from the clean-ups.
The result looks good. Thanks!
Jonathan