[kmod bluetooth] hci_usb.c has been replaced with btusb.c in 2.6.29 - modify makefile...
[openwrt.git] / package / mac80211 / patches / 300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
1 From 9ed8a41a30916a79529552872e8d1a6175d37398 Mon Sep 17 00:00:00 2001
2 From: Ivo van Doorn <IvDoorn@gmail.com>
3 Date: Sat, 28 Mar 2009 20:30:14 +0100
4 Subject: [PATCH 1/9] rt2x00: Move Move pci_dev specific access to rt2x00pci
5
6 pci_dev->irq and pci_name(pci_dev) access should be limited
7 to rt2x00pci only. This is more generic and allows a rt2x00 pci
8 driver to be controlled as PCI device but also as platform driver
9 (needed for rt2800pci SoC support).
10
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
13 ---
14 drivers/net/wireless/rt2x00/rt2400pci.c | 2 +-
15 drivers/net/wireless/rt2x00/rt2500pci.c | 2 +-
16 drivers/net/wireless/rt2x00/rt2x00.h | 18 ++++++++++++++++++
17 drivers/net/wireless/rt2x00/rt2x00pci.c | 16 ++++++++++++----
18 drivers/net/wireless/rt2x00/rt61pci.c | 7 +------
19 drivers/net/wireless/rt2x00/rt61pci.h | 6 ------
20 6 files changed, 33 insertions(+), 18 deletions(-)
21
22 --- a/drivers/net/wireless/rt2x00/rt2400pci.c
23 +++ b/drivers/net/wireless/rt2x00/rt2400pci.c
24 @@ -1361,7 +1361,7 @@ static int rt2400pci_init_eeprom(struct
25 */
26 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
27 rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
28 - rt2x00_set_chip(rt2x00dev, RT2460, value, reg);
29 + rt2x00_set_chip_rf(rt2x00dev, value, reg);
30
31 if (!rt2x00_rf(&rt2x00dev->chip, RF2420) &&
32 !rt2x00_rf(&rt2x00dev->chip, RF2421)) {
33 --- a/drivers/net/wireless/rt2x00/rt2500pci.c
34 +++ b/drivers/net/wireless/rt2x00/rt2500pci.c
35 @@ -1525,7 +1525,7 @@ static int rt2500pci_init_eeprom(struct
36 */
37 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
38 rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
39 - rt2x00_set_chip(rt2x00dev, RT2560, value, reg);
40 + rt2x00_set_chip_rf(rt2x00dev, value, reg);
41
42 if (!rt2x00_rf(&rt2x00dev->chip, RF2522) &&
43 !rt2x00_rf(&rt2x00dev->chip, RF2523) &&
44 --- a/drivers/net/wireless/rt2x00/rt2x00.h
45 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
46 @@ -672,6 +672,12 @@ struct rt2x00_dev {
47 unsigned long flags;
48
49 /*
50 + * Device information, Bus IRQ and name (PCI, SoC)
51 + */
52 + int irq;
53 + const char *name;
54 +
55 + /*
56 * Chipset identification.
57 */
58 struct rt2x00_chip chip;
59 @@ -860,6 +866,18 @@ static inline void rt2x00_set_chip(struc
60 rt2x00dev->chip.rev = rev;
61 }
62
63 +static inline void rt2x00_set_chip_rt(struct rt2x00_dev *rt2x00dev,
64 + const u16 rt)
65 +{
66 + rt2x00dev->chip.rt = rt;
67 +}
68 +
69 +static inline void rt2x00_set_chip_rf(struct rt2x00_dev *rt2x00dev,
70 + const u16 rf, const u32 rev)
71 +{
72 + rt2x00_set_chip(rt2x00dev, rt2x00dev->chip.rt, rf, rev);
73 +}
74 +
75 static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip)
76 {
77 return (chipset->rt == chip);
78 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c
79 +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
80 @@ -170,7 +170,6 @@ static void rt2x00pci_free_queue_dma(str
81
82 int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)
83 {
84 - struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev);
85 struct data_queue *queue;
86 int status;
87
88 @@ -186,11 +185,11 @@ int rt2x00pci_initialize(struct rt2x00_d
89 /*
90 * Register interrupt handler.
91 */
92 - status = request_irq(pci_dev->irq, rt2x00dev->ops->lib->irq_handler,
93 - IRQF_SHARED, pci_name(pci_dev), rt2x00dev);
94 + status = request_irq(rt2x00dev->irq, rt2x00dev->ops->lib->irq_handler,
95 + IRQF_SHARED, rt2x00dev->name, rt2x00dev);
96 if (status) {
97 ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n",
98 - pci_dev->irq, status);
99 + rt2x00dev->irq, status);
100 goto exit;
101 }
102
103 @@ -270,6 +269,7 @@ int rt2x00pci_probe(struct pci_dev *pci_
104 struct ieee80211_hw *hw;
105 struct rt2x00_dev *rt2x00dev;
106 int retval;
107 + u16 chip;
108
109 retval = pci_request_regions(pci_dev, pci_name(pci_dev));
110 if (retval) {
111 @@ -307,6 +307,14 @@ int rt2x00pci_probe(struct pci_dev *pci_
112 rt2x00dev->dev = &pci_dev->dev;
113 rt2x00dev->ops = ops;
114 rt2x00dev->hw = hw;
115 + rt2x00dev->irq = pci_dev->irq;
116 + rt2x00dev->name = pci_name(pci_dev);
117 +
118 + /*
119 + * Determine RT chipset by reading PCI header.
120 + */
121 + pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip);
122 + rt2x00_set_chip_rt(rt2x00dev, chip);
123
124 retval = rt2x00pci_alloc_reg(rt2x00dev);
125 if (retval)
126 --- a/drivers/net/wireless/rt2x00/rt61pci.c
127 +++ b/drivers/net/wireless/rt2x00/rt61pci.c
128 @@ -2308,7 +2308,6 @@ static int rt61pci_init_eeprom(struct rt
129 u32 reg;
130 u16 value;
131 u16 eeprom;
132 - u16 device;
133
134 /*
135 * Read EEPROM word for configuration.
136 @@ -2317,14 +2316,10 @@ static int rt61pci_init_eeprom(struct rt
137
138 /*
139 * Identify RF chipset.
140 - * To determine the RT chip we have to read the
141 - * PCI header of the device.
142 */
143 - pci_read_config_word(to_pci_dev(rt2x00dev->dev),
144 - PCI_CONFIG_HEADER_DEVICE, &device);
145 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
146 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
147 - rt2x00_set_chip(rt2x00dev, device, value, reg);
148 + rt2x00_set_chip_rf(rt2x00dev, value, reg);
149
150 if (!rt2x00_rf(&rt2x00dev->chip, RF5225) &&
151 !rt2x00_rf(&rt2x00dev->chip, RF5325) &&
152 --- a/drivers/net/wireless/rt2x00/rt61pci.h
153 +++ b/drivers/net/wireless/rt2x00/rt61pci.h
154 @@ -63,12 +63,6 @@
155 */
156
157 /*
158 - * PCI Configuration Header
159 - */
160 -#define PCI_CONFIG_HEADER_VENDOR 0x0000
161 -#define PCI_CONFIG_HEADER_DEVICE 0x0002
162 -
163 -/*
164 * HOST_CMD_CSR: For HOST to interrupt embedded processor
165 */
166 #define HOST_CMD_CSR 0x0008
This page took 0.052939 seconds and 5 git commands to generate.