aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch')
-rw-r--r--package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch b/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
new file mode 100644
index 0000000000..91f5a2ad82
--- /dev/null
+++ b/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
@@ -0,0 +1,150 @@
+From 313314263fda19db8eed94a7d7259b595634212e Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 14 Mar 2009 20:02:51 +0100
+Subject: [PATCH] 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>
+---
+ drivers/net/wireless/rt2x00/rt2400pci.c | 2 +-
+ drivers/net/wireless/rt2x00/rt2500pci.c | 2 +-
+ drivers/net/wireless/rt2x00/rt2x00.h | 18 ++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2x00pci.c | 16 ++++++++++++----
+ drivers/net/wireless/rt2x00/rt61pci.c | 7 +------
+ 5 files changed, 33 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2400pci.c
++++ b/drivers/net/wireless/rt2x00/rt2400pci.c
+@@ -1361,7 +1361,7 @@ static int rt2400pci_init_eeprom(struct
+ */
+ value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
+ rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
+- rt2x00_set_chip(rt2x00dev, RT2460, value, reg);
++ rt2x00_set_chip_rf(rt2x00dev, value, reg);
+
+ if (!rt2x00_rf(&rt2x00dev->chip, RF2420) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2421)) {
+--- a/drivers/net/wireless/rt2x00/rt2500pci.c
++++ b/drivers/net/wireless/rt2x00/rt2500pci.c
+@@ -1525,7 +1525,7 @@ static int rt2500pci_init_eeprom(struct
+ */
+ value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
+ rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
+- rt2x00_set_chip(rt2x00dev, RT2560, value, reg);
++ rt2x00_set_chip_rf(rt2x00dev, value, reg);
+
+ if (!rt2x00_rf(&rt2x00dev->chip, RF2522) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2523) &&
+--- a/drivers/net/wireless/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/rt2x00/rt2x00.h
+@@ -672,6 +672,12 @@ struct rt2x00_dev {
+ unsigned long flags;
+
+ /*
++ * Device information, Bus IRQ and name (PCI, SoC)
++ */
++ int irq;
++ const char *name;
++
++ /*
+ * Chipset identification.
+ */
+ struct rt2x00_chip chip;
+@@ -860,6 +866,18 @@ static inline void rt2x00_set_chip(struc
+ rt2x00dev->chip.rev = rev;
+ }
+
++static inline void rt2x00_set_chip_rt(struct rt2x00_dev *rt2x00dev,
++ const u16 rt)
++{
++ rt2x00dev->chip.rt = rt;
++}
++
++static inline void rt2x00_set_chip_rf(struct rt2x00_dev *rt2x00dev,
++ const u16 rf, const u32 rev)
++{
++ rt2x00_set_chip(rt2x00dev, rt2x00dev->chip.rt, rf, rev);
++}
++
+ static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip)
+ {
+ return (chipset->rt == chip);
+--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
++++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
+@@ -170,7 +170,6 @@ static void rt2x00pci_free_queue_dma(str
+
+ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)
+ {
+- struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev);
+ struct data_queue *queue;
+ int status;
+
+@@ -186,11 +185,11 @@ int rt2x00pci_initialize(struct rt2x00_d
+ /*
+ * Register interrupt handler.
+ */
+- status = request_irq(pci_dev->irq, rt2x00dev->ops->lib->irq_handler,
+- IRQF_SHARED, pci_name(pci_dev), rt2x00dev);
++ status = request_irq(rt2x00dev->irq, rt2x00dev->ops->lib->irq_handler,
++ IRQF_SHARED, rt2x00dev->name, rt2x00dev);
+ if (status) {
+ ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n",
+- pci_dev->irq, status);
++ rt2x00dev->irq, status);
+ goto exit;
+ }
+
+@@ -270,6 +269,7 @@ int rt2x00pci_probe(struct pci_dev *pci_
+ struct ieee80211_hw *hw;
+ struct rt2x00_dev *rt2x00dev;
+ int retval;
++ u16 chip;
+
+ retval = pci_request_regions(pci_dev, pci_name(pci_dev));
+ if (retval) {
+@@ -307,6 +307,14 @@ int rt2x00pci_probe(struct pci_dev *pci_
+ rt2x00dev->dev = &pci_dev->dev;
+ rt2x00dev->ops = ops;
+ rt2x00dev->hw = hw;
++ rt2x00dev->irq = pci_dev->irq;
++ rt2x00dev->name = pci_name(pci_dev);
++
++ /*
++ * Determine RT chipset by reading PCI header.
++ */
++ pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip);
++ rt2x00_set_chip_rt(rt2x00dev, chip);
+
+ retval = rt2x00pci_alloc_reg(rt2x00dev);
+ if (retval)
+--- a/drivers/net/wireless/rt2x00/rt61pci.c
++++ b/drivers/net/wireless/rt2x00/rt61pci.c
+@@ -2308,7 +2308,6 @@ static int rt61pci_init_eeprom(struct rt
+ u32 reg;
+ u16 value;
+ u16 eeprom;
+- u16 device;
+
+ /*
+ * Read EEPROM word for configuration.
+@@ -2317,14 +2316,10 @@ static int rt61pci_init_eeprom(struct rt
+
+ /*
+ * Identify RF chipset.
+- * To determine the RT chip we have to read the
+- * PCI header of the device.
+ */
+- pci_read_config_word(to_pci_dev(rt2x00dev->dev),
+- PCI_CONFIG_HEADER_DEVICE, &device);
+ value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
+ rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
+- rt2x00_set_chip(rt2x00dev, device, value, reg);
++ rt2x00_set_chip_rf(rt2x00dev, value, reg);
+
+ if (!rt2x00_rf(&rt2x00dev->chip, RF5225) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF5325) &&