* [PATCH 1/7] rt2x00: Remove RT2870 chipset identification.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 18:09 ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 2/7] rt2x00: Move all register definitions for rt2800 to rt2800.h Gertjan van Wingerde
` (5 subsequent siblings)
6 siblings, 1 reply; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
There is no evidence, either in adapters or in the Ralink code, that such
a device actually exists. All so-call RT2870 adapter identify themselves
as RT2860.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800.h | 1 -
drivers/net/wireless/rt2x00/rt2800lib.c | 5 +----
drivers/net/wireless/rt2x00/rt2x00.h | 3 +--
3 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index 2aa0375..35afe63 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -63,7 +63,6 @@
*/
#define REV_RT2860C 0x0100
#define REV_RT2860D 0x0101
-#define REV_RT2870D 0x0101
#define REV_RT2872E 0x0200
#define REV_RT3070E 0x0200
#define REV_RT3070F 0x0201
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 9ee4ffa..b1dfb57 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1765,8 +1765,7 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
rt2800_bbp_write(rt2x00dev, 82, 0x62);
rt2800_bbp_write(rt2x00dev, 83, 0x6a);
- if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D) ||
- rt2x00_rt_rev(rt2x00dev, RT2870, REV_RT2870D))
+ if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D))
rt2800_bbp_write(rt2x00dev, 84, 0x19);
else
rt2800_bbp_write(rt2x00dev, 84, 0x99);
@@ -2206,7 +2205,6 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
} else if (rt2x00_rt(rt2x00dev, RT2860) ||
- rt2x00_rt(rt2x00dev, RT2870) ||
rt2x00_rt(rt2x00dev, RT2872)) {
/*
* There is a max of 2 RX streams for RT28x0 series
@@ -2310,7 +2308,6 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
value, rt2x00_get_field32(reg, MAC_CSR0_REVISION));
if (!rt2x00_rt(rt2x00dev, RT2860) &&
- !rt2x00_rt(rt2x00dev, RT2870) &&
!rt2x00_rt(rt2x00dev, RT2872) &&
!rt2x00_rt(rt2x00dev, RT2883) &&
!rt2x00_rt(rt2x00dev, RT3070) &&
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 889a372..9fc3612 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -176,8 +176,7 @@ struct rt2x00_chip {
#define RT2570 0x2570
#define RT2661 0x2661
#define RT2573 0x2573
-#define RT2860 0x2860 /* 2.4GHz PCI/CB */
-#define RT2870 0x2870
+#define RT2860 0x2860 /* 2.4GHz */
#define RT2872 0x2872 /* WSOC */
#define RT2883 0x2883 /* WSOC */
#define RT3070 0x3070
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 2/7] rt2x00: Move all register definitions for rt2800 to rt2800.h.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
2010-05-19 15:26 ` [PATCH 1/7] rt2x00: Remove RT2870 chipset identification Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 18:10 ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 3/7] rt2x00: Introduce separate interface type for PCI-express Gertjan van Wingerde
` (4 subsequent siblings)
6 siblings, 1 reply; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
There is no point on having them separated across 3 files.
At the same time rename USB_CYC_CFG to its proper name US_CYC_CNT
(as per the datasheet).
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800.h | 48 +++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++--
drivers/net/wireless/rt2x00/rt2800pci.h | 19 ------------
drivers/net/wireless/rt2x00/rt2800usb.h | 37 -----------------------
4 files changed, 51 insertions(+), 59 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index 35afe63..16bfaa8 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -98,6 +98,21 @@
*/
/*
+ * E2PROM_CSR: PCI EEPROM control register.
+ * RELOAD: Write 1 to reload eeprom content.
+ * TYPE: 0: 93c46, 1:93c66.
+ * LOAD_STATUS: 1:loading, 0:done.
+ */
+#define E2PROM_CSR 0x0004
+#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001)
+#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002)
+#define E2PROM_CSR_DATA_IN FIELD32(0x00000004)
+#define E2PROM_CSR_DATA_OUT FIELD32(0x00000008)
+#define E2PROM_CSR_TYPE FIELD32(0x00000030)
+#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040)
+#define E2PROM_CSR_RELOAD FIELD32(0x00000080)
+
+/*
* OPT_14: Unknown register used by rt3xxx devices.
*/
#define OPT_14_CSR 0x0114
@@ -321,6 +336,39 @@
#define RX_DRX_IDX 0x029c
/*
+ * USB_DMA_CFG
+ * RX_BULK_AGG_TIMEOUT: Rx Bulk Aggregation TimeOut in unit of 33ns.
+ * RX_BULK_AGG_LIMIT: Rx Bulk Aggregation Limit in unit of 256 bytes.
+ * PHY_CLEAR: phy watch dog enable.
+ * TX_CLEAR: Clear USB DMA TX path.
+ * TXOP_HALT: Halt TXOP count down when TX buffer is full.
+ * RX_BULK_AGG_EN: Enable Rx Bulk Aggregation.
+ * RX_BULK_EN: Enable USB DMA Rx.
+ * TX_BULK_EN: Enable USB DMA Tx.
+ * EP_OUT_VALID: OUT endpoint data valid.
+ * RX_BUSY: USB DMA RX FSM busy.
+ * TX_BUSY: USB DMA TX FSM busy.
+ */
+#define USB_DMA_CFG 0x02a0
+#define USB_DMA_CFG_RX_BULK_AGG_TIMEOUT FIELD32(0x000000ff)
+#define USB_DMA_CFG_RX_BULK_AGG_LIMIT FIELD32(0x0000ff00)
+#define USB_DMA_CFG_PHY_CLEAR FIELD32(0x00010000)
+#define USB_DMA_CFG_TX_CLEAR FIELD32(0x00080000)
+#define USB_DMA_CFG_TXOP_HALT FIELD32(0x00100000)
+#define USB_DMA_CFG_RX_BULK_AGG_EN FIELD32(0x00200000)
+#define USB_DMA_CFG_RX_BULK_EN FIELD32(0x00400000)
+#define USB_DMA_CFG_TX_BULK_EN FIELD32(0x00800000)
+#define USB_DMA_CFG_EP_OUT_VALID FIELD32(0x3f000000)
+#define USB_DMA_CFG_RX_BUSY FIELD32(0x40000000)
+#define USB_DMA_CFG_TX_BUSY FIELD32(0x80000000)
+
+/*
+ * US_CYC_CNT
+ */
+#define US_CYC_CNT 0x02a4
+#define US_CYC_CNT_CLOCK_CYCLE FIELD32(0x000000ff)
+
+/*
* PBF_SYS_CTRL
* HOST_RAM_WRITE: enable Host program ram write selection
*/
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b1dfb57..5183249 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1619,9 +1619,9 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
rt2800_register_write(rt2x00dev, HW_BEACON_BASE7, 0);
if (rt2x00_is_usb(rt2x00dev)) {
- rt2800_register_read(rt2x00dev, USB_CYC_CFG, ®);
- rt2x00_set_field32(®, USB_CYC_CFG_CLOCK_CYCLE, 30);
- rt2800_register_write(rt2x00dev, USB_CYC_CFG, reg);
+ rt2800_register_read(rt2x00dev, US_CYC_CNT, ®);
+ rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 30);
+ rt2800_register_write(rt2x00dev, US_CYC_CNT, reg);
}
rt2800_register_read(rt2x00dev, HT_FBK_CFG0, ®);
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.h b/drivers/net/wireless/rt2x00/rt2800pci.h
index afc8e7d..5a8dda9 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.h
+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
@@ -35,25 +35,6 @@
#define RT2800PCI_H
/*
- * PCI registers.
- */
-
-/*
- * E2PROM_CSR: EEPROM control register.
- * RELOAD: Write 1 to reload eeprom content.
- * TYPE: 0: 93c46, 1:93c66.
- * LOAD_STATUS: 1:loading, 0:done.
- */
-#define E2PROM_CSR 0x0004
-#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001)
-#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002)
-#define E2PROM_CSR_DATA_IN FIELD32(0x00000004)
-#define E2PROM_CSR_DATA_OUT FIELD32(0x00000008)
-#define E2PROM_CSR_TYPE FIELD32(0x00000030)
-#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040)
-#define E2PROM_CSR_RELOAD FIELD32(0x00000080)
-
-/*
* Queue register offset macros
*/
#define TX_QUEUE_REG_OFFSET 0x10
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h
index 2bca6a7..0722bad 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.h
+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
@@ -32,43 +32,6 @@
#define RT2800USB_H
/*
- * USB registers.
- */
-
-/*
- * USB_DMA_CFG
- * RX_BULK_AGG_TIMEOUT: Rx Bulk Aggregation TimeOut in unit of 33ns.
- * RX_BULK_AGG_LIMIT: Rx Bulk Aggregation Limit in unit of 256 bytes.
- * PHY_CLEAR: phy watch dog enable.
- * TX_CLEAR: Clear USB DMA TX path.
- * TXOP_HALT: Halt TXOP count down when TX buffer is full.
- * RX_BULK_AGG_EN: Enable Rx Bulk Aggregation.
- * RX_BULK_EN: Enable USB DMA Rx.
- * TX_BULK_EN: Enable USB DMA Tx.
- * EP_OUT_VALID: OUT endpoint data valid.
- * RX_BUSY: USB DMA RX FSM busy.
- * TX_BUSY: USB DMA TX FSM busy.
- */
-#define USB_DMA_CFG 0x02a0
-#define USB_DMA_CFG_RX_BULK_AGG_TIMEOUT FIELD32(0x000000ff)
-#define USB_DMA_CFG_RX_BULK_AGG_LIMIT FIELD32(0x0000ff00)
-#define USB_DMA_CFG_PHY_CLEAR FIELD32(0x00010000)
-#define USB_DMA_CFG_TX_CLEAR FIELD32(0x00080000)
-#define USB_DMA_CFG_TXOP_HALT FIELD32(0x00100000)
-#define USB_DMA_CFG_RX_BULK_AGG_EN FIELD32(0x00200000)
-#define USB_DMA_CFG_RX_BULK_EN FIELD32(0x00400000)
-#define USB_DMA_CFG_TX_BULK_EN FIELD32(0x00800000)
-#define USB_DMA_CFG_EP_OUT_VALID FIELD32(0x3f000000)
-#define USB_DMA_CFG_RX_BUSY FIELD32(0x40000000)
-#define USB_DMA_CFG_TX_BUSY FIELD32(0x80000000)
-
-/*
- * USB_CYC_CFG
- */
-#define USB_CYC_CFG 0x02a4
-#define USB_CYC_CFG_CLOCK_CYCLE FIELD32(0x000000ff)
-
-/*
* 8051 firmware image.
*/
#define FIRMWARE_RT2870 "rt2870.bin"
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 3/7] rt2x00: Introduce separate interface type for PCI-express.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
2010-05-19 15:26 ` [PATCH 1/7] rt2x00: Remove RT2870 chipset identification Gertjan van Wingerde
2010-05-19 15:26 ` [PATCH 2/7] rt2x00: Move all register definitions for rt2800 to rt2800.h Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 18:10 ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 4/7] rt2x00: Simplify check for external LNA in rt2800_init_rfcsr Gertjan van Wingerde
` (3 subsequent siblings)
6 siblings, 1 reply; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
Needed later for PCI-express specific code in rt2800pci.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00.h | 9 ++++++++-
drivers/net/wireless/rt2x00/rt2x00pci.c | 5 ++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 9fc3612..e7acc6a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -160,6 +160,7 @@ struct avg_val {
enum rt2x00_chip_intf {
RT2X00_CHIP_INTF_PCI,
+ RT2X00_CHIP_INTF_PCIE,
RT2X00_CHIP_INTF_USB,
RT2X00_CHIP_INTF_SOC,
};
@@ -980,7 +981,13 @@ static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev,
static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev)
{
- return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
+ return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI) ||
+ rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
+}
+
+static inline bool rt2x00_is_pcie(struct rt2x00_dev *rt2x00dev)
+{
+ return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
}
static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 19b8683..fe4b00b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -350,7 +350,10 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
rt2x00dev->irq = pci_dev->irq;
rt2x00dev->name = pci_name(pci_dev);
- rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
+ if (pci_dev->is_pcie)
+ rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
+ else
+ rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
retval = rt2x00pci_alloc_reg(rt2x00dev);
if (retval)
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 4/7] rt2x00: Simplify check for external LNA in rt2800_init_rfcsr.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
` (2 preceding siblings ...)
2010-05-19 15:26 ` [PATCH 3/7] rt2x00: Introduce separate interface type for PCI-express Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 18:11 ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb} Gertjan van Wingerde
` (2 subsequent siblings)
6 siblings, 1 reply; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
Instead of parsing the EEPROM information, use the flag that was set during
device initialization.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 5183249..d46d1b8 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2071,8 +2071,7 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
+ if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags))
rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
}
rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom);
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb}.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
` (3 preceding siblings ...)
2010-05-19 15:26 ` [PATCH 4/7] rt2x00: Simplify check for external LNA in rt2800_init_rfcsr Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 18:12 ` Ivo Van Doorn
2010-05-19 18:26 ` Ivo van Doorn
2010-05-19 15:26 ` [PATCH 6/7] rt2x00: Sync rt2800 MCU boot signal with Ralink driver Gertjan van Wingerde
2010-05-19 15:26 ` [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800 Gertjan van Wingerde
6 siblings, 2 replies; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
This prevents us having common code depend on PCI or USB specific code.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 61 ++-----------------------------
drivers/net/wireless/rt2x00/rt2800lib.h | 9 +++++
drivers/net/wireless/rt2x00/rt2800pci.c | 34 +++++++++++++++++
drivers/net/wireless/rt2x00/rt2800usb.c | 40 ++++++++++++++++++++
4 files changed, 87 insertions(+), 57 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index d46d1b8..8ffbc3c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -37,12 +37,8 @@
#include <linux/module.h>
#include "rt2x00.h"
-#if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE)
-#include "rt2x00usb.h"
-#endif
#include "rt2800lib.h"
#include "rt2800.h"
-#include "rt2800usb.h"
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
MODULE_DESCRIPTION("rt2800 library");
@@ -1271,6 +1267,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
u32 reg;
u16 eeprom;
unsigned int i;
+ int ret;
rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®);
rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
@@ -1280,59 +1277,9 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
- if (rt2x00_is_usb(rt2x00dev)) {
- /*
- * Wait until BBP and RF are ready.
- */
- for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
- rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
- if (reg && reg != ~0)
- break;
- msleep(1);
- }
-
- if (i == REGISTER_BUSY_COUNT) {
- ERROR(rt2x00dev, "Unstable hardware.\n");
- return -EBUSY;
- }
-
- rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, ®);
- rt2800_register_write(rt2x00dev, PBF_SYS_CTRL,
- reg & ~0x00002000);
- } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) {
- /*
- * Reset DMA indexes
- */
- rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, ®);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, 1);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, 1);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, 1);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, 1);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX4, 1);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX5, 1);
- rt2x00_set_field32(®, WPDMA_RST_IDX_DRX_IDX0, 1);
- rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
-
- rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f);
- rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
-
- rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
- }
-
- rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
- rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1);
- rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1);
- rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
-
- if (rt2x00_is_usb(rt2x00dev)) {
- rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
-#if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE)
- rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
- USB_MODE_RESET, REGISTER_TIMEOUT);
-#endif
- }
-
- rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
+ ret = rt2800_drv_init_registers(rt2x00dev);
+ if (ret)
+ return ret;
rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®);
rt2x00_set_field32(®, BCN_OFFSET0_BCN0, 0xe0); /* 0x3800 */
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h
index b16fd6d..8313dbf 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -40,6 +40,8 @@ struct rt2800_ops {
int (*regbusy_read)(struct rt2x00_dev *rt2x00dev,
const unsigned int offset,
const struct rt2x00_field32 field, u32 *reg);
+
+ int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
};
static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
@@ -107,6 +109,13 @@ static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg);
}
+static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev)
+{
+ const struct rt2800_ops *rt2800ops = rt2x00dev->priv;
+
+ return rt2800ops->drv_init_registers(rt2x00dev);
+}
+
void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
const u8 command, const u8 token,
const u8 arg0, const u8 arg1);
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index f271836..846600f 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -446,6 +446,38 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg);
}
+static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
+
+ /*
+ * Reset DMA indexes
+ */
+ rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, ®);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, 1);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, 1);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, 1);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, 1);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX4, 1);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX5, 1);
+ rt2x00_set_field32(®, WPDMA_RST_IDX_DRX_IDX0, 1);
+ rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
+
+ rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f);
+ rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
+
+ rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
+
+ rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
+ rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1);
+ rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1);
+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
+
+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
+
+ return 0;
+}
+
static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
@@ -944,6 +976,8 @@ static const struct rt2800_ops rt2800pci_rt2800_ops = {
.register_multiwrite = rt2x00pci_register_multiwrite,
.regbusy_read = rt2x00pci_regbusy_read,
+
+ .drv_init_registers = rt2800pci_init_registers,
};
static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 8a15ffb..6a2ed50 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -243,6 +243,44 @@ static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
}
+static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
+ int i;
+
+ /*
+ * Wait until BBP and RF are ready.
+ */
+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
+ rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
+ if (reg && reg != ~0)
+ break;
+ msleep(1);
+ }
+
+ if (i == REGISTER_BUSY_COUNT) {
+ ERROR(rt2x00dev, "Unstable hardware.\n");
+ return -EBUSY;
+ }
+
+ rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, ®);
+ rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);
+
+ rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
+ rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1);
+ rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1);
+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
+
+ rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
+
+ rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
+ USB_MODE_RESET, REGISTER_TIMEOUT);
+
+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
+
+ return 0;
+}
+
static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
@@ -549,6 +587,8 @@ static const struct rt2800_ops rt2800usb_rt2800_ops = {
.register_multiwrite = rt2x00usb_register_multiwrite,
.regbusy_read = rt2x00usb_regbusy_read,
+
+ .drv_init_registers = rt2800usb_init_registers,
};
static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb}.
2010-05-19 15:26 ` [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb} Gertjan van Wingerde
@ 2010-05-19 18:12 ` Ivo Van Doorn
2010-05-19 18:26 ` Ivo van Doorn
1 sibling, 0 replies; 19+ messages in thread
From: Ivo Van Doorn @ 2010-05-19 18:12 UTC (permalink / raw)
To: Gertjan van Wingerde
Cc: John W. Linville, Helmut Schaa, linux-wireless, users
On Wed, May 19, 2010 at 5:26 PM, Gertjan van Wingerde
<gwingerde@gmail.com> wrote:
> This prevents us having common code depend on PCI or USB specific code.
>
> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb}.
2010-05-19 15:26 ` [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb} Gertjan van Wingerde
2010-05-19 18:12 ` Ivo Van Doorn
@ 2010-05-19 18:26 ` Ivo van Doorn
2010-05-19 18:33 ` Gertjan van Wingerde
1 sibling, 1 reply; 19+ messages in thread
From: Ivo van Doorn @ 2010-05-19 18:26 UTC (permalink / raw)
To: Gertjan van Wingerde
Cc: John W. Linville, Helmut Schaa, linux-wireless, users
On Wednesday 19 May 2010 17:26:07 Gertjan van Wingerde wrote:
> This prevents us having common code depend on PCI or USB specific code.
>
> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
> ---
To which tree are you creating your diffs?
This one doesn't apply to latest wireless-testing.git or rt2x00,git
Ivo
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb}.
2010-05-19 18:26 ` Ivo van Doorn
@ 2010-05-19 18:33 ` Gertjan van Wingerde
0 siblings, 0 replies; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 18:33 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: John W. Linville, Helmut Schaa, linux-wireless, users
On 05/19/10 20:26, Ivo van Doorn wrote:
> On Wednesday 19 May 2010 17:26:07 Gertjan van Wingerde wrote:
>> This prevents us having common code depend on PCI or USB specific code.
>>
>> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
>> ---
>
> To which tree are you creating your diffs?
> This one doesn't apply to latest wireless-testing.git or rt2x00,git
>
All my patches are against wireless-next-2.6.git, as that is the tree John will use to merge patches
in.
I believe there indeed is a slight difference between that tree and wireless-testing.git
with respect to the <linux/slab.h> inclusion, causing applying errors against wireless-testing.
---
Gertjan.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 6/7] rt2x00: Sync rt2800 MCU boot signal with Ralink driver.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
` (4 preceding siblings ...)
2010-05-19 15:26 ` [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb} Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 18:12 ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800 Gertjan van Wingerde
6 siblings, 1 reply; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
Latest versions of the Ralink rt2800 family drivers use 0 as the token value,
not 0xff.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800pci.c | 2 +-
drivers/net/wireless/rt2x00/rt2800usb.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 846600f..b5a871e 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -497,7 +497,7 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
/*
* Send signal to firmware during boot time.
*/
- rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
+ rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0);
/*
* Enable RX.
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 6a2ed50..df3d7a6 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -193,7 +193,7 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev,
/*
* Send signal to firmware during boot time.
*/
- rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
+ rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0);
if (rt2x00_rt(rt2x00dev, RT3070) ||
rt2x00_rt(rt2x00dev, RT3071) ||
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800.
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
` (5 preceding siblings ...)
2010-05-19 15:26 ` [PATCH 6/7] rt2x00: Sync rt2800 MCU boot signal with Ralink driver Gertjan van Wingerde
@ 2010-05-19 15:26 ` Gertjan van Wingerde
2010-05-19 15:51 ` Helmut Schaa
2010-05-19 18:14 ` Ivo Van Doorn
6 siblings, 2 replies; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 15:26 UTC (permalink / raw)
To: John W. Linville
Cc: Ivo van Doorn, Helmut Schaa, linux-wireless, users,
Gertjan van Wingerde
Closer inspection of the legacy Ralink driver reveals that in case of HT40+
or HT40- we must adjust the frequency settings that we program to the device.
Implement the same adjustment in the rt2x00 code.
With this HT40 seems to work for all devices supported by rt2800pci and
rt2800usb.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 5 +----
drivers/net/wireless/rt2x00/rt2x00config.c | 12 ++++++++----
drivers/net/wireless/rt2x00/rt2x00ht.c | 27 +++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00lib.h | 9 +++++++++
4 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 8ffbc3c..15322f0 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2530,11 +2530,8 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
else
spec->ht.ht_supported = false;
- /*
- * Don't set IEEE80211_HT_CAP_SUP_WIDTH_20_40 for now as it causes
- * reception problems with HT40 capable 11n APs
- */
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 |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 098315a..8dbd634 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -170,23 +170,27 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
unsigned int ieee80211_flags)
{
struct rt2x00lib_conf libconf;
+ u16 hw_value;
memset(&libconf, 0, sizeof(libconf));
libconf.conf = conf;
if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) {
- if (conf_is_ht40(conf))
+ if (conf_is_ht40(conf)) {
__set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
- else
+ hw_value = rt2x00ht_center_channel(rt2x00dev, conf);
+ } else {
__clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
+ hw_value = conf->channel->hw_value;
+ }
memcpy(&libconf.rf,
- &rt2x00dev->spec.channels[conf->channel->hw_value],
+ &rt2x00dev->spec.channels[hw_value],
sizeof(libconf.rf));
memcpy(&libconf.channel,
- &rt2x00dev->spec.channels_info[conf->channel->hw_value],
+ &rt2x00dev->spec.channels_info[hw_value],
sizeof(libconf.channel));
}
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c
index 5a40760..588c766 100644
--- a/drivers/net/wireless/rt2x00/rt2x00ht.c
+++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
@@ -84,3 +84,30 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
else
txdesc->txop = TXOP_HTTXOP;
}
+
+u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
+ struct ieee80211_conf *conf)
+{
+ struct hw_mode_spec *spec = &rt2x00dev->spec;
+ int center_channel;
+ u16 i;
+
+ /*
+ * Initialize center channel to current channel.
+ */
+ center_channel = spec->channels[conf->channel->hw_value].channel;
+
+ /*
+ * Adjust center channel to HT40+ and HT40- operation.
+ */
+ if (conf_is_ht40_plus(conf))
+ center_channel += 2;
+ else if (conf_is_ht40_minus(conf))
+ center_channel -= (center_channel == 14) ? 1 : 2;
+
+ for (i = 0; i < spec->num_channels; i++)
+ if (spec->channels[i].channel == center_channel)
+ return i;
+
+ BUG();
+}
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 822affc..ed27de1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -367,12 +367,21 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
struct txentry_desc *txdesc,
const struct rt2x00_rate *hwrate);
+
+u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
+ struct ieee80211_conf *conf);
#else
static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
struct txentry_desc *txdesc,
const struct rt2x00_rate *hwrate)
{
}
+
+static inline u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
+ struct ieee80211_conf *conf)
+{
+ return conf->channel->hw_value;
+}
#endif /* CONFIG_RT2X00_LIB_HT */
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800.
2010-05-19 15:26 ` [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800 Gertjan van Wingerde
@ 2010-05-19 15:51 ` Helmut Schaa
2010-05-19 18:14 ` Ivo Van Doorn
1 sibling, 0 replies; 19+ messages in thread
From: Helmut Schaa @ 2010-05-19 15:51 UTC (permalink / raw)
To: Gertjan van Wingerde
Cc: John W. Linville, Ivo van Doorn, linux-wireless, users
Am Mittwoch 19 Mai 2010 schrieb Gertjan van Wingerde:
> Closer inspection of the legacy Ralink driver reveals that in case of HT40+
> or HT40- we must adjust the frequency settings that we program to the device.
> Implement the same adjustment in the rt2x00 code.
>
> With this HT40 seems to work for all devices supported by rt2800pci and
> rt2800usb.
Awesome, I'll give it a shot tomorrow.
Helmut
> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 5 +----
> drivers/net/wireless/rt2x00/rt2x00config.c | 12 ++++++++----
> drivers/net/wireless/rt2x00/rt2x00ht.c | 27 +++++++++++++++++++++++++++
> drivers/net/wireless/rt2x00/rt2x00lib.h | 9 +++++++++
> 4 files changed, 45 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 8ffbc3c..15322f0 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -2530,11 +2530,8 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
> else
> spec->ht.ht_supported = false;
>
> - /*
> - * Don't set IEEE80211_HT_CAP_SUP_WIDTH_20_40 for now as it causes
> - * reception problems with HT40 capable 11n APs
> - */
> 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 |
> diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
> index 098315a..8dbd634 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00config.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00config.c
> @@ -170,23 +170,27 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
> unsigned int ieee80211_flags)
> {
> struct rt2x00lib_conf libconf;
> + u16 hw_value;
>
> memset(&libconf, 0, sizeof(libconf));
>
> libconf.conf = conf;
>
> if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) {
> - if (conf_is_ht40(conf))
> + if (conf_is_ht40(conf)) {
> __set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
> - else
> + hw_value = rt2x00ht_center_channel(rt2x00dev, conf);
> + } else {
> __clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
> + hw_value = conf->channel->hw_value;
> + }
>
> memcpy(&libconf.rf,
> - &rt2x00dev->spec.channels[conf->channel->hw_value],
> + &rt2x00dev->spec.channels[hw_value],
> sizeof(libconf.rf));
>
> memcpy(&libconf.channel,
> - &rt2x00dev->spec.channels_info[conf->channel->hw_value],
> + &rt2x00dev->spec.channels_info[hw_value],
> sizeof(libconf.channel));
> }
>
> diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c
> index 5a40760..588c766 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00ht.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
> @@ -84,3 +84,30 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
> else
> txdesc->txop = TXOP_HTTXOP;
> }
> +
> +u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
> + struct ieee80211_conf *conf)
> +{
> + struct hw_mode_spec *spec = &rt2x00dev->spec;
> + int center_channel;
> + u16 i;
> +
> + /*
> + * Initialize center channel to current channel.
> + */
> + center_channel = spec->channels[conf->channel->hw_value].channel;
> +
> + /*
> + * Adjust center channel to HT40+ and HT40- operation.
> + */
> + if (conf_is_ht40_plus(conf))
> + center_channel += 2;
> + else if (conf_is_ht40_minus(conf))
> + center_channel -= (center_channel == 14) ? 1 : 2;
> +
> + for (i = 0; i < spec->num_channels; i++)
> + if (spec->channels[i].channel == center_channel)
> + return i;
> +
> + BUG();
> +}
> diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
> index 822affc..ed27de1 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00lib.h
> +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
> @@ -367,12 +367,21 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
> void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
> struct txentry_desc *txdesc,
> const struct rt2x00_rate *hwrate);
> +
> +u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
> + struct ieee80211_conf *conf);
> #else
> static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
> struct txentry_desc *txdesc,
> const struct rt2x00_rate *hwrate)
> {
> }
> +
> +static inline u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
> + struct ieee80211_conf *conf)
> +{
> + return conf->channel->hw_value;
> +}
> #endif /* CONFIG_RT2X00_LIB_HT */
>
> /*
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800.
2010-05-19 15:26 ` [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800 Gertjan van Wingerde
2010-05-19 15:51 ` Helmut Schaa
@ 2010-05-19 18:14 ` Ivo Van Doorn
2010-05-19 19:08 ` Gertjan van Wingerde
1 sibling, 1 reply; 19+ messages in thread
From: Ivo Van Doorn @ 2010-05-19 18:14 UTC (permalink / raw)
To: Gertjan van Wingerde
Cc: John W. Linville, Helmut Schaa, linux-wireless, users
> +u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
> + struct ieee80211_conf *conf)
> +{
> + struct hw_mode_spec *spec = &rt2x00dev->spec;
> + int center_channel;
> + u16 i;
> +
> + /*
> + * Initialize center channel to current channel.
> + */
> + center_channel = spec->channels[conf->channel->hw_value].channel;
> +
> + /*
> + * Adjust center channel to HT40+ and HT40- operation.
> + */
> + if (conf_is_ht40_plus(conf))
> + center_channel += 2;
> + else if (conf_is_ht40_minus(conf))
> + center_channel -= (center_channel == 14) ? 1 : 2;
> +
> + for (i = 0; i < spec->num_channels; i++)
> + if (spec->channels[i].channel == center_channel)
> + return i;
> +
> + BUG();
> +}
This isn't worth a BUG(), perhaps a debug message or WARN(),
I would say a debug message and retuning the hw_value.
Ivo
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800.
2010-05-19 18:14 ` Ivo Van Doorn
@ 2010-05-19 19:08 ` Gertjan van Wingerde
0 siblings, 0 replies; 19+ messages in thread
From: Gertjan van Wingerde @ 2010-05-19 19:08 UTC (permalink / raw)
To: Ivo Van Doorn; +Cc: John W. Linville, Helmut Schaa, linux-wireless, users
On 05/19/10 20:14, Ivo Van Doorn wrote:
>> +u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
>> + struct ieee80211_conf *conf)
>> +{
>> + struct hw_mode_spec *spec = &rt2x00dev->spec;
>> + int center_channel;
>> + u16 i;
>> +
>> + /*
>> + * Initialize center channel to current channel.
>> + */
>> + center_channel = spec->channels[conf->channel->hw_value].channel;
>> +
>> + /*
>> + * Adjust center channel to HT40+ and HT40- operation.
>> + */
>> + if (conf_is_ht40_plus(conf))
>> + center_channel += 2;
>> + else if (conf_is_ht40_minus(conf))
>> + center_channel -= (center_channel == 14) ? 1 : 2;
>> +
>> + for (i = 0; i < spec->num_channels; i++)
>> + if (spec->channels[i].channel == center_channel)
>> + return i;
>> +
>> + BUG();
>> +}
>
> This isn't worth a BUG(), perhaps a debug message or WARN(),
> I would say a debug message and retuning the hw_value.
>
Oops, yes. BUG() is a bit too much here. This is simply left-over from testing.
Personally I think WARN() should be more appropriate, as it signifies an error situation
that really should not happen, and we want to atract a bit more attention to it than a
simple debug message.
v2 is on its way.
---
Gertjan.
^ permalink raw reply [flat|nested] 19+ messages in thread