1 From d2216933a12c38ab23ee1170c1c143002a825046 Mon Sep 17 00:00:00 2001
2 From: Ivo van Doorn <IvDoorn@gmail.com>
3 Date: Thu, 22 Jan 2009 21:16:08 +0100
4 Subject: [PATCH] rt2x00: Update chipset ID handling (rt2800pci)
6 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
8 drivers/net/wireless/rt2x00/rt2800pci.c | 22 ++++++++++++++++------
9 drivers/net/wireless/rt2x00/rt2800pci.h | 8 +++++---
10 2 files changed, 21 insertions(+), 9 deletions(-)
12 --- a/drivers/net/wireless/rt2x00/rt2800pci.c
13 +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
14 @@ -984,7 +984,7 @@ static void rt2800pci_reset_tuner(struct
15 static void rt2800pci_link_tuner(struct rt2x00_dev *rt2x00dev,
16 struct link_qual *qual, const u32 count)
18 - if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C)
19 + if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
23 @@ -1272,7 +1272,11 @@ static int rt2800pci_init_registers(stru
25 rt2x00pci_register_read(rt2x00dev, MAX_LEN_CFG, ®);
26 rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
27 - rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1);
28 + if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
29 + rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
30 + rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2);
32 + rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1);
33 rt2x00_set_field32(®, MAX_LEN_CFG_MIN_PSDU, 0);
34 rt2x00_set_field32(®, MAX_LEN_CFG_MIN_MPDU, 0);
35 rt2x00pci_register_write(rt2x00dev, MAX_LEN_CFG, reg);
36 @@ -1523,12 +1527,12 @@ static int rt2800pci_init_bbp(struct rt2
37 rt2800pci_bbp_write(rt2x00dev, 103, 0x00);
38 rt2800pci_bbp_write(rt2x00dev, 105, 0x05);
40 - if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C) {
41 + if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
42 rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
43 rt2800pci_bbp_write(rt2x00dev, 73, 0x12);
46 - if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_D)
47 + if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
48 rt2800pci_bbp_write(rt2x00dev, 84, 0x19);
50 for (i = 0; i < EEPROM_BBP_SIZE; i++) {
51 @@ -1637,6 +1641,11 @@ static int rt2800pci_enable_radio(struct
55 + rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
56 + rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1);
57 + rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0);
58 + rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
60 rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, ®);
61 rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1);
62 rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1);
63 @@ -2253,13 +2262,14 @@ static int rt2800pci_init_eeprom(struct
64 PCI_CONFIG_HEADER_DEVICE, &device);
65 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
66 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®);
67 - reg = rt2x00_get_field32(reg, MAC_CSR0_ASIC_REV);
68 rt2x00_set_chip(rt2x00dev, device, value, reg);
70 if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
71 !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
72 !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
73 - !rt2x00_rf(&rt2x00dev->chip, RF2750)) {
74 + !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
75 + !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
76 + !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
77 ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
80 --- a/drivers/net/wireless/rt2x00/rt2800pci.h
81 +++ b/drivers/net/wireless/rt2x00/rt2800pci.h
86 -#define RT2860_VERSION_C 0x0100
87 -#define RT2860_VERSION_D 0x0101
88 -#define RT2860_VERSION_E 0x0200
89 +#define RT2860C_VERSION 0x28600100
90 +#define RT2860D_VERSION 0x28600101
91 +#define RT2880E_VERSION 0x28720200
92 +#define RT2883_VERSION 0x28830300
93 +#define RT3070_VERSION 0x30700200