* [PATCH 1/9] rt2800: prepare for unification of EEPROM support code
@ 2009-11-08 13:38 Bartlomiej Zolnierkiewicz
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
` (9 more replies)
0 siblings, 10 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:38 UTC (permalink / raw)
To: linux-wireless
Cc: Gertjan van Wingerde, Bartlomiej Zolnierkiewicz, Ivo van Doorn
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800: prepare for unification of EEPROM support code
* Factor out common code from rt2800[pci,usb]_validate_eeprom()
to rt2800_validate_eeprom().
* Fix interface specific comment in rt2800[pci,usb]_validate_eeprom().
* Enclose interface specific code in rt2800[pci,usb]_init_eeprom()
with rt2x00_intf_is_[pci,usb]() checks.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
on top of "rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci."
patch from Gertjan
drivers/net/wireless/rt2x00/rt2800pci.c | 51 ++++++++++++++++++--------------
drivers/net/wireless/rt2x00/rt2800usb.c | 40 +++++++++++++++----------
2 files changed, 55 insertions(+), 36 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1091,29 +1091,13 @@ static irqreturn_t rt2800pci_interrupt(i
/*
* Device probe functions.
*/
-static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
+static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
{
u16 word;
u8 *mac;
u8 default_lna_gain;
/*
- * Read EEPROM into buffer
- */
- switch(rt2x00dev->chip.rt) {
- case RT2880:
- case RT3052:
- rt2800pci_read_eeprom_soc(rt2x00dev);
- break;
- default:
- if (rt2800pci_efuse_detect(rt2x00dev))
- rt2800pci_read_eeprom_efuse(rt2x00dev);
- else
- rt2800pci_read_eeprom_pci(rt2x00dev);
- break;
- }
-
- /*
* Start validation of the data that has been read.
*/
mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
@@ -1131,7 +1115,7 @@ static int rt2800pci_validate_eeprom(str
EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
} else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
/*
- * There is a max of 2 RX streams for RT2860 series
+ * There is a max of 2 RX streams for RT28x0 series
*/
if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
@@ -1210,6 +1194,27 @@ static int rt2800pci_validate_eeprom(str
return 0;
}
+static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
+{
+ /*
+ * Read EEPROM into buffer
+ */
+ switch (rt2x00dev->chip.rt) {
+ case RT2880:
+ case RT3052:
+ rt2800pci_read_eeprom_soc(rt2x00dev);
+ break;
+ default:
+ if (rt2800pci_efuse_detect(rt2x00dev))
+ rt2800pci_read_eeprom_efuse(rt2x00dev);
+ else
+ rt2800pci_read_eeprom_pci(rt2x00dev);
+ break;
+ }
+
+ return rt2800_validate_eeprom(rt2x00dev);
+}
+
static int rt2800pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
@@ -1226,7 +1231,9 @@ static int rt2800pci_init_eeprom(struct
*/
value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
- rt2x00_set_chip_rf(rt2x00dev, value, reg);
+
+ if (rt2x00_intf_is_pci(rt2x00dev))
+ rt2x00_set_chip_rf(rt2x00dev, value, reg);
if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
!rt2x00_rf(&rt2x00dev->chip, RF2850) &&
@@ -1234,8 +1241,10 @@ static int rt2800pci_init_eeprom(struct
!rt2x00_rf(&rt2x00dev->chip, RF2750) &&
!rt2x00_rf(&rt2x00dev->chip, RF3020) &&
!rt2x00_rf(&rt2x00dev->chip, RF2020) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
+ (rt2x00_intf_is_usb(rt2x00dev) ||
+ (rt2x00_intf_is_pci(rt2x00dev) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
return -ENODEV;
}
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -665,14 +665,12 @@ static void rt2800usb_fill_rxdone(struct
/*
* Device probe functions.
*/
-static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
+static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
{
u16 word;
u8 *mac;
u8 default_lna_gain;
- rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
-
/*
* Start validation of the data that has been read.
*/
@@ -691,7 +689,7 @@ static int rt2800usb_validate_eeprom(str
EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
} else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
/*
- * There is a max of 2 RX streams for RT2870 series
+ * There is a max of 2 RX streams for RT28x0 series
*/
if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
@@ -770,6 +768,13 @@ static int rt2800usb_validate_eeprom(str
return 0;
}
+static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
+{
+ rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
+
+ return rt2800_validate_eeprom(rt2x00dev);
+}
+
static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
@@ -786,18 +791,23 @@ static int rt2800usb_init_eeprom(struct
*/
value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
- rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
- /*
- * The check for rt2860 is not a typo, some rt2870 hardware
- * identifies itself as rt2860 in the CSR register.
- */
- if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) &&
- !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) &&
- !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) &&
- !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) {
- ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
- return -ENODEV;
+ if (rt2x00_intf_is_usb(rt2x00dev)) {
+ struct rt2x00_chip *chip = &rt2x00dev->chip;
+
+ rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
+
+ /*
+ * The check for rt2860 is not a typo, some rt2870 hardware
+ * identifies itself as rt2860 in the CSR register.
+ */
+ if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) &&
+ !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) &&
+ !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) &&
+ !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
+ ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
+ return -ENODEV;
+ }
}
if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 2/9] rt2800: unify EEPROM support code
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:51 ` Ivo van Doorn
2009-11-08 14:19 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table Bartlomiej Zolnierkiewicz
` (8 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Ivo van Doorn, Bartlomiej Zolnierkiewicz, Gertjan van Wingerde
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800: unify EEPROM support code
Add rt2800_validate_eeprom() and rt2800_init_eeprom() to rt2800lib.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 199 ++++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800lib.h | 3
drivers/net/wireless/rt2x00/rt2800pci.c | 183 -----------------------------
drivers/net/wireless/rt2x00/rt2800usb.c | 195 -------------------------------
4 files changed, 204 insertions(+), 376 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800lib.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1659,6 +1659,205 @@ int rt2800_init_rfcsr(struct rt2x00_dev
}
EXPORT_SYMBOL_GPL(rt2800_init_rfcsr);
+int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
+{
+ u16 word;
+ u8 *mac;
+ u8 default_lna_gain;
+
+ /*
+ * Start validation of the data that has been read.
+ */
+ mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
+ if (!is_valid_ether_addr(mac)) {
+ random_ether_addr(mac);
+ EEPROM(rt2x00dev, "MAC: %pM\n", mac);
+ }
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);
+ if (word == 0xffff) {
+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
+ rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1);
+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
+ EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
+ } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
+ /*
+ * There is a max of 2 RX streams for RT28x0 series
+ */
+ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
+ }
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
+ if (word == 0xffff) {
+ rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
+ EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
+ }
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
+ if ((word & 0x00ff) == 0x00ff) {
+ rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
+ rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
+ LED_MODE_TXRX_ACTIVITY);
+ rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8);
+ EEPROM(rt2x00dev, "Freq: 0x%04x\n", word);
+ }
+
+ /*
+ * During the LNA validation we are going to use
+ * lna0 as correct value. Note that EEPROM_LNA
+ * is never validated.
+ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
+ default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
+ rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
+ rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
+ rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
+ if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
+ rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
+ rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
+ default_lna_gain);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
+ rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
+ rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
+ rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
+ if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
+ rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
+ rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
+ default_lna_gain);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(rt2800_validate_eeprom);
+
+int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
+ u16 value;
+ u16 eeprom;
+
+ /*
+ * Read EEPROM word for configuration.
+ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
+
+ /*
+ * Identify RF chipset.
+ */
+ value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
+ rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
+
+ if (rt2x00_intf_is_usb(rt2x00dev)) {
+ struct rt2x00_chip *chip = &rt2x00dev->chip;
+
+ rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
+
+ /*
+ * The check for rt2860 is not a typo, some rt2870 hardware
+ * identifies itself as rt2860 in the CSR register.
+ */
+ if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) &&
+ !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) &&
+ !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) &&
+ !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
+ ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
+ return -ENODEV;
+ }
+ } else if (rt2x00_intf_is_pci(rt2x00dev))
+ rt2x00_set_chip_rf(rt2x00dev, value, reg);
+
+ if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
+ (rt2x00_intf_is_usb(rt2x00dev) ||
+ (rt2x00_intf_is_pci(rt2x00dev) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
+ ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
+ return -ENODEV;
+ }
+
+ /*
+ * Identify default antenna configuration.
+ */
+ rt2x00dev->default_ant.tx =
+ rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH);
+ rt2x00dev->default_ant.rx =
+ rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH);
+
+ /*
+ * Read frequency offset and RF programming sequence.
+ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
+ rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
+
+ /*
+ * Read external LNA informations.
+ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
+
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
+ __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
+ __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
+
+ /*
+ * Detect if this device has an hardware controlled radio.
+ */
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
+ __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+
+ /*
+ * Store led settings, for correct led behaviour.
+ */
+#ifdef CONFIG_RT2X00_LIB_LEDS
+ rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
+ rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
+ rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg);
+#endif /* CONFIG_RT2X00_LIB_LEDS */
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(rt2800_init_eeprom);
+
/*
* IEEE80211 stack callback functions.
*/
Index: b/drivers/net/wireless/rt2x00/rt2800lib.h
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -129,6 +129,9 @@ int rt2800_init_registers(struct rt2x00_
int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev);
int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev);
+int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev);
+int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev);
+
extern const struct ieee80211_ops rt2800_mac80211_ops;
#endif /* RT2800LIB_H */
Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1077,109 +1077,6 @@ static irqreturn_t rt2800pci_interrupt(i
/*
* Device probe functions.
*/
-static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
-{
- u16 word;
- u8 *mac;
- u8 default_lna_gain;
-
- /*
- * Start validation of the data that has been read.
- */
- mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
- if (!is_valid_ether_addr(mac)) {
- random_ether_addr(mac);
- EEPROM(rt2x00dev, "MAC: %pM\n", mac);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);
- if (word == 0xffff) {
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
- rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1);
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
- } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
- /*
- * There is a max of 2 RX streams for RT28x0 series
- */
- if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
- if (word == 0xffff) {
- rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
- EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
- if ((word & 0x00ff) == 0x00ff) {
- rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
- rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
- LED_MODE_TXRX_ACTIVITY);
- rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8);
- EEPROM(rt2x00dev, "Freq: 0x%04x\n", word);
- }
-
- /*
- * During the LNA validation we are going to use
- * lna0 as correct value. Note that EEPROM_LNA
- * is never validated.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
- default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
- if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
- default_lna_gain);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
- if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
- rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
- default_lna_gain);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
-
- return 0;
-}
-
static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
{
/*
@@ -1201,84 +1098,6 @@ static int rt2800pci_validate_eeprom(str
return rt2800_validate_eeprom(rt2x00dev);
}
-static int rt2800pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
-{
- u32 reg;
- u16 value;
- u16 eeprom;
-
- /*
- * Read EEPROM word for configuration.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-
- /*
- * Identify RF chipset.
- */
- value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
- rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
-
- if (rt2x00_intf_is_pci(rt2x00dev))
- rt2x00_set_chip_rf(rt2x00dev, value, reg);
-
- if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
- (rt2x00_intf_is_usb(rt2x00dev) ||
- (rt2x00_intf_is_pci(rt2x00dev) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
- ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
- return -ENODEV;
- }
-
- /*
- * Identify default antenna configuration.
- */
- rt2x00dev->default_ant.tx =
- rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH);
- rt2x00dev->default_ant.rx =
- rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH);
-
- /*
- * Read frequency offset and RF programming sequence.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
- rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
-
- /*
- * Read external LNA informations.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
-
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
- __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
- __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
-
- /*
- * Detect if this device has an hardware controlled radio.
- */
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
- __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
-
- /*
- * Store led settings, for correct led behaviour.
- */
-#ifdef CONFIG_RT2X00_LIB_LEDS
- rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
- rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
- rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg);
-#endif /* CONFIG_RT2X00_LIB_LEDS */
-
- return 0;
-}
-
/*
* RF value list for rt2860
* Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
@@ -1485,7 +1304,7 @@ static int rt2800pci_probe_hw(struct rt2
if (retval)
return retval;
- retval = rt2800pci_init_eeprom(rt2x00dev);
+ retval = rt2800_init_eeprom(rt2x00dev);
if (retval)
return retval;
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -665,109 +665,6 @@ static void rt2800usb_fill_rxdone(struct
/*
* Device probe functions.
*/
-static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
-{
- u16 word;
- u8 *mac;
- u8 default_lna_gain;
-
- /*
- * Start validation of the data that has been read.
- */
- mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
- if (!is_valid_ether_addr(mac)) {
- random_ether_addr(mac);
- EEPROM(rt2x00dev, "MAC: %pM\n", mac);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);
- if (word == 0xffff) {
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
- rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1);
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
- } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
- /*
- * There is a max of 2 RX streams for RT28x0 series
- */
- if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
- if (word == 0xffff) {
- rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
- rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
- EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
- if ((word & 0x00ff) == 0x00ff) {
- rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
- rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
- LED_MODE_TXRX_ACTIVITY);
- rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8);
- EEPROM(rt2x00dev, "Freq: 0x%04x\n", word);
- }
-
- /*
- * During the LNA validation we are going to use
- * lna0 as correct value. Note that EEPROM_LNA
- * is never validated.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
- default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
- if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
- default_lna_gain);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
- if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
- rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
- default_lna_gain);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
-
- return 0;
-}
-
static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
{
rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
@@ -775,96 +672,6 @@ static int rt2800usb_validate_eeprom(str
return rt2800_validate_eeprom(rt2x00dev);
}
-static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
-{
- u32 reg;
- u16 value;
- u16 eeprom;
-
- /*
- * Read EEPROM word for configuration.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-
- /*
- * Identify RF chipset.
- */
- value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
- rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
-
- if (rt2x00_intf_is_usb(rt2x00dev)) {
- struct rt2x00_chip *chip = &rt2x00dev->chip;
-
- rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
-
- /*
- * The check for rt2860 is not a typo, some rt2870 hardware
- * identifies itself as rt2860 in the CSR register.
- */
- if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) &&
- !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) &&
- !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) &&
- !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
- ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
- return -ENODEV;
- }
- }
-
- if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
- ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
- return -ENODEV;
- }
-
- /*
- * Identify default antenna configuration.
- */
- rt2x00dev->default_ant.tx =
- rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH);
- rt2x00dev->default_ant.rx =
- rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH);
-
- /*
- * Read frequency offset and RF programming sequence.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
- rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
-
- /*
- * Read external LNA informations.
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
-
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
- __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
- __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
-
- /*
- * Detect if this device has an hardware controlled radio.
- */
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
- __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
-
- /*
- * Store led settings, for correct led behaviour.
- */
-#ifdef CONFIG_RT2X00_LIB_LEDS
- rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
- rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
- rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ,
- &rt2x00dev->led_mcu_reg);
-#endif /* CONFIG_RT2X00_LIB_LEDS */
-
- return 0;
-}
-
/*
* RF value list for rt2870
* Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
@@ -1095,7 +902,7 @@ static int rt2800usb_probe_hw(struct rt2
if (retval)
return retval;
- retval = rt2800usb_init_eeprom(rt2x00dev);
+ retval = rt2800_init_eeprom(rt2x00dev);
if (retval)
return retval;
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:51 ` Ivo van Doorn
2009-11-08 14:20 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode() Bartlomiej Zolnierkiewicz
` (7 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Gertjan van Wingerde, Bartlomiej Zolnierkiewicz, Ivo van Doorn
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800pci: add missing RF values to rf_vals table
rt2800pci's rf_vals[] copy was missing values for some channels.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800pci.c | 4 ++++
1 file changed, 4 insertions(+)
Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1158,6 +1158,10 @@ static const struct rf_channel rf_vals[]
{ 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
{ 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
{ 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
+ { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
+ { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
+ { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
+ { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
/* 802.11 Japan */
{ 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
2009-11-08 13:39 ` [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:52 ` Ivo van Doorn
2009-11-08 14:20 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification Bartlomiej Zolnierkiewicz
` (6 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Ivo van Doorn, Bartlomiej Zolnierkiewicz, Gertjan van Wingerde
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
Move hw_mode information initialization code block before
HT information initialization one to match the ordering used
by rt2800pci's rt2800pci_probe_hw_mode().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 42 ++++++++++++++++----------------
1 file changed, 21 insertions(+), 21 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -795,6 +795,27 @@ static int rt2800usb_probe_hw_mode(struc
rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
/*
+ * Initialize hw_mode information.
+ */
+ spec->supported_bands = SUPPORT_BAND_2GHZ;
+ spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
+
+ if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
+ rt2x00_rf(&rt2x00dev->chip, RF2720)) {
+ spec->num_channels = 14;
+ spec->channels = rf_vals;
+ } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
+ rt2x00_rf(&rt2x00dev->chip, RF2750)) {
+ spec->supported_bands |= SUPPORT_BAND_5GHZ;
+ spec->num_channels = ARRAY_SIZE(rf_vals);
+ spec->channels = rf_vals;
+ } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
+ rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+ spec->num_channels = ARRAY_SIZE(rf_vals_3070);
+ spec->channels = rf_vals_3070;
+ }
+
+ /*
* Initialize HT information.
*/
spec->ht.ht_supported = true;
@@ -826,27 +847,6 @@ static int rt2800usb_probe_hw_mode(struc
}
/*
- * Initialize hw_mode information.
- */
- spec->supported_bands = SUPPORT_BAND_2GHZ;
- spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
-
- if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
- rt2x00_rf(&rt2x00dev->chip, RF2720)) {
- spec->num_channels = 14;
- spec->channels = rf_vals;
- } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
- rt2x00_rf(&rt2x00dev->chip, RF2750)) {
- spec->supported_bands |= SUPPORT_BAND_5GHZ;
- spec->num_channels = ARRAY_SIZE(rf_vals);
- spec->channels = rf_vals;
- } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
- rt2x00_rf(&rt2x00dev->chip, RF2020)) {
- spec->num_channels = ARRAY_SIZE(rf_vals_3070);
- spec->channels = rf_vals_3070;
- }
-
- /*
* Create channel information array
*/
info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (2 preceding siblings ...)
2009-11-08 13:39 ` [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode() Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:53 ` Ivo van Doorn
2009-11-08 14:35 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode() Bartlomiej Zolnierkiewicz
` (5 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Gertjan van Wingerde, Bartlomiej Zolnierkiewicz, Ivo van Doorn
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800: prepare for rt2800*_probe_hw_mode() unification
Enclose interface specific code in rt2800[pci,usb]_probe_hw_mode()
with rt2x00_intf_is_[pci,usb]() checks.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800pci.c | 24 ++++++++++++++----------
drivers/net/wireless/rt2x00/rt2800usb.c | 19 ++++++++++++-------
2 files changed, 26 insertions(+), 17 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1175,6 +1175,7 @@ static const struct rf_channel rf_vals[]
static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
+ struct rt2x00_chip *chip = &rt2x00dev->chip;
struct hw_mode_spec *spec = &rt2x00dev->spec;
struct channel_info *info;
char *tx_power1;
@@ -1190,7 +1191,9 @@ static int rt2800pci_probe_hw_mode(struc
IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_PS_NULLFUNC_STACK;
- rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
+
+ if (rt2x00_intf_is_pci(rt2x00dev))
+ rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -1205,17 +1208,18 @@ static int rt2800pci_probe_hw_mode(struc
spec->supported_bands = SUPPORT_BAND_2GHZ;
spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
- if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
- rt2x00_rf(&rt2x00dev->chip, RF2720) ||
- rt2x00_rf(&rt2x00dev->chip, RF3020) ||
- rt2x00_rf(&rt2x00dev->chip, RF3021) ||
- rt2x00_rf(&rt2x00dev->chip, RF3022) ||
- rt2x00_rf(&rt2x00dev->chip, RF2020) ||
- rt2x00_rf(&rt2x00dev->chip, RF3052)) {
+ if (rt2x00_rf(chip, RF2820) ||
+ rt2x00_rf(chip, RF2720) ||
+ (rt2x00_intf_is_pci(rt2x00dev) &&
+ (rt2x00_rf(chip, RF3020) ||
+ rt2x00_rf(chip, RF3021) ||
+ rt2x00_rf(chip, RF3022) ||
+ rt2x00_rf(chip, RF2020) ||
+ rt2x00_rf(chip, RF3052)))) {
spec->num_channels = 14;
spec->channels = rf_vals;
- } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
- rt2x00_rf(&rt2x00dev->chip, RF2750)) {
+ } else if (rt2x00_rf(chip, RF2850) ||
+ rt2x00_rf(chip, RF2750)) {
spec->supported_bands |= SUPPORT_BAND_5GHZ;
spec->num_channels = ARRAY_SIZE(rf_vals);
spec->channels = rf_vals;
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -770,6 +770,7 @@ static const struct rf_channel rf_vals_3
static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
+ struct rt2x00_chip *chip = &rt2x00dev->chip;
struct hw_mode_spec *spec = &rt2x00dev->spec;
struct channel_info *info;
char *tx_power1;
@@ -785,7 +786,10 @@ static int rt2800usb_probe_hw_mode(struc
IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_PS_NULLFUNC_STACK;
- rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
+
+ if (rt2x00_intf_is_usb(rt2x00dev))
+ rt2x00dev->hw->extra_tx_headroom =
+ TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -800,17 +804,18 @@ static int rt2800usb_probe_hw_mode(struc
spec->supported_bands = SUPPORT_BAND_2GHZ;
spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
- if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
- rt2x00_rf(&rt2x00dev->chip, RF2720)) {
+ if (rt2x00_rf(chip, RF2820) ||
+ rt2x00_rf(chip, RF2720)) {
spec->num_channels = 14;
spec->channels = rf_vals;
- } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
- rt2x00_rf(&rt2x00dev->chip, RF2750)) {
+ } else if (rt2x00_rf(chip, RF2850) ||
+ rt2x00_rf(chip, RF2750)) {
spec->supported_bands |= SUPPORT_BAND_5GHZ;
spec->num_channels = ARRAY_SIZE(rf_vals);
spec->channels = rf_vals;
- } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
- rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+ } else if (rt2x00_intf_is_usb(rt2x00dev) &&
+ (rt2x00_rf(chip, RF3020) ||
+ rt2x00_rf(chip, RF2020))) {
spec->num_channels = ARRAY_SIZE(rf_vals_3070);
spec->channels = rf_vals_3070;
}
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode()
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (3 preceding siblings ...)
2009-11-08 13:39 ` [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:53 ` Ivo van Doorn
2009-11-08 14:36 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 7/9] rt2800usb: fix RX descriptor naming Bartlomiej Zolnierkiewicz
` (4 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Ivo van Doorn, Bartlomiej Zolnierkiewicz, Gertjan van Wingerde
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800: unify rt2800*_probe_hw_mode()
Add rf_vals tables and rt2800_probe_hw_mode() to rt2800lib.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 218 ++++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800lib.h | 1
drivers/net/wireless/rt2x00/rt2800pci.c | 190 ---------------------------
drivers/net/wireless/rt2x00/rt2800usb.c | 211 ------------------------------
4 files changed, 221 insertions(+), 399 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800lib.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1859,6 +1859,224 @@ int rt2800_init_eeprom(struct rt2x00_dev
EXPORT_SYMBOL_GPL(rt2800_init_eeprom);
/*
+ * RF value list for rt28x0
+ * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
+ */
+static const struct rf_channel rf_vals[] = {
+ { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
+ { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
+ { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
+ { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
+ { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
+ { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
+ { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
+ { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
+ { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
+ { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
+ { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
+ { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
+ { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
+ { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
+
+ /* 802.11 UNI / HyperLan 2 */
+ { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
+ { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
+ { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
+ { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
+ { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
+ { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
+ { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
+ { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
+ { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
+ { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
+ { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
+ { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
+
+ /* 802.11 HyperLan 2 */
+ { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
+ { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
+ { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
+ { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
+ { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
+ { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
+ { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
+ { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
+ { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
+ { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
+ { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
+ { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
+ { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
+ { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
+ { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
+ { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
+
+ /* 802.11 UNII */
+ { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
+ { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
+ { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
+ { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
+ { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
+ { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
+ { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
+ { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
+ { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
+ { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
+ { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
+
+ /* 802.11 Japan */
+ { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
+ { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
+ { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
+ { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
+ { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
+ { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
+ { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
+};
+
+/*
+ * RF value list for rt3070
+ * Supports: 2.4 GHz
+ */
+static const struct rf_channel rf_vals_3070[] = {
+ {1, 241, 2, 2 },
+ {2, 241, 2, 7 },
+ {3, 242, 2, 2 },
+ {4, 242, 2, 7 },
+ {5, 243, 2, 2 },
+ {6, 243, 2, 7 },
+ {7, 244, 2, 2 },
+ {8, 244, 2, 7 },
+ {9, 245, 2, 2 },
+ {10, 245, 2, 7 },
+ {11, 246, 2, 2 },
+ {12, 246, 2, 7 },
+ {13, 247, 2, 2 },
+ {14, 248, 2, 4 },
+};
+
+int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
+{
+ struct rt2x00_chip *chip = &rt2x00dev->chip;
+ struct hw_mode_spec *spec = &rt2x00dev->spec;
+ struct channel_info *info;
+ char *tx_power1;
+ char *tx_power2;
+ unsigned int i;
+ u16 eeprom;
+
+ /*
+ * Initialize all hw fields.
+ */
+ rt2x00dev->hw->flags =
+ IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+ IEEE80211_HW_SIGNAL_DBM |
+ IEEE80211_HW_SUPPORTS_PS |
+ IEEE80211_HW_PS_NULLFUNC_STACK;
+
+ if (rt2x00_intf_is_usb(rt2x00dev))
+ rt2x00dev->hw->extra_tx_headroom =
+ TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
+ else if (rt2x00_intf_is_pci(rt2x00dev))
+ rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
+
+ SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
+ SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
+ rt2x00_eeprom_addr(rt2x00dev,
+ EEPROM_MAC_ADDR_0));
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
+
+ /*
+ * Initialize hw_mode information.
+ */
+ spec->supported_bands = SUPPORT_BAND_2GHZ;
+ spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
+
+ if (rt2x00_rf(chip, RF2820) ||
+ rt2x00_rf(chip, RF2720) ||
+ (rt2x00_intf_is_pci(rt2x00dev) &&
+ (rt2x00_rf(chip, RF3020) ||
+ rt2x00_rf(chip, RF3021) ||
+ rt2x00_rf(chip, RF3022) ||
+ rt2x00_rf(chip, RF2020) ||
+ rt2x00_rf(chip, RF3052)))) {
+ spec->num_channels = 14;
+ spec->channels = rf_vals;
+ } else if (rt2x00_rf(chip, RF2850) ||
+ rt2x00_rf(chip, RF2750)) {
+ spec->supported_bands |= SUPPORT_BAND_5GHZ;
+ spec->num_channels = ARRAY_SIZE(rf_vals);
+ spec->channels = rf_vals;
+ } else if (rt2x00_intf_is_usb(rt2x00dev) &&
+ (rt2x00_rf(chip, RF3020) ||
+ rt2x00_rf(chip, RF2020))) {
+ spec->num_channels = ARRAY_SIZE(rf_vals_3070);
+ spec->channels = rf_vals_3070;
+ }
+
+ /*
+ * Initialize HT information.
+ */
+ spec->ht.ht_supported = true;
+ spec->ht.cap =
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+ IEEE80211_HT_CAP_GRN_FLD |
+ IEEE80211_HT_CAP_SGI_20 |
+ IEEE80211_HT_CAP_SGI_40 |
+ IEEE80211_HT_CAP_TX_STBC |
+ IEEE80211_HT_CAP_RX_STBC |
+ IEEE80211_HT_CAP_PSMP_SUPPORT;
+ spec->ht.ampdu_factor = 3;
+ spec->ht.ampdu_density = 4;
+ spec->ht.mcs.tx_params =
+ IEEE80211_HT_MCS_TX_DEFINED |
+ IEEE80211_HT_MCS_TX_RX_DIFF |
+ ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
+ IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
+
+ switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
+ case 3:
+ spec->ht.mcs.rx_mask[2] = 0xff;
+ case 2:
+ spec->ht.mcs.rx_mask[1] = 0xff;
+ case 1:
+ spec->ht.mcs.rx_mask[0] = 0xff;
+ spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
+ break;
+ }
+
+ /*
+ * Create channel information array
+ */
+ info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ spec->channels_info = info;
+
+ tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
+ tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
+
+ for (i = 0; i < 14; i++) {
+ info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
+ info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
+ }
+
+ if (spec->num_channels > 14) {
+ tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
+ tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
+
+ for (i = 14; i < spec->num_channels; i++) {
+ info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
+ info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
+ }
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(rt2800_probe_hw_mode);
+
+/*
* IEEE80211 stack callback functions.
*/
static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
Index: b/drivers/net/wireless/rt2x00/rt2800lib.h
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -131,6 +131,7 @@ int rt2800_init_rfcsr(struct rt2x00_dev
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);
extern const struct ieee80211_ops rt2800_mac80211_ops;
Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1098,194 +1098,6 @@ static int rt2800pci_validate_eeprom(str
return rt2800_validate_eeprom(rt2x00dev);
}
-/*
- * RF value list for rt2860
- * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
- */
-static const struct rf_channel rf_vals[] = {
- { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
- { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
- { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
- { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
- { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
- { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
- { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
- { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
- { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
- { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
- { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
- { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
- { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
- { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
-
- /* 802.11 UNI / HyperLan 2 */
- { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
- { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
- { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
- { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
- { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
- { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
- { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
- { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
- { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
- { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
- { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
- { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
-
- /* 802.11 HyperLan 2 */
- { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
- { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
- { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
- { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
- { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
- { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
- { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
- { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
- { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
- { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
- { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
- { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
- { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
- { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
- { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
- { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
-
- /* 802.11 UNII */
- { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
- { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
- { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
- { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
- { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
- { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
- { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
- { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
- { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
- { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
- { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
-
- /* 802.11 Japan */
- { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
- { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
- { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
- { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
- { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
- { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
- { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
-};
-
-static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
-{
- struct rt2x00_chip *chip = &rt2x00dev->chip;
- struct hw_mode_spec *spec = &rt2x00dev->spec;
- struct channel_info *info;
- char *tx_power1;
- char *tx_power2;
- unsigned int i;
- u16 eeprom;
-
- /*
- * Initialize all hw fields.
- */
- rt2x00dev->hw->flags =
- IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
- IEEE80211_HW_SIGNAL_DBM |
- IEEE80211_HW_SUPPORTS_PS |
- IEEE80211_HW_PS_NULLFUNC_STACK;
-
- if (rt2x00_intf_is_pci(rt2x00dev))
- rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
-
- SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
- SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
- rt2x00_eeprom_addr(rt2x00dev,
- EEPROM_MAC_ADDR_0));
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-
- /*
- * Initialize hw_mode information.
- */
- spec->supported_bands = SUPPORT_BAND_2GHZ;
- spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
-
- if (rt2x00_rf(chip, RF2820) ||
- rt2x00_rf(chip, RF2720) ||
- (rt2x00_intf_is_pci(rt2x00dev) &&
- (rt2x00_rf(chip, RF3020) ||
- rt2x00_rf(chip, RF3021) ||
- rt2x00_rf(chip, RF3022) ||
- rt2x00_rf(chip, RF2020) ||
- rt2x00_rf(chip, RF3052)))) {
- spec->num_channels = 14;
- spec->channels = rf_vals;
- } else if (rt2x00_rf(chip, RF2850) ||
- rt2x00_rf(chip, RF2750)) {
- spec->supported_bands |= SUPPORT_BAND_5GHZ;
- spec->num_channels = ARRAY_SIZE(rf_vals);
- spec->channels = rf_vals;
- }
-
- /*
- * Initialize HT information.
- */
- spec->ht.ht_supported = true;
- spec->ht.cap =
- IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
- IEEE80211_HT_CAP_GRN_FLD |
- IEEE80211_HT_CAP_SGI_20 |
- IEEE80211_HT_CAP_SGI_40 |
- IEEE80211_HT_CAP_TX_STBC |
- IEEE80211_HT_CAP_RX_STBC |
- IEEE80211_HT_CAP_PSMP_SUPPORT;
- spec->ht.ampdu_factor = 3;
- spec->ht.ampdu_density = 4;
- spec->ht.mcs.tx_params =
- IEEE80211_HT_MCS_TX_DEFINED |
- IEEE80211_HT_MCS_TX_RX_DIFF |
- ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
- IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
-
- switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
- case 3:
- spec->ht.mcs.rx_mask[2] = 0xff;
- case 2:
- spec->ht.mcs.rx_mask[1] = 0xff;
- case 1:
- spec->ht.mcs.rx_mask[0] = 0xff;
- spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
- break;
- }
-
- /*
- * Create channel information array
- */
- info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
- if (!info)
- return -ENOMEM;
-
- spec->channels_info = info;
-
- tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
- tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
-
- for (i = 0; i < 14; i++) {
- info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
- info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
- }
-
- if (spec->num_channels > 14) {
- tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
- tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
-
- for (i = 14; i < spec->num_channels; i++) {
- info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
- info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
- }
- }
-
- return 0;
-}
-
static const struct rt2800_ops rt2800pci_rt2800_ops = {
.register_read = rt2x00pci_register_read,
.register_write = rt2x00pci_register_write,
@@ -1319,7 +1131,7 @@ static int rt2800pci_probe_hw(struct rt2
/*
* Initialize hw specifications.
*/
- retval = rt2800pci_probe_hw_mode(rt2x00dev);
+ retval = rt2800_probe_hw_mode(rt2x00dev);
if (retval)
return retval;
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -672,215 +672,6 @@ static int rt2800usb_validate_eeprom(str
return rt2800_validate_eeprom(rt2x00dev);
}
-/*
- * RF value list for rt2870
- * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
- */
-static const struct rf_channel rf_vals[] = {
- { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
- { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
- { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
- { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
- { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
- { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
- { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
- { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
- { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
- { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
- { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
- { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
- { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
- { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
-
- /* 802.11 UNI / HyperLan 2 */
- { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
- { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
- { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
- { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
- { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
- { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
- { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
- { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
- { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
- { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
- { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
- { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
-
- /* 802.11 HyperLan 2 */
- { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
- { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
- { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
- { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
- { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
- { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
- { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
- { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
- { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
- { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
- { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
- { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
- { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
- { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
- { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
- { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
-
- /* 802.11 UNII */
- { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
- { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
- { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
- { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
- { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
- { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
- { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
- { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
- { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
- { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
- { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
-
- /* 802.11 Japan */
- { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
- { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
- { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
- { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
- { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
- { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
- { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
-};
-
-/*
- * RF value list for rt3070
- * Supports: 2.4 GHz
- */
-static const struct rf_channel rf_vals_3070[] = {
- {1, 241, 2, 2 },
- {2, 241, 2, 7 },
- {3, 242, 2, 2 },
- {4, 242, 2, 7 },
- {5, 243, 2, 2 },
- {6, 243, 2, 7 },
- {7, 244, 2, 2 },
- {8, 244, 2, 7 },
- {9, 245, 2, 2 },
- {10, 245, 2, 7 },
- {11, 246, 2, 2 },
- {12, 246, 2, 7 },
- {13, 247, 2, 2 },
- {14, 248, 2, 4 },
-};
-
-static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
-{
- struct rt2x00_chip *chip = &rt2x00dev->chip;
- struct hw_mode_spec *spec = &rt2x00dev->spec;
- struct channel_info *info;
- char *tx_power1;
- char *tx_power2;
- unsigned int i;
- u16 eeprom;
-
- /*
- * Initialize all hw fields.
- */
- rt2x00dev->hw->flags =
- IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
- IEEE80211_HW_SIGNAL_DBM |
- IEEE80211_HW_SUPPORTS_PS |
- IEEE80211_HW_PS_NULLFUNC_STACK;
-
- if (rt2x00_intf_is_usb(rt2x00dev))
- rt2x00dev->hw->extra_tx_headroom =
- TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
-
- SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
- SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
- rt2x00_eeprom_addr(rt2x00dev,
- EEPROM_MAC_ADDR_0));
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-
- /*
- * Initialize hw_mode information.
- */
- spec->supported_bands = SUPPORT_BAND_2GHZ;
- spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
-
- if (rt2x00_rf(chip, RF2820) ||
- rt2x00_rf(chip, RF2720)) {
- spec->num_channels = 14;
- spec->channels = rf_vals;
- } else if (rt2x00_rf(chip, RF2850) ||
- rt2x00_rf(chip, RF2750)) {
- spec->supported_bands |= SUPPORT_BAND_5GHZ;
- spec->num_channels = ARRAY_SIZE(rf_vals);
- spec->channels = rf_vals;
- } else if (rt2x00_intf_is_usb(rt2x00dev) &&
- (rt2x00_rf(chip, RF3020) ||
- rt2x00_rf(chip, RF2020))) {
- spec->num_channels = ARRAY_SIZE(rf_vals_3070);
- spec->channels = rf_vals_3070;
- }
-
- /*
- * Initialize HT information.
- */
- spec->ht.ht_supported = true;
- spec->ht.cap =
- IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
- IEEE80211_HT_CAP_GRN_FLD |
- IEEE80211_HT_CAP_SGI_20 |
- IEEE80211_HT_CAP_SGI_40 |
- IEEE80211_HT_CAP_TX_STBC |
- IEEE80211_HT_CAP_RX_STBC |
- IEEE80211_HT_CAP_PSMP_SUPPORT;
- spec->ht.ampdu_factor = 3;
- spec->ht.ampdu_density = 4;
- spec->ht.mcs.tx_params =
- IEEE80211_HT_MCS_TX_DEFINED |
- IEEE80211_HT_MCS_TX_RX_DIFF |
- ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
- IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
-
- switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
- case 3:
- spec->ht.mcs.rx_mask[2] = 0xff;
- case 2:
- spec->ht.mcs.rx_mask[1] = 0xff;
- case 1:
- spec->ht.mcs.rx_mask[0] = 0xff;
- spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
- break;
- }
-
- /*
- * Create channel information array
- */
- info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
- if (!info)
- return -ENOMEM;
-
- spec->channels_info = info;
-
- tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
- tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
-
- for (i = 0; i < 14; i++) {
- info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
- info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
- }
-
- if (spec->num_channels > 14) {
- tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
- tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
-
- for (i = 14; i < spec->num_channels; i++) {
- info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
- info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
- }
- }
-
- return 0;
-}
-
static const struct rt2800_ops rt2800usb_rt2800_ops = {
.register_read = rt2x00usb_register_read,
.register_write = rt2x00usb_register_write,
@@ -914,7 +705,7 @@ static int rt2800usb_probe_hw(struct rt2
/*
* Initialize hw specifications.
*/
- retval = rt2800usb_probe_hw_mode(rt2x00dev);
+ retval = rt2800_probe_hw_mode(rt2x00dev);
if (retval)
return retval;
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 7/9] rt2800usb: fix RX descriptor naming
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (4 preceding siblings ...)
2009-11-08 13:39 ` [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode() Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:54 ` Ivo van Doorn
2009-11-08 14:37 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib Bartlomiej Zolnierkiewicz
` (3 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Gertjan van Wingerde, Bartlomiej Zolnierkiewicz, Ivo van Doorn
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800usb: fix RX descriptor naming
Rename RXD_W0_* defines to RXINFO_W0_* ones to match naming
used for TX descriptor and by the vendor driver.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 10 ++++----
drivers/net/wireless/rt2x00/rt2800usb.h | 40 ++++++++++++++++----------------
2 files changed, 25 insertions(+), 25 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -594,16 +594,16 @@ static void rt2800usb_fill_rxdone(struct
rt2x00_desc_read(rxwi, 2, &rxwi2);
rt2x00_desc_read(rxwi, 3, &rxwi3);
- if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR))
+ if (rt2x00_get_field32(rxd0, RXINFO_W0_CRC_ERROR))
rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) {
rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
rxdesc->cipher_status =
- rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR);
+ rt2x00_get_field32(rxd0, RXINFO_W0_CIPHER_ERROR);
}
- if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) {
+ if (rt2x00_get_field32(rxd0, RXINFO_W0_DECRYPTED)) {
/*
* Hardware has stripped IV/EIV data from 802.11 frame during
* decryption. Unfortunately the descriptor doesn't contain
@@ -618,10 +618,10 @@ static void rt2800usb_fill_rxdone(struct
rxdesc->flags |= RX_FLAG_MMIC_ERROR;
}
- if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS))
+ if (rt2x00_get_field32(rxd0, RXINFO_W0_MY_BSS))
rxdesc->dev_flags |= RXDONE_MY_BSS;
- if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) {
+ if (rt2x00_get_field32(rxd0, RXINFO_W0_L2PAD)) {
rxdesc->dev_flags |= RXDONE_L2PAD;
skbdesc->flags |= SKBDESC_L2_PADDED;
}
Index: b/drivers/net/wireless/rt2x00/rt2800usb.h
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.h
+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
@@ -111,25 +111,25 @@
* AMSDU: rx with 802.3 header, not 802.11 header.
*/
-#define RXD_W0_BA FIELD32(0x00000001)
-#define RXD_W0_DATA FIELD32(0x00000002)
-#define RXD_W0_NULLDATA FIELD32(0x00000004)
-#define RXD_W0_FRAG FIELD32(0x00000008)
-#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000010)
-#define RXD_W0_MULTICAST FIELD32(0x00000020)
-#define RXD_W0_BROADCAST FIELD32(0x00000040)
-#define RXD_W0_MY_BSS FIELD32(0x00000080)
-#define RXD_W0_CRC_ERROR FIELD32(0x00000100)
-#define RXD_W0_CIPHER_ERROR FIELD32(0x00000600)
-#define RXD_W0_AMSDU FIELD32(0x00000800)
-#define RXD_W0_HTC FIELD32(0x00001000)
-#define RXD_W0_RSSI FIELD32(0x00002000)
-#define RXD_W0_L2PAD FIELD32(0x00004000)
-#define RXD_W0_AMPDU FIELD32(0x00008000)
-#define RXD_W0_DECRYPTED FIELD32(0x00010000)
-#define RXD_W0_PLCP_RSSI FIELD32(0x00020000)
-#define RXD_W0_CIPHER_ALG FIELD32(0x00040000)
-#define RXD_W0_LAST_AMSDU FIELD32(0x00080000)
-#define RXD_W0_PLCP_SIGNAL FIELD32(0xfff00000)
+#define RXINFO_W0_BA FIELD32(0x00000001)
+#define RXINFO_W0_DATA FIELD32(0x00000002)
+#define RXINFO_W0_NULLDATA FIELD32(0x00000004)
+#define RXINFO_W0_FRAG FIELD32(0x00000008)
+#define RXINFO_W0_UNICAST_TO_ME FIELD32(0x00000010)
+#define RXINFO_W0_MULTICAST FIELD32(0x00000020)
+#define RXINFO_W0_BROADCAST FIELD32(0x00000040)
+#define RXINFO_W0_MY_BSS FIELD32(0x00000080)
+#define RXINFO_W0_CRC_ERROR FIELD32(0x00000100)
+#define RXINFO_W0_CIPHER_ERROR FIELD32(0x00000600)
+#define RXINFO_W0_AMSDU FIELD32(0x00000800)
+#define RXINFO_W0_HTC FIELD32(0x00001000)
+#define RXINFO_W0_RSSI FIELD32(0x00002000)
+#define RXINFO_W0_L2PAD FIELD32(0x00004000)
+#define RXINFO_W0_AMPDU FIELD32(0x00008000)
+#define RXINFO_W0_DECRYPTED FIELD32(0x00010000)
+#define RXINFO_W0_PLCP_RSSI FIELD32(0x00020000)
+#define RXINFO_W0_CIPHER_ALG FIELD32(0x00040000)
+#define RXINFO_W0_LAST_AMSDU FIELD32(0x00080000)
+#define RXINFO_W0_PLCP_SIGNAL FIELD32(0xfff00000)
#endif /* RT2800USB_H */
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (5 preceding siblings ...)
2009-11-08 13:39 ` [PATCH 7/9] rt2800usb: fix RX descriptor naming Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:55 ` Ivo van Doorn
2009-11-08 14:38 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 9/9] rt2800usb: add eFuse EEPROM support Bartlomiej Zolnierkiewicz
` (2 subsequent siblings)
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Ivo van Doorn, Bartlomiej Zolnierkiewicz, Gertjan van Wingerde
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
eFuse EEPROM is used also by USB chips (i.e. RT3070)
so move the needed code from rt2800pci to rt2800lib.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
5 files changed, 77 insertions(+), 64 deletions(-)
Index: b/drivers/net/wireless/rt2x00/rt2800.h
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -362,6 +362,35 @@
#define RF_CSR_CFG_BUSY FIELD32(0x00020000)
/*
+ * EFUSE_CSR: RT30x0 EEPROM
+ */
+#define EFUSE_CTRL 0x0580
+#define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000)
+#define EFUSE_CTRL_MODE FIELD32(0x000000c0)
+#define EFUSE_CTRL_KICK FIELD32(0x40000000)
+#define EFUSE_CTRL_PRESENT FIELD32(0x80000000)
+
+/*
+ * EFUSE_DATA0
+ */
+#define EFUSE_DATA0 0x0590
+
+/*
+ * EFUSE_DATA1
+ */
+#define EFUSE_DATA1 0x0594
+
+/*
+ * EFUSE_DATA2
+ */
+#define EFUSE_DATA2 0x0598
+
+/*
+ * EFUSE_DATA3
+ */
+#define EFUSE_DATA3 0x059c
+
+/*
* MAC Control/Status Registers(CSR).
* Some values are set in TU, whereas 1 TU == 1024 us.
*/
Index: b/drivers/net/wireless/rt2x00/rt2800lib.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1659,6 +1659,49 @@ int rt2800_init_rfcsr(struct rt2x00_dev
}
EXPORT_SYMBOL_GPL(rt2800_init_rfcsr);
+int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
+
+ rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
+
+ return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
+}
+EXPORT_SYMBOL_GPL(rt2800_efuse_detect);
+
+static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i)
+{
+ u32 reg;
+
+ rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
+ rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i);
+ rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0);
+ rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1);
+ rt2800_register_write(rt2x00dev, EFUSE_CTRL, reg);
+
+ /* Wait until the EEPROM has been loaded */
+ rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®);
+
+ /* Apparently the data is read from end to start */
+ rt2800_register_read(rt2x00dev, EFUSE_DATA3,
+ (u32 *)&rt2x00dev->eeprom[i]);
+ rt2800_register_read(rt2x00dev, EFUSE_DATA2,
+ (u32 *)&rt2x00dev->eeprom[i + 2]);
+ rt2800_register_read(rt2x00dev, EFUSE_DATA1,
+ (u32 *)&rt2x00dev->eeprom[i + 4]);
+ rt2800_register_read(rt2x00dev, EFUSE_DATA0,
+ (u32 *)&rt2x00dev->eeprom[i + 6]);
+}
+
+void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
+{
+ unsigned int i;
+
+ for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
+ rt2800_efuse_read(rt2x00dev, i);
+}
+EXPORT_SYMBOL_GPL(rt2800_read_eeprom_efuse);
+
int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
{
u16 word;
Index: b/drivers/net/wireless/rt2x00/rt2800lib.h
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -129,6 +129,8 @@ int rt2800_init_registers(struct rt2x00_
int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev);
int rt2800_init_rfcsr(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);
Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
{
- u32 reg;
-
- rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
-
- return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
+ return rt2800_efuse_detect(rt2x00dev);
}
-static void rt2800pci_efuse_read(struct rt2x00_dev *rt2x00dev,
- unsigned int i)
-{
- u32 reg;
-
- rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
- rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i);
- rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0);
- rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1);
- rt2800_register_write(rt2x00dev, EFUSE_CTRL, reg);
-
- /* Wait until the EEPROM has been loaded */
- rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®);
-
- /* Apparently the data is read from end to start */
- rt2800_register_read(rt2x00dev, EFUSE_DATA3,
- (u32 *)&rt2x00dev->eeprom[i]);
- rt2800_register_read(rt2x00dev, EFUSE_DATA2,
- (u32 *)&rt2x00dev->eeprom[i + 2]);
- rt2800_register_read(rt2x00dev, EFUSE_DATA1,
- (u32 *)&rt2x00dev->eeprom[i + 4]);
- rt2800_register_read(rt2x00dev, EFUSE_DATA0,
- (u32 *)&rt2x00dev->eeprom[i + 6]);
-}
-
-static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
+static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
{
- unsigned int i;
-
- for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
- rt2800pci_efuse_read(rt2x00dev, i);
+ rt2800_read_eeprom_efuse(rt2x00dev);
}
#else
static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
Index: b/drivers/net/wireless/rt2x00/rt2800pci.h
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.h
+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
@@ -56,35 +56,6 @@
#define TX_DTX_IDX(__x) TX_DTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET)
/*
- * EFUSE_CSR: RT3090 EEPROM
- */
-#define EFUSE_CTRL 0x0580
-#define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000)
-#define EFUSE_CTRL_MODE FIELD32(0x000000c0)
-#define EFUSE_CTRL_KICK FIELD32(0x40000000)
-#define EFUSE_CTRL_PRESENT FIELD32(0x80000000)
-
-/*
- * EFUSE_DATA0
- */
-#define EFUSE_DATA0 0x0590
-
-/*
- * EFUSE_DATA1
- */
-#define EFUSE_DATA1 0x0594
-
-/*
- * EFUSE_DATA2
- */
-#define EFUSE_DATA2 0x0598
-
-/*
- * EFUSE_DATA3
- */
-#define EFUSE_DATA3 0x059c
-
-/*
* 8051 firmware image.
*/
#define FIRMWARE_RT2860 "rt2860.bin"
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 9/9] rt2800usb: add eFuse EEPROM support
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (6 preceding siblings ...)
2009-11-08 13:39 ` [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz
2009-11-08 13:56 ` Ivo van Doorn
2009-11-08 14:41 ` Gertjan van Wingerde
2009-11-08 13:50 ` [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Ivo van Doorn
2009-11-08 14:16 ` Gertjan van Wingerde
9 siblings, 2 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 13:39 UTC (permalink / raw)
To: linux-wireless
Cc: Gertjan van Wingerde, Bartlomiej Zolnierkiewicz, Ivo van Doorn
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800usb: add eFuse EEPROM support
It is needed for at least RT3070 chip.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -667,7 +667,11 @@ static void rt2800usb_fill_rxdone(struct
*/
static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
{
- rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
+ if (rt2800_efuse_detect(rt2x00dev))
+ rt2800_read_eeprom_efuse(rt2x00dev);
+ else
+ rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
+ EEPROM_SIZE);
return rt2800_validate_eeprom(rt2x00dev);
}
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] rt2800: prepare for unification of EEPROM support code
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (7 preceding siblings ...)
2009-11-08 13:39 ` [PATCH 9/9] rt2800usb: add eFuse EEPROM support Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:50 ` Ivo van Doorn
2009-11-08 14:16 ` Gertjan van Wingerde
9 siblings, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:50 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: prepare for unification of EEPROM support code
>
> * Factor out common code from rt2800[pci,usb]_validate_eeprom()
> to rt2800_validate_eeprom().
>
> * Fix interface specific comment in rt2800[pci,usb]_validate_eeprom().
>
> * Enclose interface specific code in rt2800[pci,usb]_init_eeprom()
> with rt2x00_intf_is_[pci,usb]() checks.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> on top of "rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci."
> patch from Gertjan
>
> drivers/net/wireless/rt2x00/rt2800pci.c | 51 ++++++++++++++++++--------------
> drivers/net/wireless/rt2x00/rt2800usb.c | 40 +++++++++++++++----------
> 2 files changed, 55 insertions(+), 36 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1091,29 +1091,13 @@ static irqreturn_t rt2800pci_interrupt(i
> /*
> * Device probe functions.
> */
> -static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> +static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> u16 word;
> u8 *mac;
> u8 default_lna_gain;
>
> /*
> - * Read EEPROM into buffer
> - */
> - switch(rt2x00dev->chip.rt) {
> - case RT2880:
> - case RT3052:
> - rt2800pci_read_eeprom_soc(rt2x00dev);
> - break;
> - default:
> - if (rt2800pci_efuse_detect(rt2x00dev))
> - rt2800pci_read_eeprom_efuse(rt2x00dev);
> - else
> - rt2800pci_read_eeprom_pci(rt2x00dev);
> - break;
> - }
> -
> - /*
> * Start validation of the data that has been read.
> */
> mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
> @@ -1131,7 +1115,7 @@ static int rt2800pci_validate_eeprom(str
> EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
> } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
> /*
> - * There is a max of 2 RX streams for RT2860 series
> + * There is a max of 2 RX streams for RT28x0 series
> */
> if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
> rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> @@ -1210,6 +1194,27 @@ static int rt2800pci_validate_eeprom(str
> return 0;
> }
>
> +static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> +{
> + /*
> + * Read EEPROM into buffer
> + */
> + switch (rt2x00dev->chip.rt) {
> + case RT2880:
> + case RT3052:
> + rt2800pci_read_eeprom_soc(rt2x00dev);
> + break;
> + default:
> + if (rt2800pci_efuse_detect(rt2x00dev))
> + rt2800pci_read_eeprom_efuse(rt2x00dev);
> + else
> + rt2800pci_read_eeprom_pci(rt2x00dev);
> + break;
> + }
> +
> + return rt2800_validate_eeprom(rt2x00dev);
> +}
> +
> static int rt2800pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> u32 reg;
> @@ -1226,7 +1231,9 @@ static int rt2800pci_init_eeprom(struct
> */
> value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
> rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
> - rt2x00_set_chip_rf(rt2x00dev, value, reg);
> +
> + if (rt2x00_intf_is_pci(rt2x00dev))
> + rt2x00_set_chip_rf(rt2x00dev, value, reg);
>
> if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
> !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
> @@ -1234,8 +1241,10 @@ static int rt2800pci_init_eeprom(struct
> !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
> !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
> + (rt2x00_intf_is_usb(rt2x00dev) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
> ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
> return -ENODEV;
> }
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -665,14 +665,12 @@ static void rt2800usb_fill_rxdone(struct
> /*
> * Device probe functions.
> */
> -static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> +static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> u16 word;
> u8 *mac;
> u8 default_lna_gain;
>
> - rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
> -
> /*
> * Start validation of the data that has been read.
> */
> @@ -691,7 +689,7 @@ static int rt2800usb_validate_eeprom(str
> EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
> } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
> /*
> - * There is a max of 2 RX streams for RT2870 series
> + * There is a max of 2 RX streams for RT28x0 series
> */
> if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
> rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> @@ -770,6 +768,13 @@ static int rt2800usb_validate_eeprom(str
> return 0;
> }
>
> +static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> +{
> + rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
> +
> + return rt2800_validate_eeprom(rt2x00dev);
> +}
> +
> static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> u32 reg;
> @@ -786,18 +791,23 @@ static int rt2800usb_init_eeprom(struct
> */
> value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
> rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
> - rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
>
> - /*
> - * The check for rt2860 is not a typo, some rt2870 hardware
> - * identifies itself as rt2860 in the CSR register.
> - */
> - if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) &&
> - !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) &&
> - !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) &&
> - !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) {
> - ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
> - return -ENODEV;
> + if (rt2x00_intf_is_usb(rt2x00dev)) {
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> +
> + rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
> +
> + /*
> + * The check for rt2860 is not a typo, some rt2870 hardware
> + * identifies itself as rt2860 in the CSR register.
> + */
> + if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) &&
> + !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) &&
> + !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) &&
> + !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
> + ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
> + return -ENODEV;
> + }
> }
>
> if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/9] rt2800: unify EEPROM support code
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:51 ` Ivo van Doorn
2009-11-08 14:19 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:51 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: unify EEPROM support code
>
> Add rt2800_validate_eeprom() and rt2800_init_eeprom() to rt2800lib.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 199 ++++++++++++++++++++++++++++++++
> drivers/net/wireless/rt2x00/rt2800lib.h | 3
> drivers/net/wireless/rt2x00/rt2800pci.c | 183 -----------------------------
> drivers/net/wireless/rt2x00/rt2800usb.c | 195 -------------------------------
> 4 files changed, 204 insertions(+), 376 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800lib.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -1659,6 +1659,205 @@ int rt2800_init_rfcsr(struct rt2x00_dev
> }
> EXPORT_SYMBOL_GPL(rt2800_init_rfcsr);
>
> +int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> +{
> + u16 word;
> + u8 *mac;
> + u8 default_lna_gain;
> +
> + /*
> + * Start validation of the data that has been read.
> + */
> + mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
> + if (!is_valid_ether_addr(mac)) {
> + random_ether_addr(mac);
> + EEPROM(rt2x00dev, "MAC: %pM\n", mac);
> + }
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);
> + if (word == 0xffff) {
> + rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> + rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1);
> + rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
> + EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
> + } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
> + /*
> + * There is a max of 2 RX streams for RT28x0 series
> + */
> + if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
> + rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
> + }
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
> + if (word == 0xffff) {
> + rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
> + rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
> + EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
> + }
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
> + if ((word & 0x00ff) == 0x00ff) {
> + rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
> + rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
> + LED_MODE_TXRX_ACTIVITY);
> + rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8);
> + EEPROM(rt2x00dev, "Freq: 0x%04x\n", word);
> + }
> +
> + /*
> + * During the LNA validation we are going to use
> + * lna0 as correct value. Note that EEPROM_LNA
> + * is never validated.
> + */
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
> + default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
> + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
> + rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
> + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
> + rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
> + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
> + rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
> + if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
> + rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
> + rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
> + default_lna_gain);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
> + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
> + rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
> + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
> + rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
> + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
> + rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
> + if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
> + rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
> + rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
> + default_lna_gain);
> + rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(rt2800_validate_eeprom);
> +
> +int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
> +{
> + u32 reg;
> + u16 value;
> + u16 eeprom;
> +
> + /*
> + * Read EEPROM word for configuration.
> + */
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> +
> + /*
> + * Identify RF chipset.
> + */
> + value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
> + rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
> +
> + if (rt2x00_intf_is_usb(rt2x00dev)) {
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> +
> + rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
> +
> + /*
> + * The check for rt2860 is not a typo, some rt2870 hardware
> + * identifies itself as rt2860 in the CSR register.
> + */
> + if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) &&
> + !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) &&
> + !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) &&
> + !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
> + ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
> + return -ENODEV;
> + }
> + } else if (rt2x00_intf_is_pci(rt2x00dev))
> + rt2x00_set_chip_rf(rt2x00dev, value, reg);
> +
> + if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
> + (rt2x00_intf_is_usb(rt2x00dev) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
> + ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
> + return -ENODEV;
> + }
> +
> + /*
> + * Identify default antenna configuration.
> + */
> + rt2x00dev->default_ant.tx =
> + rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH);
> + rt2x00dev->default_ant.rx =
> + rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH);
> +
> + /*
> + * Read frequency offset and RF programming sequence.
> + */
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
> + rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
> +
> + /*
> + * Read external LNA informations.
> + */
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
> +
> + if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
> + __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
> + if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
> + __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
> +
> + /*
> + * Detect if this device has an hardware controlled radio.
> + */
> + if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
> + __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
> +
> + /*
> + * Store led settings, for correct led behaviour.
> + */
> +#ifdef CONFIG_RT2X00_LIB_LEDS
> + rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
> + rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
> + rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg);
> +#endif /* CONFIG_RT2X00_LIB_LEDS */
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(rt2800_init_eeprom);
> +
> /*
> * IEEE80211 stack callback functions.
> */
> Index: b/drivers/net/wireless/rt2x00/rt2800lib.h
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800lib.h
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
> @@ -129,6 +129,9 @@ int rt2800_init_registers(struct rt2x00_
> int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev);
> int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev);
>
> +int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev);
> +int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev);
> +
> extern const struct ieee80211_ops rt2800_mac80211_ops;
>
> #endif /* RT2800LIB_H */
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1077,109 +1077,6 @@ static irqreturn_t rt2800pci_interrupt(i
> /*
> * Device probe functions.
> */
> -static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> -{
> - u16 word;
> - u8 *mac;
> - u8 default_lna_gain;
> -
> - /*
> - * Start validation of the data that has been read.
> - */
> - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
> - if (!is_valid_ether_addr(mac)) {
> - random_ether_addr(mac);
> - EEPROM(rt2x00dev, "MAC: %pM\n", mac);
> - }
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);
> - if (word == 0xffff) {
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1);
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
> - EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
> - } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
> - /*
> - * There is a max of 2 RX streams for RT28x0 series
> - */
> - if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
> - }
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
> - if (word == 0xffff) {
> - rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
> - EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
> - }
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
> - if ((word & 0x00ff) == 0x00ff) {
> - rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
> - rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
> - LED_MODE_TXRX_ACTIVITY);
> - rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8);
> - EEPROM(rt2x00dev, "Freq: 0x%04x\n", word);
> - }
> -
> - /*
> - * During the LNA validation we are going to use
> - * lna0 as correct value. Note that EEPROM_LNA
> - * is never validated.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
> - default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
> - if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
> - rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
> - default_lna_gain);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
> - if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
> - rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
> - default_lna_gain);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
> -
> - return 0;
> -}
> -
> static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> /*
> @@ -1201,84 +1098,6 @@ static int rt2800pci_validate_eeprom(str
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
> -static int rt2800pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
> -{
> - u32 reg;
> - u16 value;
> - u16 eeprom;
> -
> - /*
> - * Read EEPROM word for configuration.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> -
> - /*
> - * Identify RF chipset.
> - */
> - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
> - rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
> -
> - if (rt2x00_intf_is_pci(rt2x00dev))
> - rt2x00_set_chip_rf(rt2x00dev, value, reg);
> -
> - if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
> - (rt2x00_intf_is_usb(rt2x00dev) ||
> - (rt2x00_intf_is_pci(rt2x00dev) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
> - ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
> - return -ENODEV;
> - }
> -
> - /*
> - * Identify default antenna configuration.
> - */
> - rt2x00dev->default_ant.tx =
> - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH);
> - rt2x00dev->default_ant.rx =
> - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH);
> -
> - /*
> - * Read frequency offset and RF programming sequence.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
> - rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
> -
> - /*
> - * Read external LNA informations.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
> -
> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
> - __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
> - __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
> -
> - /*
> - * Detect if this device has an hardware controlled radio.
> - */
> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
> - __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
> -
> - /*
> - * Store led settings, for correct led behaviour.
> - */
> -#ifdef CONFIG_RT2X00_LIB_LEDS
> - rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
> - rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
> - rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg);
> -#endif /* CONFIG_RT2X00_LIB_LEDS */
> -
> - return 0;
> -}
> -
> /*
> * RF value list for rt2860
> * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> @@ -1485,7 +1304,7 @@ static int rt2800pci_probe_hw(struct rt2
> if (retval)
> return retval;
>
> - retval = rt2800pci_init_eeprom(rt2x00dev);
> + retval = rt2800_init_eeprom(rt2x00dev);
> if (retval)
> return retval;
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -665,109 +665,6 @@ static void rt2800usb_fill_rxdone(struct
> /*
> * Device probe functions.
> */
> -static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> -{
> - u16 word;
> - u8 *mac;
> - u8 default_lna_gain;
> -
> - /*
> - * Start validation of the data that has been read.
> - */
> - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
> - if (!is_valid_ether_addr(mac)) {
> - random_ether_addr(mac);
> - EEPROM(rt2x00dev, "MAC: %pM\n", mac);
> - }
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);
> - if (word == 0xffff) {
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1);
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
> - EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
> - } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
> - /*
> - * There is a max of 2 RX streams for RT28x0 series
> - */
> - if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
> - rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
> - }
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
> - if (word == 0xffff) {
> - rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
> - rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
> - EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
> - }
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
> - if ((word & 0x00ff) == 0x00ff) {
> - rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
> - rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
> - LED_MODE_TXRX_ACTIVITY);
> - rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8);
> - EEPROM(rt2x00dev, "Freq: 0x%04x\n", word);
> - }
> -
> - /*
> - * During the LNA validation we are going to use
> - * lna0 as correct value. Note that EEPROM_LNA
> - * is never validated.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
> - default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
> - if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
> - rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
> - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
> - default_lna_gain);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
> - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
> - if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
> - rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
> - rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
> - default_lna_gain);
> - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
> -
> - return 0;
> -}
> -
> static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
> @@ -775,96 +672,6 @@ static int rt2800usb_validate_eeprom(str
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
> -static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
> -{
> - u32 reg;
> - u16 value;
> - u16 eeprom;
> -
> - /*
> - * Read EEPROM word for configuration.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> -
> - /*
> - * Identify RF chipset.
> - */
> - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
> - rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
> -
> - if (rt2x00_intf_is_usb(rt2x00dev)) {
> - struct rt2x00_chip *chip = &rt2x00dev->chip;
> -
> - rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
> -
> - /*
> - * The check for rt2860 is not a typo, some rt2870 hardware
> - * identifies itself as rt2860 in the CSR register.
> - */
> - if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) &&
> - !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) &&
> - !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) &&
> - !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
> - ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
> - return -ENODEV;
> - }
> - }
> -
> - if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> - ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
> - return -ENODEV;
> - }
> -
> - /*
> - * Identify default antenna configuration.
> - */
> - rt2x00dev->default_ant.tx =
> - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH);
> - rt2x00dev->default_ant.rx =
> - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH);
> -
> - /*
> - * Read frequency offset and RF programming sequence.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
> - rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
> -
> - /*
> - * Read external LNA informations.
> - */
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
> -
> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
> - __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
> - __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
> -
> - /*
> - * Detect if this device has an hardware controlled radio.
> - */
> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
> - __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
> -
> - /*
> - * Store led settings, for correct led behaviour.
> - */
> -#ifdef CONFIG_RT2X00_LIB_LEDS
> - rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
> - rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
> - rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ,
> - &rt2x00dev->led_mcu_reg);
> -#endif /* CONFIG_RT2X00_LIB_LEDS */
> -
> - return 0;
> -}
> -
> /*
> * RF value list for rt2870
> * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> @@ -1095,7 +902,7 @@ static int rt2800usb_probe_hw(struct rt2
> if (retval)
> return retval;
>
> - retval = rt2800usb_init_eeprom(rt2x00dev);
> + retval = rt2800_init_eeprom(rt2x00dev);
> if (retval)
> return retval;
>
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table
2009-11-08 13:39 ` [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:51 ` Ivo van Doorn
2009-11-08 14:20 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:51 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800pci: add missing RF values to rf_vals table
>
> rt2800pci's rf_vals[] copy was missing values for some channels.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800pci.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1158,6 +1158,10 @@ static const struct rf_channel rf_vals[]
> { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> + { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> + { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> + { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> + { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
>
> /* 802.11 Japan */
> { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
2009-11-08 13:39 ` [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode() Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:52 ` Ivo van Doorn
2009-11-08 14:20 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:52 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
>
> Move hw_mode information initialization code block before
> HT information initialization one to match the ordering used
> by rt2800pci's rt2800pci_probe_hw_mode().
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800usb.c | 42 ++++++++++++++++----------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -795,6 +795,27 @@ static int rt2800usb_probe_hw_mode(struc
> rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
>
> /*
> + * Initialize hw_mode information.
> + */
> + spec->supported_bands = SUPPORT_BAND_2GHZ;
> + spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> +
> + if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> + rt2x00_rf(&rt2x00dev->chip, RF2720)) {
> + spec->num_channels = 14;
> + spec->channels = rf_vals;
> + } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> + rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> + spec->supported_bands |= SUPPORT_BAND_5GHZ;
> + spec->num_channels = ARRAY_SIZE(rf_vals);
> + spec->channels = rf_vals;
> + } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> + rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> + spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> + spec->channels = rf_vals_3070;
> + }
> +
> + /*
> * Initialize HT information.
> */
> spec->ht.ht_supported = true;
> @@ -826,27 +847,6 @@ static int rt2800usb_probe_hw_mode(struc
> }
>
> /*
> - * Initialize hw_mode information.
> - */
> - spec->supported_bands = SUPPORT_BAND_2GHZ;
> - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> -
> - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2720)) {
> - spec->num_channels = 14;
> - spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> - spec->supported_bands |= SUPPORT_BAND_5GHZ;
> - spec->num_channels = ARRAY_SIZE(rf_vals);
> - spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> - spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> - spec->channels = rf_vals_3070;
> - }
> -
> - /*
> * Create channel information array
> */
> info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification
2009-11-08 13:39 ` [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:53 ` Ivo van Doorn
2009-11-08 14:35 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:53 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: prepare for rt2800*_probe_hw_mode() unification
>
> Enclose interface specific code in rt2800[pci,usb]_probe_hw_mode()
> with rt2x00_intf_is_[pci,usb]() checks.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800pci.c | 24 ++++++++++++++----------
> drivers/net/wireless/rt2x00/rt2800usb.c | 19 ++++++++++++-------
> 2 files changed, 26 insertions(+), 17 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1175,6 +1175,7 @@ static const struct rf_channel rf_vals[]
>
> static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> {
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> struct hw_mode_spec *spec = &rt2x00dev->spec;
> struct channel_info *info;
> char *tx_power1;
> @@ -1190,7 +1191,9 @@ static int rt2800pci_probe_hw_mode(struc
> IEEE80211_HW_SIGNAL_DBM |
> IEEE80211_HW_SUPPORTS_PS |
> IEEE80211_HW_PS_NULLFUNC_STACK;
> - rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
> +
> + if (rt2x00_intf_is_pci(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
>
> SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> @@ -1205,17 +1208,18 @@ static int rt2800pci_probe_hw_mode(struc
> spec->supported_bands = SUPPORT_BAND_2GHZ;
> spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
>
> - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2720) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3021) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3022) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3052)) {
> + if (rt2x00_rf(chip, RF2820) ||
> + rt2x00_rf(chip, RF2720) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF3021) ||
> + rt2x00_rf(chip, RF3022) ||
> + rt2x00_rf(chip, RF2020) ||
> + rt2x00_rf(chip, RF3052)))) {
> spec->num_channels = 14;
> spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> + } else if (rt2x00_rf(chip, RF2850) ||
> + rt2x00_rf(chip, RF2750)) {
> spec->supported_bands |= SUPPORT_BAND_5GHZ;
> spec->num_channels = ARRAY_SIZE(rf_vals);
> spec->channels = rf_vals;
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -770,6 +770,7 @@ static const struct rf_channel rf_vals_3
>
> static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> {
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> struct hw_mode_spec *spec = &rt2x00dev->spec;
> struct channel_info *info;
> char *tx_power1;
> @@ -785,7 +786,10 @@ static int rt2800usb_probe_hw_mode(struc
> IEEE80211_HW_SIGNAL_DBM |
> IEEE80211_HW_SUPPORTS_PS |
> IEEE80211_HW_PS_NULLFUNC_STACK;
> - rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
> +
> + if (rt2x00_intf_is_usb(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom =
> + TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
>
> SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> @@ -800,17 +804,18 @@ static int rt2800usb_probe_hw_mode(struc
> spec->supported_bands = SUPPORT_BAND_2GHZ;
> spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
>
> - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2720)) {
> + if (rt2x00_rf(chip, RF2820) ||
> + rt2x00_rf(chip, RF2720)) {
> spec->num_channels = 14;
> spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> + } else if (rt2x00_rf(chip, RF2850) ||
> + rt2x00_rf(chip, RF2750)) {
> spec->supported_bands |= SUPPORT_BAND_5GHZ;
> spec->num_channels = ARRAY_SIZE(rf_vals);
> spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> + } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF2020))) {
> spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> spec->channels = rf_vals_3070;
> }
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode()
2009-11-08 13:39 ` [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode() Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:53 ` Ivo van Doorn
2009-11-08 14:36 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:53 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: unify rt2800*_probe_hw_mode()
>
> Add rf_vals tables and rt2800_probe_hw_mode() to rt2800lib.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 218 ++++++++++++++++++++++++++++++++
> drivers/net/wireless/rt2x00/rt2800lib.h | 1
> drivers/net/wireless/rt2x00/rt2800pci.c | 190 ---------------------------
> drivers/net/wireless/rt2x00/rt2800usb.c | 211 ------------------------------
> 4 files changed, 221 insertions(+), 399 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800lib.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -1859,6 +1859,224 @@ int rt2800_init_eeprom(struct rt2x00_dev
> EXPORT_SYMBOL_GPL(rt2800_init_eeprom);
>
> /*
> + * RF value list for rt28x0
> + * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> + */
> +static const struct rf_channel rf_vals[] = {
> + { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
> + { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
> + { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
> + { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
> + { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
> + { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
> + { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
> + { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
> + { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
> + { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
> + { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
> + { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
> + { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
> + { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
> +
> + /* 802.11 UNI / HyperLan 2 */
> + { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
> + { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
> + { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
> + { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
> + { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
> + { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
> + { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
> + { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
> + { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
> + { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
> + { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
> + { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
> +
> + /* 802.11 HyperLan 2 */
> + { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
> + { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
> + { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
> + { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
> + { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
> + { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
> + { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
> + { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
> + { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
> + { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
> + { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
> + { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
> + { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
> + { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
> + { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
> + { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
> +
> + /* 802.11 UNII */
> + { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
> + { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
> + { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
> + { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
> + { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> + { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> + { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> + { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> + { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> + { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> + { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
> +
> + /* 802.11 Japan */
> + { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
> + { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
> + { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
> + { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
> + { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
> + { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
> + { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
> +};
> +
> +/*
> + * RF value list for rt3070
> + * Supports: 2.4 GHz
> + */
> +static const struct rf_channel rf_vals_3070[] = {
> + {1, 241, 2, 2 },
> + {2, 241, 2, 7 },
> + {3, 242, 2, 2 },
> + {4, 242, 2, 7 },
> + {5, 243, 2, 2 },
> + {6, 243, 2, 7 },
> + {7, 244, 2, 2 },
> + {8, 244, 2, 7 },
> + {9, 245, 2, 2 },
> + {10, 245, 2, 7 },
> + {11, 246, 2, 2 },
> + {12, 246, 2, 7 },
> + {13, 247, 2, 2 },
> + {14, 248, 2, 4 },
> +};
> +
> +int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> +{
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> + struct hw_mode_spec *spec = &rt2x00dev->spec;
> + struct channel_info *info;
> + char *tx_power1;
> + char *tx_power2;
> + unsigned int i;
> + u16 eeprom;
> +
> + /*
> + * Initialize all hw fields.
> + */
> + rt2x00dev->hw->flags =
> + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
> + IEEE80211_HW_SIGNAL_DBM |
> + IEEE80211_HW_SUPPORTS_PS |
> + IEEE80211_HW_PS_NULLFUNC_STACK;
> +
> + if (rt2x00_intf_is_usb(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom =
> + TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
> + else if (rt2x00_intf_is_pci(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
> +
> + SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> + SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> + rt2x00_eeprom_addr(rt2x00dev,
> + EEPROM_MAC_ADDR_0));
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> +
> + /*
> + * Initialize hw_mode information.
> + */
> + spec->supported_bands = SUPPORT_BAND_2GHZ;
> + spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> +
> + if (rt2x00_rf(chip, RF2820) ||
> + rt2x00_rf(chip, RF2720) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF3021) ||
> + rt2x00_rf(chip, RF3022) ||
> + rt2x00_rf(chip, RF2020) ||
> + rt2x00_rf(chip, RF3052)))) {
> + spec->num_channels = 14;
> + spec->channels = rf_vals;
> + } else if (rt2x00_rf(chip, RF2850) ||
> + rt2x00_rf(chip, RF2750)) {
> + spec->supported_bands |= SUPPORT_BAND_5GHZ;
> + spec->num_channels = ARRAY_SIZE(rf_vals);
> + spec->channels = rf_vals;
> + } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF2020))) {
> + spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> + spec->channels = rf_vals_3070;
> + }
> +
> + /*
> + * Initialize HT information.
> + */
> + spec->ht.ht_supported = true;
> + spec->ht.cap =
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
> + IEEE80211_HT_CAP_GRN_FLD |
> + IEEE80211_HT_CAP_SGI_20 |
> + IEEE80211_HT_CAP_SGI_40 |
> + IEEE80211_HT_CAP_TX_STBC |
> + IEEE80211_HT_CAP_RX_STBC |
> + IEEE80211_HT_CAP_PSMP_SUPPORT;
> + spec->ht.ampdu_factor = 3;
> + spec->ht.ampdu_density = 4;
> + spec->ht.mcs.tx_params =
> + IEEE80211_HT_MCS_TX_DEFINED |
> + IEEE80211_HT_MCS_TX_RX_DIFF |
> + ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
> + IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
> +
> + switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
> + case 3:
> + spec->ht.mcs.rx_mask[2] = 0xff;
> + case 2:
> + spec->ht.mcs.rx_mask[1] = 0xff;
> + case 1:
> + spec->ht.mcs.rx_mask[0] = 0xff;
> + spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
> + break;
> + }
> +
> + /*
> + * Create channel information array
> + */
> + info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
> + if (!info)
> + return -ENOMEM;
> +
> + spec->channels_info = info;
> +
> + tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> + tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> +
> + for (i = 0; i < 14; i++) {
> + info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
> + info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
> + }
> +
> + if (spec->num_channels > 14) {
> + tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
> + tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
> +
> + for (i = 14; i < spec->num_channels; i++) {
> + info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
> + info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
> + }
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(rt2800_probe_hw_mode);
> +
> +/*
> * IEEE80211 stack callback functions.
> */
> static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
> Index: b/drivers/net/wireless/rt2x00/rt2800lib.h
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800lib.h
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
> @@ -131,6 +131,7 @@ int rt2800_init_rfcsr(struct rt2x00_dev
>
> 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);
>
> extern const struct ieee80211_ops rt2800_mac80211_ops;
>
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1098,194 +1098,6 @@ static int rt2800pci_validate_eeprom(str
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
> -/*
> - * RF value list for rt2860
> - * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> - */
> -static const struct rf_channel rf_vals[] = {
> - { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
> - { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
> - { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
> - { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
> - { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
> - { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
> - { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
> - { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
> - { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
> - { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
> - { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
> - { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
> - { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
> - { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
> -
> - /* 802.11 UNI / HyperLan 2 */
> - { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
> - { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
> - { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
> - { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
> - { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
> - { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
> - { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
> - { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
> - { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
> - { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
> - { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
> - { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
> -
> - /* 802.11 HyperLan 2 */
> - { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
> - { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
> - { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
> - { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
> - { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
> - { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
> - { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
> - { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
> - { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
> - { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
> - { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
> - { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
> - { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
> - { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
> - { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
> - { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
> -
> - /* 802.11 UNII */
> - { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
> - { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
> - { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
> - { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
> - { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> - { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> - { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> - { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> - { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> - { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> - { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
> -
> - /* 802.11 Japan */
> - { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
> - { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
> - { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
> - { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
> - { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
> - { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
> - { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
> -};
> -
> -static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> -{
> - struct rt2x00_chip *chip = &rt2x00dev->chip;
> - struct hw_mode_spec *spec = &rt2x00dev->spec;
> - struct channel_info *info;
> - char *tx_power1;
> - char *tx_power2;
> - unsigned int i;
> - u16 eeprom;
> -
> - /*
> - * Initialize all hw fields.
> - */
> - rt2x00dev->hw->flags =
> - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
> - IEEE80211_HW_SIGNAL_DBM |
> - IEEE80211_HW_SUPPORTS_PS |
> - IEEE80211_HW_PS_NULLFUNC_STACK;
> -
> - if (rt2x00_intf_is_pci(rt2x00dev))
> - rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
> -
> - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> - rt2x00_eeprom_addr(rt2x00dev,
> - EEPROM_MAC_ADDR_0));
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> -
> - /*
> - * Initialize hw_mode information.
> - */
> - spec->supported_bands = SUPPORT_BAND_2GHZ;
> - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> -
> - if (rt2x00_rf(chip, RF2820) ||
> - rt2x00_rf(chip, RF2720) ||
> - (rt2x00_intf_is_pci(rt2x00dev) &&
> - (rt2x00_rf(chip, RF3020) ||
> - rt2x00_rf(chip, RF3021) ||
> - rt2x00_rf(chip, RF3022) ||
> - rt2x00_rf(chip, RF2020) ||
> - rt2x00_rf(chip, RF3052)))) {
> - spec->num_channels = 14;
> - spec->channels = rf_vals;
> - } else if (rt2x00_rf(chip, RF2850) ||
> - rt2x00_rf(chip, RF2750)) {
> - spec->supported_bands |= SUPPORT_BAND_5GHZ;
> - spec->num_channels = ARRAY_SIZE(rf_vals);
> - spec->channels = rf_vals;
> - }
> -
> - /*
> - * Initialize HT information.
> - */
> - spec->ht.ht_supported = true;
> - spec->ht.cap =
> - IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
> - IEEE80211_HT_CAP_GRN_FLD |
> - IEEE80211_HT_CAP_SGI_20 |
> - IEEE80211_HT_CAP_SGI_40 |
> - IEEE80211_HT_CAP_TX_STBC |
> - IEEE80211_HT_CAP_RX_STBC |
> - IEEE80211_HT_CAP_PSMP_SUPPORT;
> - spec->ht.ampdu_factor = 3;
> - spec->ht.ampdu_density = 4;
> - spec->ht.mcs.tx_params =
> - IEEE80211_HT_MCS_TX_DEFINED |
> - IEEE80211_HT_MCS_TX_RX_DIFF |
> - ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
> - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
> -
> - switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
> - case 3:
> - spec->ht.mcs.rx_mask[2] = 0xff;
> - case 2:
> - spec->ht.mcs.rx_mask[1] = 0xff;
> - case 1:
> - spec->ht.mcs.rx_mask[0] = 0xff;
> - spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
> - break;
> - }
> -
> - /*
> - * Create channel information array
> - */
> - info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
> - if (!info)
> - return -ENOMEM;
> -
> - spec->channels_info = info;
> -
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> -
> - for (i = 0; i < 14; i++) {
> - info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
> - }
> -
> - if (spec->num_channels > 14) {
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
> -
> - for (i = 14; i < spec->num_channels; i++) {
> - info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
> - }
> - }
> -
> - return 0;
> -}
> -
> static const struct rt2800_ops rt2800pci_rt2800_ops = {
> .register_read = rt2x00pci_register_read,
> .register_write = rt2x00pci_register_write,
> @@ -1319,7 +1131,7 @@ static int rt2800pci_probe_hw(struct rt2
> /*
> * Initialize hw specifications.
> */
> - retval = rt2800pci_probe_hw_mode(rt2x00dev);
> + retval = rt2800_probe_hw_mode(rt2x00dev);
> if (retval)
> return retval;
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -672,215 +672,6 @@ static int rt2800usb_validate_eeprom(str
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
> -/*
> - * RF value list for rt2870
> - * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> - */
> -static const struct rf_channel rf_vals[] = {
> - { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
> - { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
> - { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
> - { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
> - { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
> - { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
> - { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
> - { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
> - { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
> - { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
> - { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
> - { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
> - { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
> - { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
> -
> - /* 802.11 UNI / HyperLan 2 */
> - { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
> - { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
> - { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
> - { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
> - { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
> - { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
> - { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
> - { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
> - { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
> - { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
> - { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
> - { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
> -
> - /* 802.11 HyperLan 2 */
> - { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
> - { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
> - { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
> - { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
> - { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
> - { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
> - { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
> - { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
> - { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
> - { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
> - { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
> - { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
> - { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
> - { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
> - { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
> - { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
> -
> - /* 802.11 UNII */
> - { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
> - { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
> - { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
> - { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
> - { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> - { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> - { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> - { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> - { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> - { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> - { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
> -
> - /* 802.11 Japan */
> - { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
> - { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
> - { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
> - { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
> - { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
> - { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
> - { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
> -};
> -
> -/*
> - * RF value list for rt3070
> - * Supports: 2.4 GHz
> - */
> -static const struct rf_channel rf_vals_3070[] = {
> - {1, 241, 2, 2 },
> - {2, 241, 2, 7 },
> - {3, 242, 2, 2 },
> - {4, 242, 2, 7 },
> - {5, 243, 2, 2 },
> - {6, 243, 2, 7 },
> - {7, 244, 2, 2 },
> - {8, 244, 2, 7 },
> - {9, 245, 2, 2 },
> - {10, 245, 2, 7 },
> - {11, 246, 2, 2 },
> - {12, 246, 2, 7 },
> - {13, 247, 2, 2 },
> - {14, 248, 2, 4 },
> -};
> -
> -static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> -{
> - struct rt2x00_chip *chip = &rt2x00dev->chip;
> - struct hw_mode_spec *spec = &rt2x00dev->spec;
> - struct channel_info *info;
> - char *tx_power1;
> - char *tx_power2;
> - unsigned int i;
> - u16 eeprom;
> -
> - /*
> - * Initialize all hw fields.
> - */
> - rt2x00dev->hw->flags =
> - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
> - IEEE80211_HW_SIGNAL_DBM |
> - IEEE80211_HW_SUPPORTS_PS |
> - IEEE80211_HW_PS_NULLFUNC_STACK;
> -
> - if (rt2x00_intf_is_usb(rt2x00dev))
> - rt2x00dev->hw->extra_tx_headroom =
> - TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
> -
> - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> - rt2x00_eeprom_addr(rt2x00dev,
> - EEPROM_MAC_ADDR_0));
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> -
> - /*
> - * Initialize hw_mode information.
> - */
> - spec->supported_bands = SUPPORT_BAND_2GHZ;
> - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> -
> - if (rt2x00_rf(chip, RF2820) ||
> - rt2x00_rf(chip, RF2720)) {
> - spec->num_channels = 14;
> - spec->channels = rf_vals;
> - } else if (rt2x00_rf(chip, RF2850) ||
> - rt2x00_rf(chip, RF2750)) {
> - spec->supported_bands |= SUPPORT_BAND_5GHZ;
> - spec->num_channels = ARRAY_SIZE(rf_vals);
> - spec->channels = rf_vals;
> - } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> - (rt2x00_rf(chip, RF3020) ||
> - rt2x00_rf(chip, RF2020))) {
> - spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> - spec->channels = rf_vals_3070;
> - }
> -
> - /*
> - * Initialize HT information.
> - */
> - spec->ht.ht_supported = true;
> - spec->ht.cap =
> - IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
> - IEEE80211_HT_CAP_GRN_FLD |
> - IEEE80211_HT_CAP_SGI_20 |
> - IEEE80211_HT_CAP_SGI_40 |
> - IEEE80211_HT_CAP_TX_STBC |
> - IEEE80211_HT_CAP_RX_STBC |
> - IEEE80211_HT_CAP_PSMP_SUPPORT;
> - spec->ht.ampdu_factor = 3;
> - spec->ht.ampdu_density = 4;
> - spec->ht.mcs.tx_params =
> - IEEE80211_HT_MCS_TX_DEFINED |
> - IEEE80211_HT_MCS_TX_RX_DIFF |
> - ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
> - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
> -
> - switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
> - case 3:
> - spec->ht.mcs.rx_mask[2] = 0xff;
> - case 2:
> - spec->ht.mcs.rx_mask[1] = 0xff;
> - case 1:
> - spec->ht.mcs.rx_mask[0] = 0xff;
> - spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
> - break;
> - }
> -
> - /*
> - * Create channel information array
> - */
> - info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
> - if (!info)
> - return -ENOMEM;
> -
> - spec->channels_info = info;
> -
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> -
> - for (i = 0; i < 14; i++) {
> - info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
> - }
> -
> - if (spec->num_channels > 14) {
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
> -
> - for (i = 14; i < spec->num_channels; i++) {
> - info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
> - }
> - }
> -
> - return 0;
> -}
> -
> static const struct rt2800_ops rt2800usb_rt2800_ops = {
> .register_read = rt2x00usb_register_read,
> .register_write = rt2x00usb_register_write,
> @@ -914,7 +705,7 @@ static int rt2800usb_probe_hw(struct rt2
> /*
> * Initialize hw specifications.
> */
> - retval = rt2800usb_probe_hw_mode(rt2x00dev);
> + retval = rt2800_probe_hw_mode(rt2x00dev);
> if (retval)
> return retval;
>
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 7/9] rt2800usb: fix RX descriptor naming
2009-11-08 13:39 ` [PATCH 7/9] rt2800usb: fix RX descriptor naming Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:54 ` Ivo van Doorn
2009-11-08 14:37 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:54 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800usb: fix RX descriptor naming
>
> Rename RXD_W0_* defines to RXINFO_W0_* ones to match naming
> used for TX descriptor and by the vendor driver.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800usb.c | 10 ++++----
> drivers/net/wireless/rt2x00/rt2800usb.h | 40 ++++++++++++++++----------------
> 2 files changed, 25 insertions(+), 25 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -594,16 +594,16 @@ static void rt2800usb_fill_rxdone(struct
> rt2x00_desc_read(rxwi, 2, &rxwi2);
> rt2x00_desc_read(rxwi, 3, &rxwi3);
>
> - if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR))
> + if (rt2x00_get_field32(rxd0, RXINFO_W0_CRC_ERROR))
> rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
>
> if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) {
> rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
> rxdesc->cipher_status =
> - rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR);
> + rt2x00_get_field32(rxd0, RXINFO_W0_CIPHER_ERROR);
> }
>
> - if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) {
> + if (rt2x00_get_field32(rxd0, RXINFO_W0_DECRYPTED)) {
> /*
> * Hardware has stripped IV/EIV data from 802.11 frame during
> * decryption. Unfortunately the descriptor doesn't contain
> @@ -618,10 +618,10 @@ static void rt2800usb_fill_rxdone(struct
> rxdesc->flags |= RX_FLAG_MMIC_ERROR;
> }
>
> - if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS))
> + if (rt2x00_get_field32(rxd0, RXINFO_W0_MY_BSS))
> rxdesc->dev_flags |= RXDONE_MY_BSS;
>
> - if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) {
> + if (rt2x00_get_field32(rxd0, RXINFO_W0_L2PAD)) {
> rxdesc->dev_flags |= RXDONE_L2PAD;
> skbdesc->flags |= SKBDESC_L2_PADDED;
> }
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.h
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.h
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.h
> @@ -111,25 +111,25 @@
> * AMSDU: rx with 802.3 header, not 802.11 header.
> */
>
> -#define RXD_W0_BA FIELD32(0x00000001)
> -#define RXD_W0_DATA FIELD32(0x00000002)
> -#define RXD_W0_NULLDATA FIELD32(0x00000004)
> -#define RXD_W0_FRAG FIELD32(0x00000008)
> -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000010)
> -#define RXD_W0_MULTICAST FIELD32(0x00000020)
> -#define RXD_W0_BROADCAST FIELD32(0x00000040)
> -#define RXD_W0_MY_BSS FIELD32(0x00000080)
> -#define RXD_W0_CRC_ERROR FIELD32(0x00000100)
> -#define RXD_W0_CIPHER_ERROR FIELD32(0x00000600)
> -#define RXD_W0_AMSDU FIELD32(0x00000800)
> -#define RXD_W0_HTC FIELD32(0x00001000)
> -#define RXD_W0_RSSI FIELD32(0x00002000)
> -#define RXD_W0_L2PAD FIELD32(0x00004000)
> -#define RXD_W0_AMPDU FIELD32(0x00008000)
> -#define RXD_W0_DECRYPTED FIELD32(0x00010000)
> -#define RXD_W0_PLCP_RSSI FIELD32(0x00020000)
> -#define RXD_W0_CIPHER_ALG FIELD32(0x00040000)
> -#define RXD_W0_LAST_AMSDU FIELD32(0x00080000)
> -#define RXD_W0_PLCP_SIGNAL FIELD32(0xfff00000)
> +#define RXINFO_W0_BA FIELD32(0x00000001)
> +#define RXINFO_W0_DATA FIELD32(0x00000002)
> +#define RXINFO_W0_NULLDATA FIELD32(0x00000004)
> +#define RXINFO_W0_FRAG FIELD32(0x00000008)
> +#define RXINFO_W0_UNICAST_TO_ME FIELD32(0x00000010)
> +#define RXINFO_W0_MULTICAST FIELD32(0x00000020)
> +#define RXINFO_W0_BROADCAST FIELD32(0x00000040)
> +#define RXINFO_W0_MY_BSS FIELD32(0x00000080)
> +#define RXINFO_W0_CRC_ERROR FIELD32(0x00000100)
> +#define RXINFO_W0_CIPHER_ERROR FIELD32(0x00000600)
> +#define RXINFO_W0_AMSDU FIELD32(0x00000800)
> +#define RXINFO_W0_HTC FIELD32(0x00001000)
> +#define RXINFO_W0_RSSI FIELD32(0x00002000)
> +#define RXINFO_W0_L2PAD FIELD32(0x00004000)
> +#define RXINFO_W0_AMPDU FIELD32(0x00008000)
> +#define RXINFO_W0_DECRYPTED FIELD32(0x00010000)
> +#define RXINFO_W0_PLCP_RSSI FIELD32(0x00020000)
> +#define RXINFO_W0_CIPHER_ALG FIELD32(0x00040000)
> +#define RXINFO_W0_LAST_AMSDU FIELD32(0x00080000)
> +#define RXINFO_W0_PLCP_SIGNAL FIELD32(0xfff00000)
>
> #endif /* RT2800USB_H */
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 13:39 ` [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:55 ` Ivo van Doorn
2009-11-08 17:34 ` Bartlomiej Zolnierkiewicz
2009-11-08 14:38 ` Gertjan van Wingerde
1 sibling, 1 reply; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:55 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
>
> eFuse EEPROM is used also by USB chips (i.e. RT3070)
> so move the needed code from rt2800pci to rt2800lib.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> 5 files changed, 77 insertions(+), 64 deletions(-)
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
>
> static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> {
> - u32 reg;
> -
> - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> -
> - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> + return rt2800_efuse_detect(rt2x00dev);
> }
It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
rather then adding a special wrapper function for it.
> -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> {
> - unsigned int i;
> -
> - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> - rt2800pci_efuse_read(rt2x00dev, i);
> + rt2800_read_eeprom_efuse(rt2x00dev);
> }
Same here.
Ivo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 9/9] rt2800usb: add eFuse EEPROM support
2009-11-08 13:39 ` [PATCH 9/9] rt2800usb: add eFuse EEPROM support Bartlomiej Zolnierkiewicz
@ 2009-11-08 13:56 ` Ivo van Doorn
2009-11-08 14:41 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 13:56 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800usb: add eFuse EEPROM support
>
> It is needed for at least RT3070 chip.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800usb.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -667,7 +667,11 @@ static void rt2800usb_fill_rxdone(struct
> */
> static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> - rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
> + if (rt2800_efuse_detect(rt2x00dev))
> + rt2800_read_eeprom_efuse(rt2x00dev);
> + else
> + rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
> + EEPROM_SIZE);
>
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] rt2800: prepare for unification of EEPROM support code
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
` (8 preceding siblings ...)
2009-11-08 13:50 ` [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Ivo van Doorn
@ 2009-11-08 14:16 ` Gertjan van Wingerde
2009-11-08 17:41 ` Bartlomiej Zolnierkiewicz
9 siblings, 1 reply; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:16 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:38, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: prepare for unification of EEPROM support code
>
> * Factor out common code from rt2800[pci,usb]_validate_eeprom()
> to rt2800_validate_eeprom().
>
> * Fix interface specific comment in rt2800[pci,usb]_validate_eeprom().
>
> * Enclose interface specific code in rt2800[pci,usb]_init_eeprom()
> with rt2x00_intf_is_[pci,usb]() checks.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> on top of "rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci."
> patch from Gertjan
>
> drivers/net/wireless/rt2x00/rt2800pci.c | 51 ++++++++++++++++++--------------
> drivers/net/wireless/rt2x00/rt2800usb.c | 40 +++++++++++++++----------
> 2 files changed, 55 insertions(+), 36 deletions(-)
>
<snip>
> @@ -1234,8 +1241,10 @@ static int rt2800pci_init_eeprom(struct
> !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
> !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> - !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
> + (rt2x00_intf_is_usb(rt2x00dev) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> + !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
> ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
> return -ENODEV;
> }
Can we leave this as-is. There are rt2800usb devices that support these RF chipsets as well (I am now the proud owner of such a device), so there is no
need to restrict the use of these RF chipsets to just PCI devices.
So, if we leave this as-is then the EEPROM unification ensures rt2800usb will "support" these RF chipsets as well.
---
Gertjan.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/9] rt2800: unify EEPROM support code
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
2009-11-08 13:51 ` Ivo van Doorn
@ 2009-11-08 14:19 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:19 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: unify EEPROM support code
>
> Add rt2800_validate_eeprom() and rt2800_init_eeprom() to rt2800lib.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
If comments to [PATCH 1/9] have been taken into account.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table
2009-11-08 13:39 ` [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table Bartlomiej Zolnierkiewicz
2009-11-08 13:51 ` Ivo van Doorn
@ 2009-11-08 14:20 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:20 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800pci: add missing RF values to rf_vals table
>
> rt2800pci's rf_vals[] copy was missing values for some channels.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
2009-11-08 13:39 ` [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode() Bartlomiej Zolnierkiewicz
2009-11-08 13:52 ` Ivo van Doorn
@ 2009-11-08 14:20 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:20 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
>
> Move hw_mode information initialization code block before
> HT information initialization one to match the ordering used
> by rt2800pci's rt2800pci_probe_hw_mode().
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification
2009-11-08 13:39 ` [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification Bartlomiej Zolnierkiewicz
2009-11-08 13:53 ` Ivo van Doorn
@ 2009-11-08 14:35 ` Gertjan van Wingerde
2009-11-08 17:48 ` Bartlomiej Zolnierkiewicz
1 sibling, 1 reply; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:35 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: prepare for rt2800*_probe_hw_mode() unification
>
> Enclose interface specific code in rt2800[pci,usb]_probe_hw_mode()
> with rt2x00_intf_is_[pci,usb]() checks.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800pci.c | 24 ++++++++++++++----------
> drivers/net/wireless/rt2x00/rt2800usb.c | 19 ++++++++++++-------
> 2 files changed, 26 insertions(+), 17 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1175,6 +1175,7 @@ static const struct rf_channel rf_vals[]
>
> static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> {
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> struct hw_mode_spec *spec = &rt2x00dev->spec;
> struct channel_info *info;
> char *tx_power1;
> @@ -1190,7 +1191,9 @@ static int rt2800pci_probe_hw_mode(struc
> IEEE80211_HW_SIGNAL_DBM |
> IEEE80211_HW_SUPPORTS_PS |
> IEEE80211_HW_PS_NULLFUNC_STACK;
> - rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
> +
> + if (rt2x00_intf_is_pci(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
>
> SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> @@ -1205,17 +1208,18 @@ static int rt2800pci_probe_hw_mode(struc
> spec->supported_bands = SUPPORT_BAND_2GHZ;
> spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
>
> - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2720) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3021) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3022) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF3052)) {
> + if (rt2x00_rf(chip, RF2820) ||
> + rt2x00_rf(chip, RF2720) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF3021) ||
> + rt2x00_rf(chip, RF3022) ||
> + rt2x00_rf(chip, RF2020) ||
> + rt2x00_rf(chip, RF3052)))) {
> spec->num_channels = 14;
> spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> + } else if (rt2x00_rf(chip, RF2850) ||
> + rt2x00_rf(chip, RF2750)) {
> spec->supported_bands |= SUPPORT_BAND_5GHZ;
> spec->num_channels = ARRAY_SIZE(rf_vals);
> spec->channels = rf_vals;
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -770,6 +770,7 @@ static const struct rf_channel rf_vals_3
>
> static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> {
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> struct hw_mode_spec *spec = &rt2x00dev->spec;
> struct channel_info *info;
> char *tx_power1;
> @@ -785,7 +786,10 @@ static int rt2800usb_probe_hw_mode(struc
> IEEE80211_HW_SIGNAL_DBM |
> IEEE80211_HW_SUPPORTS_PS |
> IEEE80211_HW_PS_NULLFUNC_STACK;
> - rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
> +
> + if (rt2x00_intf_is_usb(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom =
> + TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
>
> SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> @@ -800,17 +804,18 @@ static int rt2800usb_probe_hw_mode(struc
> spec->supported_bands = SUPPORT_BAND_2GHZ;
> spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
>
> - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2720)) {
> + if (rt2x00_rf(chip, RF2820) ||
> + rt2x00_rf(chip, RF2720)) {
> spec->num_channels = 14;
> spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> + } else if (rt2x00_rf(chip, RF2850) ||
> + rt2x00_rf(chip, RF2750)) {
> spec->supported_bands |= SUPPORT_BAND_5GHZ;
> spec->num_channels = ARRAY_SIZE(rf_vals);
> spec->channels = rf_vals;
> - } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> - rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> + } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF2020))) {
> spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> spec->channels = rf_vals_3070;
> }
>
Hmm, another one where we can benefit from decoupling RF chipset code from the actual interface (USB or PCI) used. I do not see the need to check for
USB or PCI support, we just need to unify on the RF chipset level.
BTW this rf_vals_3070 initialization looks weird. It doesn't resemble any other rf_channel initializations we have. I'd say we can go with the rt2800pci variant of the initialization here.
---
Gertjan.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode()
2009-11-08 13:39 ` [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode() Bartlomiej Zolnierkiewicz
2009-11-08 13:53 ` Ivo van Doorn
@ 2009-11-08 14:36 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:36 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: unify rt2800*_probe_hw_mode()
>
> Add rf_vals tables and rt2800_probe_hw_mode() to rt2800lib.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 218 ++++++++++++++++++++++++++++++++
> drivers/net/wireless/rt2x00/rt2800lib.h | 1
> drivers/net/wireless/rt2x00/rt2800pci.c | 190 ---------------------------
> drivers/net/wireless/rt2x00/rt2800usb.c | 211 ------------------------------
> 4 files changed, 221 insertions(+), 399 deletions(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800lib.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -1859,6 +1859,224 @@ int rt2800_init_eeprom(struct rt2x00_dev
> EXPORT_SYMBOL_GPL(rt2800_init_eeprom);
>
> /*
> + * RF value list for rt28x0
> + * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> + */
> +static const struct rf_channel rf_vals[] = {
> + { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
> + { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
> + { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
> + { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
> + { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
> + { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
> + { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
> + { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
> + { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
> + { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
> + { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
> + { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
> + { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
> + { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
> +
> + /* 802.11 UNI / HyperLan 2 */
> + { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
> + { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
> + { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
> + { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
> + { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
> + { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
> + { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
> + { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
> + { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
> + { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
> + { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
> + { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
> +
> + /* 802.11 HyperLan 2 */
> + { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
> + { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
> + { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
> + { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
> + { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
> + { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
> + { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
> + { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
> + { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
> + { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
> + { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
> + { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
> + { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
> + { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
> + { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
> + { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
> +
> + /* 802.11 UNII */
> + { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
> + { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
> + { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
> + { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
> + { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> + { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> + { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> + { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> + { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> + { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> + { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
> +
> + /* 802.11 Japan */
> + { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
> + { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
> + { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
> + { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
> + { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
> + { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
> + { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
> +};
> +
> +/*
> + * RF value list for rt3070
> + * Supports: 2.4 GHz
> + */
> +static const struct rf_channel rf_vals_3070[] = {
> + {1, 241, 2, 2 },
> + {2, 241, 2, 7 },
> + {3, 242, 2, 2 },
> + {4, 242, 2, 7 },
> + {5, 243, 2, 2 },
> + {6, 243, 2, 7 },
> + {7, 244, 2, 2 },
> + {8, 244, 2, 7 },
> + {9, 245, 2, 2 },
> + {10, 245, 2, 7 },
> + {11, 246, 2, 2 },
> + {12, 246, 2, 7 },
> + {13, 247, 2, 2 },
> + {14, 248, 2, 4 },
> +};
> +
> +int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> +{
> + struct rt2x00_chip *chip = &rt2x00dev->chip;
> + struct hw_mode_spec *spec = &rt2x00dev->spec;
> + struct channel_info *info;
> + char *tx_power1;
> + char *tx_power2;
> + unsigned int i;
> + u16 eeprom;
> +
> + /*
> + * Initialize all hw fields.
> + */
> + rt2x00dev->hw->flags =
> + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
> + IEEE80211_HW_SIGNAL_DBM |
> + IEEE80211_HW_SUPPORTS_PS |
> + IEEE80211_HW_PS_NULLFUNC_STACK;
> +
> + if (rt2x00_intf_is_usb(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom =
> + TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
> + else if (rt2x00_intf_is_pci(rt2x00dev))
> + rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
> +
> + SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> + SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> + rt2x00_eeprom_addr(rt2x00dev,
> + EEPROM_MAC_ADDR_0));
> +
> + rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> +
> + /*
> + * Initialize hw_mode information.
> + */
> + spec->supported_bands = SUPPORT_BAND_2GHZ;
> + spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> +
> + if (rt2x00_rf(chip, RF2820) ||
> + rt2x00_rf(chip, RF2720) ||
> + (rt2x00_intf_is_pci(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF3021) ||
> + rt2x00_rf(chip, RF3022) ||
> + rt2x00_rf(chip, RF2020) ||
> + rt2x00_rf(chip, RF3052)))) {
> + spec->num_channels = 14;
> + spec->channels = rf_vals;
> + } else if (rt2x00_rf(chip, RF2850) ||
> + rt2x00_rf(chip, RF2750)) {
> + spec->supported_bands |= SUPPORT_BAND_5GHZ;
> + spec->num_channels = ARRAY_SIZE(rf_vals);
> + spec->channels = rf_vals;
> + } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> + (rt2x00_rf(chip, RF3020) ||
> + rt2x00_rf(chip, RF2020))) {
> + spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> + spec->channels = rf_vals_3070;
> + }
> +
> + /*
> + * Initialize HT information.
> + */
> + spec->ht.ht_supported = true;
> + spec->ht.cap =
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
> + IEEE80211_HT_CAP_GRN_FLD |
> + IEEE80211_HT_CAP_SGI_20 |
> + IEEE80211_HT_CAP_SGI_40 |
> + IEEE80211_HT_CAP_TX_STBC |
> + IEEE80211_HT_CAP_RX_STBC |
> + IEEE80211_HT_CAP_PSMP_SUPPORT;
> + spec->ht.ampdu_factor = 3;
> + spec->ht.ampdu_density = 4;
> + spec->ht.mcs.tx_params =
> + IEEE80211_HT_MCS_TX_DEFINED |
> + IEEE80211_HT_MCS_TX_RX_DIFF |
> + ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
> + IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
> +
> + switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
> + case 3:
> + spec->ht.mcs.rx_mask[2] = 0xff;
> + case 2:
> + spec->ht.mcs.rx_mask[1] = 0xff;
> + case 1:
> + spec->ht.mcs.rx_mask[0] = 0xff;
> + spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
> + break;
> + }
> +
> + /*
> + * Create channel information array
> + */
> + info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
> + if (!info)
> + return -ENOMEM;
> +
> + spec->channels_info = info;
> +
> + tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> + tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> +
> + for (i = 0; i < 14; i++) {
> + info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
> + info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
> + }
> +
> + if (spec->num_channels > 14) {
> + tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
> + tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
> +
> + for (i = 14; i < spec->num_channels; i++) {
> + info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
> + info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
> + }
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(rt2800_probe_hw_mode);
> +
> +/*
> * IEEE80211 stack callback functions.
> */
> static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
> Index: b/drivers/net/wireless/rt2x00/rt2800lib.h
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800lib.h
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
> @@ -131,6 +131,7 @@ int rt2800_init_rfcsr(struct rt2x00_dev
>
> 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);
>
> extern const struct ieee80211_ops rt2800_mac80211_ops;
>
> Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -1098,194 +1098,6 @@ static int rt2800pci_validate_eeprom(str
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
> -/*
> - * RF value list for rt2860
> - * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> - */
> -static const struct rf_channel rf_vals[] = {
> - { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
> - { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
> - { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
> - { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
> - { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
> - { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
> - { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
> - { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
> - { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
> - { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
> - { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
> - { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
> - { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
> - { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
> -
> - /* 802.11 UNI / HyperLan 2 */
> - { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
> - { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
> - { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
> - { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
> - { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
> - { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
> - { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
> - { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
> - { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
> - { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
> - { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
> - { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
> -
> - /* 802.11 HyperLan 2 */
> - { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
> - { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
> - { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
> - { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
> - { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
> - { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
> - { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
> - { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
> - { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
> - { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
> - { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
> - { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
> - { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
> - { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
> - { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
> - { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
> -
> - /* 802.11 UNII */
> - { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
> - { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
> - { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
> - { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
> - { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> - { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> - { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> - { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> - { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> - { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> - { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
> -
> - /* 802.11 Japan */
> - { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
> - { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
> - { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
> - { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
> - { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
> - { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
> - { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
> -};
> -
> -static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> -{
> - struct rt2x00_chip *chip = &rt2x00dev->chip;
> - struct hw_mode_spec *spec = &rt2x00dev->spec;
> - struct channel_info *info;
> - char *tx_power1;
> - char *tx_power2;
> - unsigned int i;
> - u16 eeprom;
> -
> - /*
> - * Initialize all hw fields.
> - */
> - rt2x00dev->hw->flags =
> - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
> - IEEE80211_HW_SIGNAL_DBM |
> - IEEE80211_HW_SUPPORTS_PS |
> - IEEE80211_HW_PS_NULLFUNC_STACK;
> -
> - if (rt2x00_intf_is_pci(rt2x00dev))
> - rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
> -
> - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> - rt2x00_eeprom_addr(rt2x00dev,
> - EEPROM_MAC_ADDR_0));
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> -
> - /*
> - * Initialize hw_mode information.
> - */
> - spec->supported_bands = SUPPORT_BAND_2GHZ;
> - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> -
> - if (rt2x00_rf(chip, RF2820) ||
> - rt2x00_rf(chip, RF2720) ||
> - (rt2x00_intf_is_pci(rt2x00dev) &&
> - (rt2x00_rf(chip, RF3020) ||
> - rt2x00_rf(chip, RF3021) ||
> - rt2x00_rf(chip, RF3022) ||
> - rt2x00_rf(chip, RF2020) ||
> - rt2x00_rf(chip, RF3052)))) {
> - spec->num_channels = 14;
> - spec->channels = rf_vals;
> - } else if (rt2x00_rf(chip, RF2850) ||
> - rt2x00_rf(chip, RF2750)) {
> - spec->supported_bands |= SUPPORT_BAND_5GHZ;
> - spec->num_channels = ARRAY_SIZE(rf_vals);
> - spec->channels = rf_vals;
> - }
> -
> - /*
> - * Initialize HT information.
> - */
> - spec->ht.ht_supported = true;
> - spec->ht.cap =
> - IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
> - IEEE80211_HT_CAP_GRN_FLD |
> - IEEE80211_HT_CAP_SGI_20 |
> - IEEE80211_HT_CAP_SGI_40 |
> - IEEE80211_HT_CAP_TX_STBC |
> - IEEE80211_HT_CAP_RX_STBC |
> - IEEE80211_HT_CAP_PSMP_SUPPORT;
> - spec->ht.ampdu_factor = 3;
> - spec->ht.ampdu_density = 4;
> - spec->ht.mcs.tx_params =
> - IEEE80211_HT_MCS_TX_DEFINED |
> - IEEE80211_HT_MCS_TX_RX_DIFF |
> - ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
> - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
> -
> - switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
> - case 3:
> - spec->ht.mcs.rx_mask[2] = 0xff;
> - case 2:
> - spec->ht.mcs.rx_mask[1] = 0xff;
> - case 1:
> - spec->ht.mcs.rx_mask[0] = 0xff;
> - spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
> - break;
> - }
> -
> - /*
> - * Create channel information array
> - */
> - info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
> - if (!info)
> - return -ENOMEM;
> -
> - spec->channels_info = info;
> -
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> -
> - for (i = 0; i < 14; i++) {
> - info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
> - }
> -
> - if (spec->num_channels > 14) {
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
> -
> - for (i = 14; i < spec->num_channels; i++) {
> - info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
> - }
> - }
> -
> - return 0;
> -}
> -
> static const struct rt2800_ops rt2800pci_rt2800_ops = {
> .register_read = rt2x00pci_register_read,
> .register_write = rt2x00pci_register_write,
> @@ -1319,7 +1131,7 @@ static int rt2800pci_probe_hw(struct rt2
> /*
> * Initialize hw specifications.
> */
> - retval = rt2800pci_probe_hw_mode(rt2x00dev);
> + retval = rt2800_probe_hw_mode(rt2x00dev);
> if (retval)
> return retval;
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -672,215 +672,6 @@ static int rt2800usb_validate_eeprom(str
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
> -/*
> - * RF value list for rt2870
> - * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
> - */
> -static const struct rf_channel rf_vals[] = {
> - { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
> - { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
> - { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
> - { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
> - { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
> - { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
> - { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
> - { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
> - { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
> - { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
> - { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
> - { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
> - { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
> - { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
> -
> - /* 802.11 UNI / HyperLan 2 */
> - { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
> - { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
> - { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
> - { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
> - { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
> - { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
> - { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
> - { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
> - { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
> - { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
> - { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
> - { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
> -
> - /* 802.11 HyperLan 2 */
> - { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
> - { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
> - { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
> - { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
> - { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
> - { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
> - { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
> - { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
> - { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
> - { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
> - { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
> - { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
> - { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
> - { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
> - { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
> - { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
> -
> - /* 802.11 UNII */
> - { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
> - { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
> - { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
> - { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
> - { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
> - { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
> - { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
> - { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
> - { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
> - { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
> - { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
> -
> - /* 802.11 Japan */
> - { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
> - { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
> - { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
> - { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
> - { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
> - { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
> - { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
> -};
> -
> -/*
> - * RF value list for rt3070
> - * Supports: 2.4 GHz
> - */
> -static const struct rf_channel rf_vals_3070[] = {
> - {1, 241, 2, 2 },
> - {2, 241, 2, 7 },
> - {3, 242, 2, 2 },
> - {4, 242, 2, 7 },
> - {5, 243, 2, 2 },
> - {6, 243, 2, 7 },
> - {7, 244, 2, 2 },
> - {8, 244, 2, 7 },
> - {9, 245, 2, 2 },
> - {10, 245, 2, 7 },
> - {11, 246, 2, 2 },
> - {12, 246, 2, 7 },
> - {13, 247, 2, 2 },
> - {14, 248, 2, 4 },
> -};
> -
> -static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> -{
> - struct rt2x00_chip *chip = &rt2x00dev->chip;
> - struct hw_mode_spec *spec = &rt2x00dev->spec;
> - struct channel_info *info;
> - char *tx_power1;
> - char *tx_power2;
> - unsigned int i;
> - u16 eeprom;
> -
> - /*
> - * Initialize all hw fields.
> - */
> - rt2x00dev->hw->flags =
> - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
> - IEEE80211_HW_SIGNAL_DBM |
> - IEEE80211_HW_SUPPORTS_PS |
> - IEEE80211_HW_PS_NULLFUNC_STACK;
> -
> - if (rt2x00_intf_is_usb(rt2x00dev))
> - rt2x00dev->hw->extra_tx_headroom =
> - TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
> -
> - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
> - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
> - rt2x00_eeprom_addr(rt2x00dev,
> - EEPROM_MAC_ADDR_0));
> -
> - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
> -
> - /*
> - * Initialize hw_mode information.
> - */
> - spec->supported_bands = SUPPORT_BAND_2GHZ;
> - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> -
> - if (rt2x00_rf(chip, RF2820) ||
> - rt2x00_rf(chip, RF2720)) {
> - spec->num_channels = 14;
> - spec->channels = rf_vals;
> - } else if (rt2x00_rf(chip, RF2850) ||
> - rt2x00_rf(chip, RF2750)) {
> - spec->supported_bands |= SUPPORT_BAND_5GHZ;
> - spec->num_channels = ARRAY_SIZE(rf_vals);
> - spec->channels = rf_vals;
> - } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> - (rt2x00_rf(chip, RF3020) ||
> - rt2x00_rf(chip, RF2020))) {
> - spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> - spec->channels = rf_vals_3070;
> - }
> -
> - /*
> - * Initialize HT information.
> - */
> - spec->ht.ht_supported = true;
> - spec->ht.cap =
> - IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
> - IEEE80211_HT_CAP_GRN_FLD |
> - IEEE80211_HT_CAP_SGI_20 |
> - IEEE80211_HT_CAP_SGI_40 |
> - IEEE80211_HT_CAP_TX_STBC |
> - IEEE80211_HT_CAP_RX_STBC |
> - IEEE80211_HT_CAP_PSMP_SUPPORT;
> - spec->ht.ampdu_factor = 3;
> - spec->ht.ampdu_density = 4;
> - spec->ht.mcs.tx_params =
> - IEEE80211_HT_MCS_TX_DEFINED |
> - IEEE80211_HT_MCS_TX_RX_DIFF |
> - ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
> - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
> -
> - switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
> - case 3:
> - spec->ht.mcs.rx_mask[2] = 0xff;
> - case 2:
> - spec->ht.mcs.rx_mask[1] = 0xff;
> - case 1:
> - spec->ht.mcs.rx_mask[0] = 0xff;
> - spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
> - break;
> - }
> -
> - /*
> - * Create channel information array
> - */
> - info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
> - if (!info)
> - return -ENOMEM;
> -
> - spec->channels_info = info;
> -
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> -
> - for (i = 0; i < 14; i++) {
> - info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
> - }
> -
> - if (spec->num_channels > 14) {
> - tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
> - tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
> -
> - for (i = 14; i < spec->num_channels; i++) {
> - info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
> - info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
> - }
> - }
> -
> - return 0;
> -}
> -
> static const struct rt2800_ops rt2800usb_rt2800_ops = {
> .register_read = rt2x00usb_register_read,
> .register_write = rt2x00usb_register_write,
> @@ -914,7 +705,7 @@ static int rt2800usb_probe_hw(struct rt2
> /*
> * Initialize hw specifications.
> */
> - retval = rt2800usb_probe_hw_mode(rt2x00dev);
> + retval = rt2800_probe_hw_mode(rt2x00dev);
> if (retval)
> return retval;
>
>
See comments to [PATCH 5/9]. Once that is fixed then this one is OK too.
---
Gertjan.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 7/9] rt2800usb: fix RX descriptor naming
2009-11-08 13:39 ` [PATCH 7/9] rt2800usb: fix RX descriptor naming Bartlomiej Zolnierkiewicz
2009-11-08 13:54 ` Ivo van Doorn
@ 2009-11-08 14:37 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:37 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800usb: fix RX descriptor naming
>
> Rename RXD_W0_* defines to RXINFO_W0_* ones to match naming
> used for TX descriptor and by the vendor driver.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 13:39 ` [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib Bartlomiej Zolnierkiewicz
2009-11-08 13:55 ` Ivo van Doorn
@ 2009-11-08 14:38 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:38 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
>
> eFuse EEPROM is used also by USB chips (i.e. RT3070)
> so move the needed code from rt2800pci to rt2800lib.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 9/9] rt2800usb: add eFuse EEPROM support
2009-11-08 13:39 ` [PATCH 9/9] rt2800usb: add eFuse EEPROM support Bartlomiej Zolnierkiewicz
2009-11-08 13:56 ` Ivo van Doorn
@ 2009-11-08 14:41 ` Gertjan van Wingerde
1 sibling, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 14:41 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] rt2800usb: add eFuse EEPROM support
>
> It is needed for at least RT3070 chip.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800usb.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> Index: b/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -667,7 +667,11 @@ static void rt2800usb_fill_rxdone(struct
> */
> static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> {
> - rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
> + if (rt2800_efuse_detect(rt2x00dev))
> + rt2800_read_eeprom_efuse(rt2x00dev);
> + else
> + rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
> + EEPROM_SIZE);
>
> return rt2800_validate_eeprom(rt2x00dev);
> }
>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
I guess this gives further unification possibilities now. The only difference is the SOC support in the rt2800pci variant of this.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 13:55 ` Ivo van Doorn
@ 2009-11-08 17:34 ` Bartlomiej Zolnierkiewicz
2009-11-08 18:08 ` Ivo van Doorn
0 siblings, 1 reply; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 17:34 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> >
> > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > so move the needed code from rt2800pci to rt2800lib.
> >
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > 5 files changed, 77 insertions(+), 64 deletions(-)
>
>
> > ===================================================================
> > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> >
> > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > {
> > - u32 reg;
> > -
> > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > -
> > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > + return rt2800_efuse_detect(rt2x00dev);
> > }
>
> It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> rather then adding a special wrapper function for it.
>
> > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > {
> > - unsigned int i;
> > -
> > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > - rt2800pci_efuse_read(rt2x00dev, i);
> > + rt2800_read_eeprom_efuse(rt2x00dev);
> > }
>
> Same here.
Could you please explain some more what do you mean by that?
(Please note that we have an extra SOC handling in rt2800pci.c.)
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] rt2800: prepare for unification of EEPROM support code
2009-11-08 14:16 ` Gertjan van Wingerde
@ 2009-11-08 17:41 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:07 ` Gertjan van Wingerde
0 siblings, 1 reply; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 17:41 UTC (permalink / raw)
To: Gertjan van Wingerde; +Cc: linux-wireless, Ivo van Doorn
On Sunday 08 November 2009 15:16:00 Gertjan van Wingerde wrote:
> On 11/08/09 14:38, Bartlomiej Zolnierkiewicz wrote:
> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > Subject: [PATCH] rt2800: prepare for unification of EEPROM support code
> >
> > * Factor out common code from rt2800[pci,usb]_validate_eeprom()
> > to rt2800_validate_eeprom().
> >
> > * Fix interface specific comment in rt2800[pci,usb]_validate_eeprom().
> >
> > * Enclose interface specific code in rt2800[pci,usb]_init_eeprom()
> > with rt2x00_intf_is_[pci,usb]() checks.
> >
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > on top of "rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci."
> > patch from Gertjan
> >
> > drivers/net/wireless/rt2x00/rt2800pci.c | 51 ++++++++++++++++++--------------
> > drivers/net/wireless/rt2x00/rt2800usb.c | 40 +++++++++++++++----------
> > 2 files changed, 55 insertions(+), 36 deletions(-)
> >
>
> <snip>
>
> > @@ -1234,8 +1241,10 @@ static int rt2800pci_init_eeprom(struct
> > !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
> > !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> > !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
> > - !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> > - !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
> > + (rt2x00_intf_is_usb(rt2x00dev) ||
> > + (rt2x00_intf_is_pci(rt2x00dev) &&
> > + !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> > + !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
> > ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
> > return -ENODEV;
> > }
>
> Can we leave this as-is. There are rt2800usb devices that support these RF chipsets as well (I am now the proud owner of such a device), so there is no
> need to restrict the use of these RF chipsets to just PCI devices.
Please note that the patch doesn't change the current behavior of rt2800usb
and for bisectability reasons I would strongly prefer for it to stay this way.
> So, if we leave this as-is then the EEPROM unification ensures rt2800usb will "support" these RF chipsets as well.
Lets work in incremental fashion -- when there is a need to do such change
lets just do it against current tree and apply it as soon as possible (this
way we won't be spending time on micro-decisions).
IOW just make a post- (or pre-) patch and I'll deal with it.
Thanks.
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification
2009-11-08 14:35 ` Gertjan van Wingerde
@ 2009-11-08 17:48 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:09 ` Gertjan van Wingerde
0 siblings, 1 reply; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 17:48 UTC (permalink / raw)
To: Gertjan van Wingerde; +Cc: linux-wireless, Ivo van Doorn
On Sunday 08 November 2009 15:35:19 Gertjan van Wingerde wrote:
> On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > Subject: [PATCH] rt2800: prepare for rt2800*_probe_hw_mode() unification
> >
> > Enclose interface specific code in rt2800[pci,usb]_probe_hw_mode()
> > with rt2x00_intf_is_[pci,usb]() checks.
> >
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
[ please remove needles parts of mails, thanks! ]
> > @@ -800,17 +804,18 @@ static int rt2800usb_probe_hw_mode(struc
> > spec->supported_bands = SUPPORT_BAND_2GHZ;
> > spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
> >
> > - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
> > - rt2x00_rf(&rt2x00dev->chip, RF2720)) {
> > + if (rt2x00_rf(chip, RF2820) ||
> > + rt2x00_rf(chip, RF2720)) {
> > spec->num_channels = 14;
> > spec->channels = rf_vals;
> > - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
> > - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
> > + } else if (rt2x00_rf(chip, RF2850) ||
> > + rt2x00_rf(chip, RF2750)) {
> > spec->supported_bands |= SUPPORT_BAND_5GHZ;
> > spec->num_channels = ARRAY_SIZE(rf_vals);
> > spec->channels = rf_vals;
> > - } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> > - rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> > + } else if (rt2x00_intf_is_usb(rt2x00dev) &&
> > + (rt2x00_rf(chip, RF3020) ||
> > + rt2x00_rf(chip, RF2020))) {
> > spec->num_channels = ARRAY_SIZE(rf_vals_3070);
> > spec->channels = rf_vals_3070;
> > }
> >
>
> Hmm, another one where we can benefit from decoupling RF chipset code from the actual interface (USB or PCI) used. I do not see the need to check for
> USB or PCI support, we just need to unify on the RF chipset level.
>
> BTW this rf_vals_3070 initialization looks weird. It doesn't resemble any other rf_channel initializations we have. I'd say we can go with the rt2800pci variant of the initialization here.
IIRC from the vendor driver rf_vals_3070 is needed so by working
in the incremental way I prefer to leave it as it is before somebody
verifies this with the vendor driver, also it should be a separate
patch for better bisectability anyway.
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 17:34 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 18:08 ` Ivo van Doorn
2009-11-08 18:13 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 18:08 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > >
> > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > so move the needed code from rt2800pci to rt2800lib.
> > >
> > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > ---
> > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > 5 files changed, 77 insertions(+), 64 deletions(-)
> >
> >
> > > ===================================================================
> > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > >
> > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > {
> > > - u32 reg;
> > > -
> > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > -
> > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > + return rt2800_efuse_detect(rt2x00dev);
> > > }
> >
> > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > rather then adding a special wrapper function for it.
> >
> > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > {
> > > - unsigned int i;
> > > -
> > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > }
> >
> > Same here.
>
> Could you please explain some more what do you mean by that?
> (Please note that we have an extra SOC handling in rt2800pci.c.)
Your changes made the following 2 functions:
int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
{
return rt2800_efuse_detect(rt2x00dev);
}
void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
{
rt2800_read_eeprom_efuse(rt2x00dev);
}
So why do we need rt2800pci_* versions in this case? They simply wrap
the rt2800 library function without providing anything extra...
Ivo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:08 ` Ivo van Doorn
@ 2009-11-08 18:13 ` Bartlomiej Zolnierkiewicz
2009-11-08 18:27 ` Ivo van Doorn
0 siblings, 1 reply; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 18:13 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
> On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > > >
> > > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > > so move the needed code from rt2800pci to rt2800lib.
> > > >
> > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > ---
> > > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > > 5 files changed, 77 insertions(+), 64 deletions(-)
> > >
> > >
> > > > ===================================================================
> > > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > > >
> > > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > {
> > > > - u32 reg;
> > > > -
> > > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > > -
> > > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > > + return rt2800_efuse_detect(rt2x00dev);
> > > > }
> > >
> > > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > > rather then adding a special wrapper function for it.
> > >
> > > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > {
> > > > - unsigned int i;
> > > > -
> > > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > > }
> > >
> > > Same here.
> >
> > Could you please explain some more what do you mean by that?
> > (Please note that we have an extra SOC handling in rt2800pci.c.)
>
> Your changes made the following 2 functions:
>
> int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> {
> return rt2800_efuse_detect(rt2x00dev);
> }
>
> void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> {
> rt2800_read_eeprom_efuse(rt2x00dev);
> }
>
> So why do we need rt2800pci_* versions in this case? They simply wrap
> the rt2800 library function without providing anything extra...
Please go read the original code..
#ifdef CONFIG_RT2800PCI_PCI
...
[ the code quoted in your mail ]
...
#else
static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
{
}
static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
{
}
#endif /* CONFIG_RT2800PCI_PCI */
[ #else is for CONFIG_RT2800PCI_WISOC ]
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:13 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 18:27 ` Ivo van Doorn
2009-11-08 18:32 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 18:27 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
> > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > > > >
> > > > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > > > so move the needed code from rt2800pci to rt2800lib.
> > > > >
> > > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > ---
> > > > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > > > 5 files changed, 77 insertions(+), 64 deletions(-)
> > > >
> > > >
> > > > > ===================================================================
> > > > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > > > >
> > > > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > {
> > > > > - u32 reg;
> > > > > -
> > > > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > > > -
> > > > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > > > + return rt2800_efuse_detect(rt2x00dev);
> > > > > }
> > > >
> > > > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > > > rather then adding a special wrapper function for it.
> > > >
> > > > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > {
> > > > > - unsigned int i;
> > > > > -
> > > > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > }
> > > >
> > > > Same here.
> > >
> > > Could you please explain some more what do you mean by that?
> > > (Please note that we have an extra SOC handling in rt2800pci.c.)
> >
> > Your changes made the following 2 functions:
> >
> > int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > {
> > return rt2800_efuse_detect(rt2x00dev);
> > }
> >
> > void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > {
> > rt2800_read_eeprom_efuse(rt2x00dev);
> > }
> >
> > So why do we need rt2800pci_* versions in this case? They simply wrap
> > the rt2800 library function without providing anything extra...
>
> Please go read the original code..
>
> #ifdef CONFIG_RT2800PCI_PCI
> ...
> [ the code quoted in your mail ]
> ...
> #else
> static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
> {
> }
>
> static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> {
> }
> #endif /* CONFIG_RT2800PCI_PCI */
>
> [ #else is for CONFIG_RT2800PCI_WISOC ]
True, but rt2800pci_read_eeprom_efuse() has no WISOC counterpart,
the fact that it is compiled into rt2x00lib without any restriction makes
the ifdef statements in the rt2800pci obsolete.
The purpose of the defines was to keep the EFUSE code out of the driver
on embedded systems. So either rt2800lib should do the same with ifdefs
in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
wrappers in rt2800pci.c.
Ivo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:27 ` Ivo van Doorn
@ 2009-11-08 18:32 ` Bartlomiej Zolnierkiewicz
2009-11-08 18:40 ` Ivo van Doorn
0 siblings, 1 reply; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 18:32 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 19:27:30 Ivo van Doorn wrote:
> On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
> > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > > > > >
> > > > > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > > > > so move the needed code from rt2800pci to rt2800lib.
> > > > > >
> > > > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > ---
> > > > > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > > > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > > > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > > > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > > > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > > > > 5 files changed, 77 insertions(+), 64 deletions(-)
> > > > >
> > > > >
> > > > > > ===================================================================
> > > > > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > > > > >
> > > > > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > > {
> > > > > > - u32 reg;
> > > > > > -
> > > > > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > > > > -
> > > > > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > > > > + return rt2800_efuse_detect(rt2x00dev);
> > > > > > }
> > > > >
> > > > > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > > > > rather then adding a special wrapper function for it.
> > > > >
> > > > > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > {
> > > > > > - unsigned int i;
> > > > > > -
> > > > > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > > > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > > > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > > }
> > > > >
> > > > > Same here.
> > > >
> > > > Could you please explain some more what do you mean by that?
> > > > (Please note that we have an extra SOC handling in rt2800pci.c.)
> > >
> > > Your changes made the following 2 functions:
> > >
> > > int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > {
> > > return rt2800_efuse_detect(rt2x00dev);
> > > }
> > >
> > > void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > {
> > > rt2800_read_eeprom_efuse(rt2x00dev);
> > > }
> > >
> > > So why do we need rt2800pci_* versions in this case? They simply wrap
> > > the rt2800 library function without providing anything extra...
> >
> > Please go read the original code..
> >
> > #ifdef CONFIG_RT2800PCI_PCI
> > ...
> > [ the code quoted in your mail ]
> > ...
> > #else
> > static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
> > {
> > }
> >
> > static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > {
> > }
> > #endif /* CONFIG_RT2800PCI_PCI */
> >
> > [ #else is for CONFIG_RT2800PCI_WISOC ]
>
> True, but rt2800pci_read_eeprom_efuse() has no WISOC counterpart,
> the fact that it is compiled into rt2x00lib without any restriction makes
> the ifdef statements in the rt2800pci obsolete.
Not really. Please note that driver's behavior WRT WISOC is preserved.
> The purpose of the defines was to keep the EFUSE code out of the driver
> on embedded systems. So either rt2800lib should do the same with ifdefs
> in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
> wrappers in rt2800pci.c.
Said wrappers predate all of my rt2800 patches.
I think that they shouldn't have been added in the first place and I'll be
happy to add patch removing them to rt2800 tree (since code savings seem to
be really marginal and not worth the maintenance cost).
Thanks.
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:32 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 18:40 ` Ivo van Doorn
2009-11-08 18:47 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 18:40 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 08 November 2009 19:27:30 Ivo van Doorn wrote:
> > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
> > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > > > > > >
> > > > > > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > > > > > so move the needed code from rt2800pci to rt2800lib.
> > > > > > >
> > > > > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > > ---
> > > > > > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > > > > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > > > > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > > > > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > > > > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > > > > > 5 files changed, 77 insertions(+), 64 deletions(-)
> > > > > >
> > > > > >
> > > > > > > ===================================================================
> > > > > > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > > > > > >
> > > > > > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > > > {
> > > > > > > - u32 reg;
> > > > > > > -
> > > > > > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > > > > > -
> > > > > > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > > > > > + return rt2800_efuse_detect(rt2x00dev);
> > > > > > > }
> > > > > >
> > > > > > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > > > > > rather then adding a special wrapper function for it.
> > > > > >
> > > > > > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > > {
> > > > > > > - unsigned int i;
> > > > > > > -
> > > > > > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > > > > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > > > > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > > > }
> > > > > >
> > > > > > Same here.
> > > > >
> > > > > Could you please explain some more what do you mean by that?
> > > > > (Please note that we have an extra SOC handling in rt2800pci.c.)
> > > >
> > > > Your changes made the following 2 functions:
> > > >
> > > > int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > {
> > > > return rt2800_efuse_detect(rt2x00dev);
> > > > }
> > > >
> > > > void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > {
> > > > rt2800_read_eeprom_efuse(rt2x00dev);
> > > > }
> > > >
> > > > So why do we need rt2800pci_* versions in this case? They simply wrap
> > > > the rt2800 library function without providing anything extra...
> > >
> > > Please go read the original code..
> > >
> > > #ifdef CONFIG_RT2800PCI_PCI
> > > ...
> > > [ the code quoted in your mail ]
> > > ...
> > > #else
> > > static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
> > > {
> > > }
> > >
> > > static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > {
> > > }
> > > #endif /* CONFIG_RT2800PCI_PCI */
> > >
> > > [ #else is for CONFIG_RT2800PCI_WISOC ]
> >
> > True, but rt2800pci_read_eeprom_efuse() has no WISOC counterpart,
> > the fact that it is compiled into rt2x00lib without any restriction makes
> > the ifdef statements in the rt2800pci obsolete.
>
> Not really. Please note that driver's behavior WRT WISOC is preserved.
The behavior, not the amount of code compiled into the binary.
The original code had the efuse code within the ifdef, during the move
to rt2800lib it was moved outside the ifdef.
> > The purpose of the defines was to keep the EFUSE code out of the driver
> > on embedded systems. So either rt2800lib should do the same with ifdefs
> > in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
> > wrappers in rt2800pci.c.
>
> Said wrappers predate all of my rt2800 patches.
Actually the code inside the function was larger, since you removed multiple
lines from the function (moved to rt2800lib). But as said above, the wrapper
had the code inside the ifdef, while the this patch has the code outside the
ifdef, and thus the wrapper has no need.
> I think that they shouldn't have been added in the first place and I'll be
> happy to add patch removing them to rt2800 tree (since code savings seem to
> be really marginal and not worth the maintenance cost).
Removing the ifdefs entirely would be fine.
Ivo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:40 ` Ivo van Doorn
@ 2009-11-08 18:47 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:14 ` Kalle Valo
` (2 more replies)
0 siblings, 3 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 18:47 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 19:40:27 Ivo van Doorn wrote:
> On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > On Sunday 08 November 2009 19:27:30 Ivo van Doorn wrote:
> > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
> > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > > > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > > > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > > > > > > >
> > > > > > > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > > > > > > so move the needed code from rt2800pci to rt2800lib.
> > > > > > > >
> > > > > > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > > > ---
> > > > > > > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > > > > > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > > > > > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > > > > > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > > > > > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > > > > > > 5 files changed, 77 insertions(+), 64 deletions(-)
> > > > > > >
> > > > > > >
> > > > > > > > ===================================================================
> > > > > > > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > > > > > > >
> > > > > > > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > > > > {
> > > > > > > > - u32 reg;
> > > > > > > > -
> > > > > > > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > > > > > > -
> > > > > > > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > > > > > > + return rt2800_efuse_detect(rt2x00dev);
> > > > > > > > }
> > > > > > >
> > > > > > > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > > > > > > rather then adding a special wrapper function for it.
> > > > > > >
> > > > > > > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > > > {
> > > > > > > > - unsigned int i;
> > > > > > > > -
> > > > > > > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > > > > > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > > > > > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > > > > }
> > > > > > >
> > > > > > > Same here.
> > > > > >
> > > > > > Could you please explain some more what do you mean by that?
> > > > > > (Please note that we have an extra SOC handling in rt2800pci.c.)
> > > > >
> > > > > Your changes made the following 2 functions:
> > > > >
> > > > > int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > {
> > > > > return rt2800_efuse_detect(rt2x00dev);
> > > > > }
> > > > >
> > > > > void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > {
> > > > > rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > }
> > > > >
> > > > > So why do we need rt2800pci_* versions in this case? They simply wrap
> > > > > the rt2800 library function without providing anything extra...
> > > >
> > > > Please go read the original code..
> > > >
> > > > #ifdef CONFIG_RT2800PCI_PCI
> > > > ...
> > > > [ the code quoted in your mail ]
> > > > ...
> > > > #else
> > > > static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
> > > > {
> > > > }
> > > >
> > > > static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > {
> > > > }
> > > > #endif /* CONFIG_RT2800PCI_PCI */
> > > >
> > > > [ #else is for CONFIG_RT2800PCI_WISOC ]
> > >
> > > True, but rt2800pci_read_eeprom_efuse() has no WISOC counterpart,
> > > the fact that it is compiled into rt2x00lib without any restriction makes
> > > the ifdef statements in the rt2800pci obsolete.
> >
> > Not really. Please note that driver's behavior WRT WISOC is preserved.
>
> The behavior, not the amount of code compiled into the binary.
> The original code had the efuse code within the ifdef, during the move
> to rt2800lib it was moved outside the ifdef.
>
> > > The purpose of the defines was to keep the EFUSE code out of the driver
> > > on embedded systems. So either rt2800lib should do the same with ifdefs
> > > in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
> > > wrappers in rt2800pci.c.
> >
> > Said wrappers predate all of my rt2800 patches.
>
> Actually the code inside the function was larger, since you removed multiple
> lines from the function (moved to rt2800lib). But as said above, the wrapper
> had the code inside the ifdef, while the this patch has the code outside the
> ifdef, and thus the wrapper has no need.
>
> > I think that they shouldn't have been added in the first place and I'll be
> > happy to add patch removing them to rt2800 tree (since code savings seem to
> > be really marginal and not worth the maintenance cost).
>
> Removing the ifdefs entirely would be fine.
Like I said before -- this would mean driver's behavior change. Even though
WISOC code is currently dead (RALINK_RT288X and RALINK_RT305X are never set)
I prefer to not "overload" patches with logically different changes.
If you feel strongly about it please fix it in rt2x00 code and rt2800 tree
will deal with it, or alternatively please send me an incremental patch.
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] rt2800: prepare for unification of EEPROM support code
2009-11-08 17:41 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 19:07 ` Gertjan van Wingerde
0 siblings, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 19:07 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 18:41, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 08 November 2009 15:16:00 Gertjan van Wingerde wrote:
>> On 11/08/09 14:38, Bartlomiej Zolnierkiewicz wrote:
>>> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>> Subject: [PATCH] rt2800: prepare for unification of EEPROM support code
>>>
>>> * Factor out common code from rt2800[pci,usb]_validate_eeprom()
>>> to rt2800_validate_eeprom().
>>>
>>> * Fix interface specific comment in rt2800[pci,usb]_validate_eeprom().
>>>
>>> * Enclose interface specific code in rt2800[pci,usb]_init_eeprom()
>>> with rt2x00_intf_is_[pci,usb]() checks.
>>>
>>> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>> ---
>>> on top of "rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci."
>>> patch from Gertjan
>>>
>>> drivers/net/wireless/rt2x00/rt2800pci.c | 51 ++++++++++++++++++--------------
>>> drivers/net/wireless/rt2x00/rt2800usb.c | 40 +++++++++++++++----------
>>> 2 files changed, 55 insertions(+), 36 deletions(-)
>>>
>>
>> <snip>
>>
>>> @@ -1234,8 +1241,10 @@ static int rt2800pci_init_eeprom(struct
>>> !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
>>> !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
>>> !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
>>> - !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
>>> - !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
>>> + (rt2x00_intf_is_usb(rt2x00dev) ||
>>> + (rt2x00_intf_is_pci(rt2x00dev) &&
>>> + !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
>>> + !rt2x00_rf(&rt2x00dev->chip, RF3022)))) {
>>> ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
>>> return -ENODEV;
>>> }
>>
>> Can we leave this as-is. There are rt2800usb devices that support these RF chipsets as well (I am now the proud owner of such a device), so there is no
>> need to restrict the use of these RF chipsets to just PCI devices.
>
> Please note that the patch doesn't change the current behavior of rt2800usb
> and for bisectability reasons I would strongly prefer for it to stay this way.
>
>> So, if we leave this as-is then the EEPROM unification ensures rt2800usb will "support" these RF chipsets as well.
>
> Lets work in incremental fashion -- when there is a need to do such change
> lets just do it against current tree and apply it as soon as possible (this
> way we won't be spending time on micro-decisions).
>
> IOW just make a post- (or pre-) patch and I'll deal with it.
>
> Thanks.
Yeah, while spending more time on this this afternoon I found out that actually a lot more is needed, so doing this right now doesn't help at all.
So, on second thought,
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
Gertjan.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification
2009-11-08 17:48 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 19:09 ` Gertjan van Wingerde
0 siblings, 0 replies; 44+ messages in thread
From: Gertjan van Wingerde @ 2009-11-08 19:09 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Ivo van Doorn
On 11/08/09 18:48, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 08 November 2009 15:35:19 Gertjan van Wingerde wrote:
>> On 11/08/09 14:39, Bartlomiej Zolnierkiewicz wrote:
>>> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>> Subject: [PATCH] rt2800: prepare for rt2800*_probe_hw_mode() unification
>>>
>>> Enclose interface specific code in rt2800[pci,usb]_probe_hw_mode()
>>> with rt2x00_intf_is_[pci,usb]() checks.
>>>
>>> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>
> [ please remove needles parts of mails, thanks! ]
>
>>> @@ -800,17 +804,18 @@ static int rt2800usb_probe_hw_mode(struc
>>> spec->supported_bands = SUPPORT_BAND_2GHZ;
>>> spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
>>>
>>> - if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
>>> - rt2x00_rf(&rt2x00dev->chip, RF2720)) {
>>> + if (rt2x00_rf(chip, RF2820) ||
>>> + rt2x00_rf(chip, RF2720)) {
>>> spec->num_channels = 14;
>>> spec->channels = rf_vals;
>>> - } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
>>> - rt2x00_rf(&rt2x00dev->chip, RF2750)) {
>>> + } else if (rt2x00_rf(chip, RF2850) ||
>>> + rt2x00_rf(chip, RF2750)) {
>>> spec->supported_bands |= SUPPORT_BAND_5GHZ;
>>> spec->num_channels = ARRAY_SIZE(rf_vals);
>>> spec->channels = rf_vals;
>>> - } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
>>> - rt2x00_rf(&rt2x00dev->chip, RF2020)) {
>>> + } else if (rt2x00_intf_is_usb(rt2x00dev) &&
>>> + (rt2x00_rf(chip, RF3020) ||
>>> + rt2x00_rf(chip, RF2020))) {
>>> spec->num_channels = ARRAY_SIZE(rf_vals_3070);
>>> spec->channels = rf_vals_3070;
>>> }
>>>
>>
>> Hmm, another one where we can benefit from decoupling RF chipset code from the actual interface (USB or PCI) used. I do not see the need to check for
>> USB or PCI support, we just need to unify on the RF chipset level.
>>
>> BTW this rf_vals_3070 initialization looks weird. It doesn't resemble any other rf_channel initializations we have. I'd say we can go with the rt2800pci variant of the initialization here.
>
> IIRC from the vendor driver rf_vals_3070 is needed so by working
> in the incremental way I prefer to leave it as it is before somebody
> verifies this with the vendor driver, also it should be a separate
> patch for better bisectability anyway.
>
The vendor driver does this in a slightly different way. I was caught off-guard on the complexity of this code.
I'll look at that myself. So, on second thought,
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
Gertjan.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:47 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 19:14 ` Kalle Valo
2009-11-08 19:21 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:25 ` Ivo van Doorn
2 siblings, 0 replies; 44+ messages in thread
From: Kalle Valo @ 2009-11-08 19:14 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz
Cc: Ivo van Doorn, linux-wireless, Gertjan van Wingerde
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> writes:
> On Sunday 08 November 2009 19:40:27 Ivo van Doorn wrote:
>> On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
>> > On Sunday 08 November 2009 19:27:30 Ivo van Doorn wrote:
>> > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
>> > > > On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
>> > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
>> > > > > > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
>> > > > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
A kind request: please edit your quotations to the minimum.
--
Kalle Valo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:47 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:14 ` Kalle Valo
@ 2009-11-08 19:21 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:35 ` Ivo van Doorn
2009-11-08 19:25 ` Ivo van Doorn
2 siblings, 1 reply; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 19:21 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 19:47:53 Bartlomiej Zolnierkiewicz wrote:
> On Sunday 08 November 2009 19:40:27 Ivo van Doorn wrote:
> > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > On Sunday 08 November 2009 19:27:30 Ivo van Doorn wrote:
> > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > On Sunday 08 November 2009 19:08:23 Ivo van Doorn wrote:
> > > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > > > On Sunday 08 November 2009 14:55:59 Ivo van Doorn wrote:
> > > > > > > > On Sunday 08 November 2009, Bartlomiej Zolnierkiewicz wrote:
> > > > > > > > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > > > > Subject: [PATCH] rt2800: add eFuse EEPROM support code to rt2800lib
> > > > > > > > >
> > > > > > > > > eFuse EEPROM is used also by USB chips (i.e. RT3070)
> > > > > > > > > so move the needed code from rt2800pci to rt2800lib.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > > > > > > > ---
> > > > > > > > > drivers/net/wireless/rt2x00/rt2800.h | 29 +++++++++++++++++++++
> > > > > > > > > drivers/net/wireless/rt2x00/rt2800lib.c | 43 ++++++++++++++++++++++++++++++++
> > > > > > > > > drivers/net/wireless/rt2x00/rt2800lib.h | 2 +
> > > > > > > > > drivers/net/wireless/rt2x00/rt2800pci.c | 38 ++--------------------------
> > > > > > > > > drivers/net/wireless/rt2x00/rt2800pci.h | 29 ---------------------
> > > > > > > > > 5 files changed, 77 insertions(+), 64 deletions(-)
> > > > > > > >
> > > > > > > >
> > > > > > > > > ===================================================================
> > > > > > > > > --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > > > > +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> > > > > > > > > @@ -147,44 +147,12 @@ static void rt2800pci_read_eeprom_pci(st
> > > > > > > > >
> > > > > > > > > static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > > > > > {
> > > > > > > > > - u32 reg;
> > > > > > > > > -
> > > > > > > > > - rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®);
> > > > > > > > > -
> > > > > > > > > - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT);
> > > > > > > > > + return rt2800_efuse_detect(rt2x00dev);
> > > > > > > > > }
> > > > > > > >
> > > > > > > > It would be better to fix all calls to rt2800pci_efuse_detect to use rt2800_efuse_detect
> > > > > > > > rather then adding a special wrapper function for it.
> > > > > > > >
> > > > > > > > > -static void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > > > > +static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > > > > {
> > > > > > > > > - unsigned int i;
> > > > > > > > > -
> > > > > > > > > - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8)
> > > > > > > > > - rt2800pci_efuse_read(rt2x00dev, i);
> > > > > > > > > + rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > > > > > }
> > > > > > > >
> > > > > > > > Same here.
> > > > > > >
> > > > > > > Could you please explain some more what do you mean by that?
> > > > > > > (Please note that we have an extra SOC handling in rt2800pci.c.)
> > > > > >
> > > > > > Your changes made the following 2 functions:
> > > > > >
> > > > > > int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
> > > > > > {
> > > > > > return rt2800_efuse_detect(rt2x00dev);
> > > > > > }
> > > > > >
> > > > > > void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > > {
> > > > > > rt2800_read_eeprom_efuse(rt2x00dev);
> > > > > > }
> > > > > >
> > > > > > So why do we need rt2800pci_* versions in this case? They simply wrap
> > > > > > the rt2800 library function without providing anything extra...
> > > > >
> > > > > Please go read the original code..
> > > > >
> > > > > #ifdef CONFIG_RT2800PCI_PCI
> > > > > ...
> > > > > [ the code quoted in your mail ]
> > > > > ...
> > > > > #else
> > > > > static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
> > > > > {
> > > > > }
> > > > >
> > > > > static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
> > > > > {
> > > > > }
> > > > > #endif /* CONFIG_RT2800PCI_PCI */
> > > > >
> > > > > [ #else is for CONFIG_RT2800PCI_WISOC ]
> > > >
> > > > True, but rt2800pci_read_eeprom_efuse() has no WISOC counterpart,
> > > > the fact that it is compiled into rt2x00lib without any restriction makes
> > > > the ifdef statements in the rt2800pci obsolete.
> > >
> > > Not really. Please note that driver's behavior WRT WISOC is preserved.
> >
> > The behavior, not the amount of code compiled into the binary.
> > The original code had the efuse code within the ifdef, during the move
> > to rt2800lib it was moved outside the ifdef.
> >
> > > > The purpose of the defines was to keep the EFUSE code out of the driver
> > > > on embedded systems. So either rt2800lib should do the same with ifdefs
> > > > in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
> > > > wrappers in rt2800pci.c.
> > >
> > > Said wrappers predate all of my rt2800 patches.
> >
> > Actually the code inside the function was larger, since you removed multiple
> > lines from the function (moved to rt2800lib). But as said above, the wrapper
> > had the code inside the ifdef, while the this patch has the code outside the
> > ifdef, and thus the wrapper has no need.
> >
> > > I think that they shouldn't have been added in the first place and I'll be
> > > happy to add patch removing them to rt2800 tree (since code savings seem to
> > > be really marginal and not worth the maintenance cost).
> >
> > Removing the ifdefs entirely would be fine.
>
> Like I said before -- this would mean driver's behavior change. Even though
> WISOC code is currently dead (RALINK_RT288X and RALINK_RT305X are never set)
> I prefer to not "overload" patches with logically different changes.
>
> If you feel strongly about it please fix it in rt2x00 code and rt2800 tree
> will deal with it, or alternatively please send me an incremental patch.
BTW the patch's impact is _320_ bytes increase of rt2800lib (on x86-64 so
it is probably much less on the affected embedded architectures):
text data bss dec hex filename
before:
16916 0 0 16916 4214 drivers/net/wireless/rt2x00/rt2800lib.o
after:
17281 0 0 17281 4381 drivers/net/wireless/rt2x00/rt2800lib.o
for the _completely_ dead code (because embedded WISOC support is never
enabled) that probably will be changed over anyway later during development.
IOW something like this is completely not worth to be worried about
and I would personally just skip it during review to not waste people's
time needlessly..
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 18:47 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:14 ` Kalle Valo
2009-11-08 19:21 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 19:25 ` Ivo van Doorn
2009-11-08 19:34 ` Bartlomiej Zolnierkiewicz
2 siblings, 1 reply; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 19:25 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
> > > > The purpose of the defines was to keep the EFUSE code out of the driver
> > > > on embedded systems. So either rt2800lib should do the same with ifdefs
> > > > in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
> > > > wrappers in rt2800pci.c.
> > >
> > > Said wrappers predate all of my rt2800 patches.
> >
> > Actually the code inside the function was larger, since you removed multiple
> > lines from the function (moved to rt2800lib). But as said above, the wrapper
> > had the code inside the ifdef, while the this patch has the code outside the
> > ifdef, and thus the wrapper has no need.
> >
> > > I think that they shouldn't have been added in the first place and I'll be
> > > happy to add patch removing them to rt2800 tree (since code savings seem to
> > > be really marginal and not worth the maintenance cost).
> >
> > Removing the ifdefs entirely would be fine.
>
> Like I said before -- this would mean driver's behavior change. Even though
> WISOC code is currently dead (RALINK_RT288X and RALINK_RT305X are never set)
> I prefer to not "overload" patches with logically different changes.
The code is not really dead. RALINK_RT288X and RALINK_RT305X are platforms which
are currently present in another tree, it is not the job for rt2x00 to set those defines.
I don't know when these platforms will be merged upstream, nor do I know the status of them.
> If you feel strongly about it please fix it in rt2x00 code and rt2800 tree
> will deal with it, or alternatively please send me an incremental patch.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 6f151d0..b33204d 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -80,20 +80,13 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
}
-#ifdef CONFIG_RT2800PCI_WISOC
static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
{
u32 *base_addr = (u32 *) KSEG1ADDR(0x1F040000); /* XXX for RT3052 */
memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);
}
-#else
-static inline void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
-{
-}
-#endif /* CONFIG_RT2800PCI_WISOC */
-#ifdef CONFIG_RT2800PCI_PCI
static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
{
struct rt2x00_dev *rt2x00dev = eeprom->data;
@@ -145,30 +138,6 @@ static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
EEPROM_SIZE / sizeof(u16));
}
-static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
-{
- return rt2800_efuse_detect(rt2x00dev);
-}
-
-static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
-{
- rt2800_read_eeprom_efuse(rt2x00dev);
-}
-#else
-static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
-{
-}
-
-static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
-{
- return 0;
-}
-
-static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
-{
-}
-#endif /* CONFIG_RT2800PCI_PCI */
-
/*
* Firmware functions
*/
@@ -1070,8 +1039,8 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
rt2800pci_read_eeprom_soc(rt2x00dev);
break;
default:
- if (rt2800pci_efuse_detect(rt2x00dev))
- rt2800pci_read_eeprom_efuse(rt2x00dev);
+ if (rt2800_efuse_detect(rt2x00dev))
+ rt2800_read_eeprom_efuse(rt2x00dev);
else
rt2800pci_read_eeprom_pci(rt2x00dev);
break;
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 19:25 ` Ivo van Doorn
@ 2009-11-08 19:34 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 19:34 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 20:25:48 Ivo van Doorn wrote:
> > > > > The purpose of the defines was to keep the EFUSE code out of the driver
> > > > > on embedded systems. So either rt2800lib should do the same with ifdefs
> > > > > in the rt2800lib.c and rt2800lib.h files, or we don't need the efuse specific
> > > > > wrappers in rt2800pci.c.
> > > >
> > > > Said wrappers predate all of my rt2800 patches.
> > >
> > > Actually the code inside the function was larger, since you removed multiple
> > > lines from the function (moved to rt2800lib). But as said above, the wrapper
> > > had the code inside the ifdef, while the this patch has the code outside the
> > > ifdef, and thus the wrapper has no need.
> > >
> > > > I think that they shouldn't have been added in the first place and I'll be
> > > > happy to add patch removing them to rt2800 tree (since code savings seem to
> > > > be really marginal and not worth the maintenance cost).
> > >
> > > Removing the ifdefs entirely would be fine.
> >
> > Like I said before -- this would mean driver's behavior change. Even though
> > WISOC code is currently dead (RALINK_RT288X and RALINK_RT305X are never set)
> > I prefer to not "overload" patches with logically different changes.
>
> The code is not really dead. RALINK_RT288X and RALINK_RT305X are platforms which
> are currently present in another tree, it is not the job for rt2x00 to set those defines.
> I don't know when these platforms will be merged upstream, nor do I know the status of them.
They are not really our problem then and said tree should maintain
RALINK_RT[288X,305X] specific changes itself. :)
> > If you feel strongly about it please fix it in rt2x00 code and rt2800 tree
> > will deal with it, or alternatively please send me an incremental patch.
>
> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Thanks, I'll merge it later to rt2800.
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 19:21 ` Bartlomiej Zolnierkiewicz
@ 2009-11-08 19:35 ` Ivo van Doorn
2009-11-08 19:38 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 44+ messages in thread
From: Ivo van Doorn @ 2009-11-08 19:35 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-wireless, Gertjan van Wingerde
> > > > I think that they shouldn't have been added in the first place and I'll be
> > > > happy to add patch removing them to rt2800 tree (since code savings seem to
> > > > be really marginal and not worth the maintenance cost).
> > >
> > > Removing the ifdefs entirely would be fine.
> >
> > Like I said before -- this would mean driver's behavior change. Even though
> > WISOC code is currently dead (RALINK_RT288X and RALINK_RT305X are never set)
> > I prefer to not "overload" patches with logically different changes.
> >
> > If you feel strongly about it please fix it in rt2x00 code and rt2800 tree
> > will deal with it, or alternatively please send me an incremental patch.
>
> BTW the patch's impact is _320_ bytes increase of rt2800lib (on x86-64 so
> it is probably much less on the affected embedded architectures):
>
> text data bss dec hex filename
> before:
> 16916 0 0 16916 4214 drivers/net/wireless/rt2x00/rt2800lib.o
> after:
> 17281 0 0 17281 4381 drivers/net/wireless/rt2x00/rt2800lib.o
>
> for the _completely_ dead code (because embedded WISOC support is never
> enabled) that probably will be changed over anyway later during development.
As mentioned: Wisoc is not dead code, it is there for the platform devices with
integrated rt2800 chipsets. If you look at KConfig you can see the
RALINK_RT288X RALINK_RT305X are dependencies from configuration options...
> IOW something like this is completely not worth to be worried about
> and I would personally just skip it during review to not waste people's
> time needlessly..
Well dependencies from/on other drivers is something important...
Ivo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib
2009-11-08 19:35 ` Ivo van Doorn
@ 2009-11-08 19:38 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 44+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-08 19:38 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: linux-wireless, Gertjan van Wingerde
On Sunday 08 November 2009 20:35:17 Ivo van Doorn wrote:
> > > > > I think that they shouldn't have been added in the first place and I'll be
> > > > > happy to add patch removing them to rt2800 tree (since code savings seem to
> > > > > be really marginal and not worth the maintenance cost).
> > > >
> > > > Removing the ifdefs entirely would be fine.
> > >
> > > Like I said before -- this would mean driver's behavior change. Even though
> > > WISOC code is currently dead (RALINK_RT288X and RALINK_RT305X are never set)
> > > I prefer to not "overload" patches with logically different changes.
> > >
> > > If you feel strongly about it please fix it in rt2x00 code and rt2800 tree
> > > will deal with it, or alternatively please send me an incremental patch.
> >
> > BTW the patch's impact is _320_ bytes increase of rt2800lib (on x86-64 so
> > it is probably much less on the affected embedded architectures):
> >
> > text data bss dec hex filename
> > before:
> > 16916 0 0 16916 4214 drivers/net/wireless/rt2x00/rt2800lib.o
> > after:
> > 17281 0 0 17281 4381 drivers/net/wireless/rt2x00/rt2800lib.o
> >
> > for the _completely_ dead code (because embedded WISOC support is never
> > enabled) that probably will be changed over anyway later during development.
>
> As mentioned: Wisoc is not dead code, it is there for the platform devices with
Not in upstream, not in next, not in wireless, not in rt2x00...
=> Not our problem. ;)
--
Bartlomiej Zolnierkiewicz
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2009-11-08 19:39 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
2009-11-08 13:51 ` Ivo van Doorn
2009-11-08 14:19 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table Bartlomiej Zolnierkiewicz
2009-11-08 13:51 ` Ivo van Doorn
2009-11-08 14:20 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode() Bartlomiej Zolnierkiewicz
2009-11-08 13:52 ` Ivo van Doorn
2009-11-08 14:20 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification Bartlomiej Zolnierkiewicz
2009-11-08 13:53 ` Ivo van Doorn
2009-11-08 14:35 ` Gertjan van Wingerde
2009-11-08 17:48 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:09 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode() Bartlomiej Zolnierkiewicz
2009-11-08 13:53 ` Ivo van Doorn
2009-11-08 14:36 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 7/9] rt2800usb: fix RX descriptor naming Bartlomiej Zolnierkiewicz
2009-11-08 13:54 ` Ivo van Doorn
2009-11-08 14:37 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib Bartlomiej Zolnierkiewicz
2009-11-08 13:55 ` Ivo van Doorn
2009-11-08 17:34 ` Bartlomiej Zolnierkiewicz
2009-11-08 18:08 ` Ivo van Doorn
2009-11-08 18:13 ` Bartlomiej Zolnierkiewicz
2009-11-08 18:27 ` Ivo van Doorn
2009-11-08 18:32 ` Bartlomiej Zolnierkiewicz
2009-11-08 18:40 ` Ivo van Doorn
2009-11-08 18:47 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:14 ` Kalle Valo
2009-11-08 19:21 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:35 ` Ivo van Doorn
2009-11-08 19:38 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:25 ` Ivo van Doorn
2009-11-08 19:34 ` Bartlomiej Zolnierkiewicz
2009-11-08 14:38 ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 9/9] rt2800usb: add eFuse EEPROM support Bartlomiej Zolnierkiewicz
2009-11-08 13:56 ` Ivo van Doorn
2009-11-08 14:41 ` Gertjan van Wingerde
2009-11-08 13:50 ` [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Ivo van Doorn
2009-11-08 14:16 ` Gertjan van Wingerde
2009-11-08 17:41 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:07 ` Gertjan van Wingerde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).