aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2009-03-28 15:51:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:29 -0400
commit440ddadaee6d0d5e8a7ee53ac913f78a8e5570a1 (patch)
tree2a6f185ae743afce09c684f23084e8290e813fcf /drivers/net/wireless/rt2x00
parent32c1628f153a5468cf48be5e5c04cd599ae9e01d (diff)
rt2x00: Move Move pci_dev specific access to rt2x00pci
pci_dev->irq and pci_name(pci_dev) access should be limited to rt2x00pci only. This is more generic and allows a rt2x00 pci driver to be controlled as PCI device but also as platform driver (needed for rt2800pci SoC support). Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c16
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.h6
6 files changed, 33 insertions, 18 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 0f08773328c6..411eb9cbb4e5 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1361,7 +1361,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1361 */ 1361 */
1362 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1362 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
1363 rt2x00pci_register_read(rt2x00dev, CSR0, &reg); 1363 rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
1364 rt2x00_set_chip(rt2x00dev, RT2460, value, reg); 1364 rt2x00_set_chip_rf(rt2x00dev, value, reg);
1365 1365
1366 if (!rt2x00_rf(&rt2x00dev->chip, RF2420) && 1366 if (!rt2x00_rf(&rt2x00dev->chip, RF2420) &&
1367 !rt2x00_rf(&rt2x00dev->chip, RF2421)) { 1367 !rt2x00_rf(&rt2x00dev->chip, RF2421)) {
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 276a8232aaa0..e1be67ca23d8 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1525,7 +1525,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1525 */ 1525 */
1526 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1526 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
1527 rt2x00pci_register_read(rt2x00dev, CSR0, &reg); 1527 rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
1528 rt2x00_set_chip(rt2x00dev, RT2560, value, reg); 1528 rt2x00_set_chip_rf(rt2x00dev, value, reg);
1529 1529
1530 if (!rt2x00_rf(&rt2x00dev->chip, RF2522) && 1530 if (!rt2x00_rf(&rt2x00dev->chip, RF2522) &&
1531 !rt2x00_rf(&rt2x00dev->chip, RF2523) && 1531 !rt2x00_rf(&rt2x00dev->chip, RF2523) &&
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 84bd6f19acb0..e03d69975ea4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -672,6 +672,12 @@ struct rt2x00_dev {
672 unsigned long flags; 672 unsigned long flags;
673 673
674 /* 674 /*
675 * Device information, Bus IRQ and name (PCI, SoC)
676 */
677 int irq;
678 const char *name;
679
680 /*
675 * Chipset identification. 681 * Chipset identification.
676 */ 682 */
677 struct rt2x00_chip chip; 683 struct rt2x00_chip chip;
@@ -860,6 +866,18 @@ static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev,
860 rt2x00dev->chip.rev = rev; 866 rt2x00dev->chip.rev = rev;
861} 867}
862 868
869static inline void rt2x00_set_chip_rt(struct rt2x00_dev *rt2x00dev,
870 const u16 rt)
871{
872 rt2x00dev->chip.rt = rt;
873}
874
875static inline void rt2x00_set_chip_rf(struct rt2x00_dev *rt2x00dev,
876 const u16 rf, const u32 rev)
877{
878 rt2x00_set_chip(rt2x00dev, rt2x00dev->chip.rt, rf, rev);
879}
880
863static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip) 881static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip)
864{ 882{
865 return (chipset->rt == chip); 883 return (chipset->rt == chip);
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 9730b4f8fd26..cdd5154bd4c0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -170,7 +170,6 @@ static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev,
170 170
171int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) 171int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)
172{ 172{
173 struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev);
174 struct data_queue *queue; 173 struct data_queue *queue;
175 int status; 174 int status;
176 175
@@ -186,11 +185,11 @@ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)
186 /* 185 /*
187 * Register interrupt handler. 186 * Register interrupt handler.
188 */ 187 */
189 status = request_irq(pci_dev->irq, rt2x00dev->ops->lib->irq_handler, 188 status = request_irq(rt2x00dev->irq, rt2x00dev->ops->lib->irq_handler,
190 IRQF_SHARED, pci_name(pci_dev), rt2x00dev); 189 IRQF_SHARED, rt2x00dev->name, rt2x00dev);
191 if (status) { 190 if (status) {
192 ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", 191 ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n",
193 pci_dev->irq, status); 192 rt2x00dev->irq, status);
194 goto exit; 193 goto exit;
195 } 194 }
196 195
@@ -270,6 +269,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
270 struct ieee80211_hw *hw; 269 struct ieee80211_hw *hw;
271 struct rt2x00_dev *rt2x00dev; 270 struct rt2x00_dev *rt2x00dev;
272 int retval; 271 int retval;
272 u16 chip;
273 273
274 retval = pci_request_regions(pci_dev, pci_name(pci_dev)); 274 retval = pci_request_regions(pci_dev, pci_name(pci_dev));
275 if (retval) { 275 if (retval) {
@@ -307,6 +307,14 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
307 rt2x00dev->dev = &pci_dev->dev; 307 rt2x00dev->dev = &pci_dev->dev;
308 rt2x00dev->ops = ops; 308 rt2x00dev->ops = ops;
309 rt2x00dev->hw = hw; 309 rt2x00dev->hw = hw;
310 rt2x00dev->irq = pci_dev->irq;
311 rt2x00dev->name = pci_name(pci_dev);
312
313 /*
314 * Determine RT chipset by reading PCI header.
315 */
316 pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip);
317 rt2x00_set_chip_rt(rt2x00dev, chip);
310 318
311 retval = rt2x00pci_alloc_reg(rt2x00dev); 319 retval = rt2x00pci_alloc_reg(rt2x00dev);
312 if (retval) 320 if (retval)
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 2ca8b7a9722c..4346cd1494bc 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2308,7 +2308,6 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2308 u32 reg; 2308 u32 reg;
2309 u16 value; 2309 u16 value;
2310 u16 eeprom; 2310 u16 eeprom;
2311 u16 device;
2312 2311
2313 /* 2312 /*
2314 * Read EEPROM word for configuration. 2313 * Read EEPROM word for configuration.
@@ -2317,14 +2316,10 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2317 2316
2318 /* 2317 /*
2319 * Identify RF chipset. 2318 * Identify RF chipset.
2320 * To determine the RT chip we have to read the
2321 * PCI header of the device.
2322 */ 2319 */
2323 pci_read_config_word(to_pci_dev(rt2x00dev->dev),
2324 PCI_CONFIG_HEADER_DEVICE, &device);
2325 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 2320 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
2326 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg); 2321 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
2327 rt2x00_set_chip(rt2x00dev, device, value, reg); 2322 rt2x00_set_chip_rf(rt2x00dev, value, reg);
2328 2323
2329 if (!rt2x00_rf(&rt2x00dev->chip, RF5225) && 2324 if (!rt2x00_rf(&rt2x00dev->chip, RF5225) &&
2330 !rt2x00_rf(&rt2x00dev->chip, RF5325) && 2325 !rt2x00_rf(&rt2x00dev->chip, RF5325) &&
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h
index 41e8959919f6..6c71f77c8165 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.h
+++ b/drivers/net/wireless/rt2x00/rt61pci.h
@@ -63,12 +63,6 @@
63 */ 63 */
64 64
65/* 65/*
66 * PCI Configuration Header
67 */
68#define PCI_CONFIG_HEADER_VENDOR 0x0000
69#define PCI_CONFIG_HEADER_DEVICE 0x0002
70
71/*
72 * HOST_CMD_CSR: For HOST to interrupt embedded processor 66 * HOST_CMD_CSR: For HOST to interrupt embedded processor
73 */ 67 */
74#define HOST_CMD_CSR 0x0008 68#define HOST_CMD_CSR 0x0008