From 3ded580cd6f24776395649b301857d075a5121fb Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 10:45:00 +0100
-Subject: [PATCH 01/11] ath9k: convert to struct device
+Subject: [PATCH v2 01/11] ath9k: convert to struct device
Convert 'struct pci_dev' to 'struct device' to make it usable on the AHB
bus as well.
From 57b901b5ceb401006a278bc1ad224f0ac88d4f08 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 10:50:30 +0100
-Subject: [PATCH 02/11] ath9k: convert to use bus-agnostic DMA routines
+Subject: [PATCH v2 02/11] ath9k: convert to use bus-agnostic DMA routines
Convert to use bus-agnostic DMA routines to make it usable on AHB bus as well.
From 1306e6b6d72b2bc0b91bcdd15b1d982965210bda Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 10:57:42 +0100
-Subject: [PATCH 03/11] ath9k: introduce bus specific cache size routine
+Subject: [PATCH v2 03/11] ath9k: introduce bus specific cache size routine
The PCI specific bus_read_cachesize routine won't work on the AHB bus,
we have to replace it with a suitable one later.
-From 4167fb37cceda6a5ebfbfc4431abc69a1857ce43 Mon Sep 17 00:00:00 2001
+From 7524b77fe24a4464b08a2ac987ec22711a4f2027 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 10:59:29 +0100
-Subject: [PATCH 04/11] ath9k: introduce bus specific cleanup routine
+Subject: [PATCH v2 04/11] ath9k: introduce bus specific cleanup routine
We have left only some PCI specific cleanup code. We have to convert
them as well.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
---
- drivers/net/wireless/ath9k/core.h | 6 ++++++
- drivers/net/wireless/ath9k/main.c | 30 ++++++++++++++++--------------
- 2 files changed, 22 insertions(+), 14 deletions(-)
+ drivers/net/wireless/ath9k/core.h | 7 +++++++
+ drivers/net/wireless/ath9k/main.c | 37 +++++++++++++++++++++++--------------
+ 2 files changed, 30 insertions(+), 14 deletions(-)
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
};
struct ath_softc {
-@@ -760,4 +761,9 @@ static inline void ath_read_cachesize(st
+@@ -704,6 +705,7 @@ struct ath_softc {
+ struct tasklet_struct bcon_tasklet;
+ struct ath_hal *sc_ah;
+ void __iomem *mem;
++ int irq;
+ spinlock_t sc_resetlock;
+ struct mutex mutex;
+
+@@ -760,4 +762,9 @@ static inline void ath_read_cachesize(st
sc->bus_ops->read_cachesize(sc, csz);
}
#endif /* CORE_H */
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
-@@ -1267,13 +1267,7 @@ static int ath_start_rfkill_poll(struct
+@@ -39,6 +39,7 @@ static struct pci_device_id ath_pci_id_t
+ };
+
+ static void ath_detach(struct ath_softc *sc);
++static void ath_cleanup(struct ath_softc *sc);
+
+ /* return bus cachesize in 4B word units */
+
+@@ -1267,13 +1268,7 @@ static int ath_start_rfkill_poll(struct
rfkill_free(sc->rf_kill.rfkill);
/* Deinitialize the device */
- pci_release_region(to_pci_dev(sc->dev), 0);
- pci_disable_device(to_pci_dev(sc->dev));
- ieee80211_free_hw(sc->hw);
-+ ath_bus_cleanup(sc);
++ ath_cleanup(sc);
return -EIO;
} else {
sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
-@@ -2529,8 +2523,22 @@ ath_rf_name(u16 rf_version)
+@@ -1284,6 +1279,14 @@ static int ath_start_rfkill_poll(struct
+ }
+ #endif /* CONFIG_RFKILL */
+
++static void ath_cleanup(struct ath_softc *sc)
++{
++ ath_detach(sc);
++ free_irq(sc->irq, sc);
++ ath_bus_cleanup(sc);
++ ieee80211_free_hw(sc->hw);
++}
++
+ static void ath_detach(struct ath_softc *sc)
+ {
+ struct ieee80211_hw *hw = sc->hw;
+@@ -2529,8 +2532,18 @@ ath_rf_name(u16 rf_version)
return "????";
}
+{
+ struct pci_dev *pdev = to_pci_dev(sc->dev);
+
-+ ath_detach(sc);
-+ if (pdev->irq)
-+ free_irq(pdev->irq, sc);
+ pci_iounmap(pdev, sc->mem);
+ pci_release_region(pdev, 0);
+ pci_disable_device(pdev);
-+ ieee80211_free_hw(sc->hw);
+}
+
static struct ath_bus_ops ath_pci_bus_ops = {
};
static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-@@ -2667,13 +2675,7 @@ static void ath_pci_remove(struct pci_de
+@@ -2637,6 +2650,8 @@ static int ath_pci_probe(struct pci_dev
+ goto bad4;
+ }
+
++ sc->irq = pdev->irq;
++
+ ah = sc->sc_ah;
+ printk(KERN_INFO
+ "%s: Atheros AR%s MAC/BB Rev:%x "
+@@ -2667,13 +2682,7 @@ static void ath_pci_remove(struct pci_de
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath_softc *sc = hw->priv;
- pci_release_region(pdev, 0);
- pci_disable_device(pdev);
- ieee80211_free_hw(hw);
-+ ath_pci_cleanup(sc);
++ ath_cleanup(sc);
}
#ifdef CONFIG_PM
-From d95e670cd1395ffd8410bed809b6d060f2183d6b Mon Sep 17 00:00:00 2001
+From 39c2811d18b39991f49c16dcd9ed1a81200371ad Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 11:01:09 +0100
-Subject: [PATCH 05/11] ath9k: move PCI code into separate file
+Subject: [PATCH v2 05/11] ath9k: move PCI code into separate file
Now that we have converted all bus specific routines to replaceable, we
can move the PCI specific codes into a separate file.
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
---
drivers/net/wireless/ath9k/Makefile | 1 +
- drivers/net/wireless/ath9k/core.h | 18 ++-
- drivers/net/wireless/ath9k/main.c | 299 +++--------------------------------
- drivers/net/wireless/ath9k/pci.c | 289 +++++++++++++++++++++++++++++++++
+ drivers/net/wireless/ath9k/core.h | 19 ++-
+ drivers/net/wireless/ath9k/main.c | 300 +++--------------------------------
+ drivers/net/wireless/ath9k/pci.c | 287 +++++++++++++++++++++++++++++++++
4 files changed, 328 insertions(+), 279 deletions(-)
--- a/drivers/net/wireless/ath9k/Makefile
#include <net/mac80211.h>
#include <linux/leds.h>
#include <linux/rfkill.h>
-@@ -766,4 +766,20 @@ static inline void ath_bus_cleanup(struc
+@@ -767,4 +767,21 @@ static inline void ath_bus_cleanup(struc
sc->bus_ops->cleanup(sc);
}
+extern struct ieee80211_ops ath9k_ops;
+
+irqreturn_t ath_isr(int irq, void *dev);
++void ath_cleanup(struct ath_softc *sc);
+int ath_attach(u16 devid, struct ath_softc *sc);
+void ath_detach(struct ath_softc *sc);
+const char *ath_mac_bb_name(u32 mac_bb_version);
#endif /* CORE_H */
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
-@@ -28,38 +28,6 @@ MODULE_DESCRIPTION("Support for Atheros
+@@ -28,39 +28,6 @@ MODULE_DESCRIPTION("Support for Atheros
MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
MODULE_LICENSE("Dual BSD/GPL");
-};
-
-static void ath_detach(struct ath_softc *sc);
+-static void ath_cleanup(struct ath_softc *sc);
-
-/* return bus cachesize in 4B word units */
-
static void ath_cache_conf_rate(struct ath_softc *sc,
struct ieee80211_conf *conf)
{
-@@ -497,7 +465,7 @@ static void ath9k_tasklet(unsigned long
+@@ -498,7 +465,7 @@ static void ath9k_tasklet(unsigned long
ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_imask);
}
{
struct ath_softc *sc = dev;
struct ath_hal *ah = sc->sc_ah;
-@@ -1278,7 +1246,7 @@ static int ath_start_rfkill_poll(struct
+@@ -1279,7 +1246,7 @@ static int ath_start_rfkill_poll(struct
}
#endif /* CONFIG_RFKILL */
+-static void ath_cleanup(struct ath_softc *sc)
++void ath_cleanup(struct ath_softc *sc)
+ {
+ ath_detach(sc);
+ free_irq(sc->irq, sc);
+@@ -1287,7 +1254,7 @@ static void ath_cleanup(struct ath_softc
+ ieee80211_free_hw(sc->hw);
+ }
+
-static void ath_detach(struct ath_softc *sc)
+void ath_detach(struct ath_softc *sc)
{
struct ieee80211_hw *hw = sc->hw;
int i = 0;
-@@ -1529,7 +1497,7 @@ bad:
+@@ -1538,7 +1505,7 @@ bad:
return error;
}
{
struct ieee80211_hw *hw = sc->hw;
int error = 0;
-@@ -2448,7 +2416,7 @@ static int ath9k_ampdu_action(struct iee
+@@ -2457,7 +2424,7 @@ static int ath9k_ampdu_action(struct iee
return ret;
}
.tx = ath9k_tx,
.start = ath9k_start,
.stop = ath9k_stop,
-@@ -2492,7 +2460,7 @@ static struct {
+@@ -2501,7 +2468,7 @@ static struct {
/*
* Return the MAC/BB name. "????" is returned if the MAC/BB is unknown.
*/
ath_mac_bb_name(u32 mac_bb_version)
{
int i;
-@@ -2509,7 +2477,7 @@ ath_mac_bb_name(u32 mac_bb_version)
+@@ -2518,7 +2485,7 @@ ath_mac_bb_name(u32 mac_bb_version)
/*
* Return the RF name. "????" is returned if the RF is unknown.
*/
ath_rf_name(u16 rf_version)
{
int i;
-@@ -2523,236 +2491,7 @@ ath_rf_name(u16 rf_version)
+@@ -2532,234 +2499,7 @@ ath_rf_name(u16 rf_version)
return "????";
}
-{
- struct pci_dev *pdev = to_pci_dev(sc->dev);
-
-- ath_detach(sc);
-- if (pdev->irq)
-- free_irq(pdev->irq, sc);
- pci_iounmap(pdev, sc->mem);
- pci_release_region(pdev, 0);
- pci_disable_device(pdev);
-- ieee80211_free_hw(sc->hw);
-}
-
-static struct ath_bus_ops ath_pci_bus_ops = {
- goto bad4;
- }
-
+- sc->irq = pdev->irq;
+-
- ah = sc->sc_ah;
- printk(KERN_INFO
- "%s: Atheros AR%s MAC/BB Rev:%x "
- struct ieee80211_hw *hw = pci_get_drvdata(pdev);
- struct ath_softc *sc = hw->priv;
-
-- ath_pci_cleanup(sc);
+- ath_cleanup(sc);
-}
-
-#ifdef CONFIG_PM
{
int error;
-@@ -2764,26 +2503,30 @@ static int __init init_ath_pci(void)
+@@ -2771,26 +2511,30 @@ static int __init init_ath_pci(void)
printk(KERN_ERR
"Unable to register rate control algorithm: %d\n",
error);
+module_exit(ath9k_exit);
--- /dev/null
+++ b/drivers/net/wireless/ath9k/pci.c
-@@ -0,0 +1,289 @@
+@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+{
+ struct pci_dev *pdev = to_pci_dev(sc->dev);
+
-+ ath_detach(sc);
-+ if (pdev->irq)
-+ free_irq(pdev->irq, sc);
+ pci_iounmap(pdev, sc->mem);
+ pci_release_region(pdev, 0);
+ pci_disable_device(pdev);
-+ ieee80211_free_hw(sc->hw);
+}
+
+static struct ath_bus_ops ath_pci_bus_ops = {
+ goto bad4;
+ }
+
++ sc->irq = pdev->irq;
++
+ ah = sc->sc_ah;
+ printk(KERN_INFO
+ "%s: Atheros AR%s MAC/BB Rev:%x "
+ struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+ struct ath_softc *sc = hw->priv;
+
-+ ath_pci_cleanup(sc);
++ ath_cleanup(sc);
+}
+
+#ifdef CONFIG_PM
-From 9b3c1b50a35455e28c5b2fede615a304df42e758 Mon Sep 17 00:00:00 2001
+From ace011bdb2676f594824c81a5a5b5089dc0c3e0b Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 11:03:17 +0100
-Subject: [PATCH 06/11] ath9k: introduce platform driver for AHB bus support
+Subject: [PATCH v2 06/11] ath9k: introduce platform driver for AHB bus support
This patch adds the platform_driver itself, and modifies the main driver
to register it.
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
---
drivers/net/wireless/ath9k/Makefile | 1 +
- drivers/net/wireless/ath9k/ahb.c | 179 +++++++++++++++++++++++++++++++++++
- drivers/net/wireless/ath9k/core.h | 9 ++
+ drivers/net/wireless/ath9k/ahb.c | 160 +++++++++++++++++++++++++++++++++++
+ drivers/net/wireless/ath9k/core.h | 8 ++
drivers/net/wireless/ath9k/main.c | 10 ++
- 4 files changed, 199 insertions(+), 0 deletions(-)
+ 4 files changed, 179 insertions(+), 0 deletions(-)
--- a/drivers/net/wireless/ath9k/Makefile
+++ b/drivers/net/wireless/ath9k/Makefile
obj-$(CONFIG_ATH9K) += ath9k.o
--- /dev/null
+++ b/drivers/net/wireless/ath9k/ahb.c
-@@ -0,0 +1,179 @@
+@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
+
+static void ath_ahb_cleanup(struct ath_softc *sc)
+{
-+ struct ieee80211_hw *hw = sc->hw;
-+
-+ free_irq(sc->irq, sc);
-+
-+ ath_detach(sc);
+ iounmap(sc->mem);
-+ ieee80211_free_hw(hw);
+}
+
+static struct ath_bus_ops ath_ahb_bus_ops = {
+ goto err_iounmap;
+ }
+
-+ hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
-+ IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-+ IEEE80211_HW_SIGNAL_DBM |
-+ IEEE80211_HW_NOISE_DBM;
-+
-+ hw->wiphy->interface_modes =
-+ BIT(NL80211_IFTYPE_AP) |
-+ BIT(NL80211_IFTYPE_STATION) |
-+ BIT(NL80211_IFTYPE_ADHOC);
-+
+ SET_IEEE80211_DEV(hw, &pdev->dev);
+ platform_set_drvdata(pdev, hw);
+
+ if (hw) {
+ struct ath_softc *sc = hw->priv;
+
-+ free_irq(sc->irq, sc);
-+ ath_detach(sc);
-+ iounmap(sc->mem);
-+ ieee80211_free_hw(hw);
++ ath_cleanup(sc);
+ platform_set_drvdata(pdev, NULL);
+ }
+
+
+void ath_ahb_exit(void)
+{
-+ platform_driver_register(&ath_ahb_driver);
++ platform_driver_unregister(&ath_ahb_driver);
+}
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
-@@ -705,6 +705,7 @@ struct ath_softc {
- struct tasklet_struct bcon_tasklet;
- struct ath_hal *sc_ah;
- void __iomem *mem;
-+ int irq;
- spinlock_t sc_resetlock;
- struct mutex mutex;
-
-@@ -782,4 +783,12 @@ static inline int ath_pci_init(void) { r
+@@ -784,4 +784,12 @@ static inline int ath_pci_init(void) { r
static inline void ath_pci_exit(void) {};
#endif
#endif /* CORE_H */
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
-@@ -2514,8 +2514,17 @@ static int __init ath9k_init(void)
+@@ -2522,8 +2522,17 @@ static int __init ath9k_init(void)
goto err_rate_unregister;
}
err_rate_unregister:
ath_rate_control_unregister();
err_out:
-@@ -2525,6 +2534,7 @@ module_init(ath9k_init);
+@@ -2533,6 +2542,7 @@ module_init(ath9k_init);
static void __exit ath9k_exit(void)
{
-From d0d8545c85b03c2e7e3c9957a94d0d6fc8168bef Mon Sep 17 00:00:00 2001
+From 317e9ea5007e3ff18b52f973c1b3a3f2c84bcae1 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Jan 2009 11:05:05 +0100
-Subject: [PATCH 07/11] ath9k: get EEPROM contents from platform data on AHB bus
+Subject: [PATCH v2 07/11] ath9k: get EEPROM contents from platform data on AHB bus
On the AR913x SOCs we have to provide EEPROM contents via platform_data,
because accessing the flash via MMIO is not safe. Additionally different
#include "core.h"
#include "reg.h"
#include "hw.h"
-@@ -39,9 +40,29 @@ static void ath_ahb_cleanup(struct ath_s
- ieee80211_free_hw(hw);
+@@ -33,9 +34,29 @@ static void ath_ahb_cleanup(struct ath_s
+ iounmap(sc->mem);
}
+static bool ath_ahb_eeprom_read(struct ath_hal *ah, u32 off, u16 *data)
};
static int ath_ahb_probe(struct platform_device *pdev)
-@@ -54,6 +75,12 @@ static int ath_ahb_probe(struct platform
+@@ -48,6 +69,12 @@ static int ath_ahb_probe(struct platform
int ret = 0;
struct ath_hal *ah;
else
--- a/drivers/net/wireless/ath9k/pci.c
+++ b/drivers/net/wireless/ath9k/pci.c
-@@ -62,9 +62,27 @@ static void ath_pci_cleanup(struct ath_s
- ieee80211_free_hw(sc->hw);
+@@ -58,9 +58,27 @@ static void ath_pci_cleanup(struct ath_s
+ pci_disable_device(pdev);
}
+static bool ath_pci_eeprom_read(struct ath_hal *ah, u32 off, u16 *data)
+++ /dev/null
-From c09de7514f7020370e256d6739c1c27ecb356542 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Mon, 5 Jan 2009 11:10:28 +0100
-Subject: [PATCH 08/11] ath9k: enable support for AR9100
-
-Because we have support for the AR9100 devices now, we can enable them.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
----
- drivers/net/wireless/ath9k/hw.c | 3 +++
- 1 files changed, 3 insertions(+), 0 deletions(-)
-
---- a/drivers/net/wireless/ath9k/hw.c
-+++ b/drivers/net/wireless/ath9k/hw.c
-@@ -373,6 +373,8 @@ static const char *ath9k_hw_devname(u16
- return "Atheros 5418";
- case AR9160_DEVID_PCI:
- return "Atheros 9160";
-+ case AR5416_AR9100_DEVID:
-+ return "Atheros 9100";
- case AR9280_DEVID_PCI:
- case AR9280_DEVID_PCIE:
- return "Atheros 9280";
-@@ -1176,6 +1178,7 @@ struct ath_hal *ath9k_hw_attach(u16 devi
- switch (devid) {
- case AR5416_DEVID_PCI:
- case AR5416_DEVID_PCIE:
-+ case AR5416_AR9100_DEVID:
- case AR9160_DEVID_PCI:
- case AR9280_DEVID_PCI:
- case AR9280_DEVID_PCIE:
--- /dev/null
+From 891bd8d155bbdabac3c69486fc854984ee90761c Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Mon, 5 Jan 2009 11:11:28 +0100
+Subject: [PATCH v2 08/11] ath9k: remove (u16) casts from rtc register access
+
+The RTC register offsets don't fit into 'u16' on the AR913x, so we have
+to remove the existing casts.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+---
+ drivers/net/wireless/ath9k/hw.c | 14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/ath9k/hw.c
++++ b/drivers/net/wireless/ath9k/hw.c
+@@ -1008,7 +1008,7 @@ static void ath9k_hw_init_pll(struct ath
+ pll |= SM(0xb, AR_RTC_PLL_DIV);
+ }
+ }
+- REG_WRITE(ah, (u16) (AR_RTC_PLL_CONTROL), pll);
++ REG_WRITE(ah, (AR_RTC_PLL_CONTROL), pll);
+
+ udelay(RTC_PLL_SETTLE_DELAY);
+
+@@ -1547,11 +1547,11 @@ static bool ath9k_hw_set_reset(struct at
+ rst_flags |= AR_RTC_RC_MAC_COLD;
+ }
+
+- REG_WRITE(ah, (u16) (AR_RTC_RC), rst_flags);
++ REG_WRITE(ah, (AR_RTC_RC), rst_flags);
+ udelay(50);
+
+- REG_WRITE(ah, (u16) (AR_RTC_RC), 0);
+- if (!ath9k_hw_wait(ah, (u16) (AR_RTC_RC), AR_RTC_RC_M, 0)) {
++ REG_WRITE(ah, (AR_RTC_RC), 0);
++ if (!ath9k_hw_wait(ah, (AR_RTC_RC), AR_RTC_RC_M, 0)) {
+ DPRINTF(ah->ah_sc, ATH_DBG_RESET,
+ "RTC stuck in MAC reset\n");
+ return false;
+@@ -1573,8 +1573,8 @@ static bool ath9k_hw_set_reset_power_on(
+ REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN |
+ AR_RTC_FORCE_WAKE_ON_INT);
+
+- REG_WRITE(ah, (u16) (AR_RTC_RESET), 0);
+- REG_WRITE(ah, (u16) (AR_RTC_RESET), 1);
++ REG_WRITE(ah, (AR_RTC_RESET), 0);
++ REG_WRITE(ah, (AR_RTC_RESET), 1);
+
+ if (!ath9k_hw_wait(ah,
+ AR_RTC_STATUS,
+@@ -2599,7 +2599,7 @@ static void ath9k_set_power_sleep(struct
+ if (!AR_SREV_9100(ah))
+ REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF);
+
+- REG_CLR_BIT(ah, (u16) (AR_RTC_RESET),
++ REG_CLR_BIT(ah, (AR_RTC_RESET),
+ AR_RTC_RESET_EN);
+ }
+ }
--- /dev/null
+From d1550cd72b9bddd43a355229aaa330b54c28d92e Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Mon, 5 Jan 2009 11:13:04 +0100
+Subject: [PATCH v2 09/11] ath9k: fix ar5416Addac_9100 values
+
+Writing the register at offset 0x98c4 causes a deadlock on the AR913x
+SoCs. Although i don't have detailed knowledge about these registers,
+but if i change the register offset according to the 'ar5416Addac' table,
+it works. Additionally there is no reference to the 0x98c4 elsewhere.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+---
+ drivers/net/wireless/ath9k/initvals.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+--- a/drivers/net/wireless/ath9k/initvals.h
++++ b/drivers/net/wireless/ath9k/initvals.h
+@@ -658,7 +658,7 @@ static const u32 ar5416Addac_9100[][2] =
+ {0x0000989c, 0x00000000 },
+ {0x0000989c, 0x00000000 },
+ {0x0000989c, 0x00000000 },
+- {0x000098c4, 0x00000000 },
++ {0x000098cc, 0x00000000 },
+ };
+
+ static const u32 ar5416Modes[][6] = {
+++ /dev/null
-From 491719852fb049d0a65dc05550b645b62d799453 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Mon, 5 Jan 2009 11:11:28 +0100
-Subject: [PATCH 09/11] ath9k: remove (u16) casts from rtc register access
-
-The RTC register offsets don't fit into 'u16' on the AR913x, so we have
-to remove the existing casts.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
----
- drivers/net/wireless/ath9k/hw.c | 14 +++++++-------
- 1 files changed, 7 insertions(+), 7 deletions(-)
-
---- a/drivers/net/wireless/ath9k/hw.c
-+++ b/drivers/net/wireless/ath9k/hw.c
-@@ -1010,7 +1010,7 @@ static void ath9k_hw_init_pll(struct ath
- pll |= SM(0xb, AR_RTC_PLL_DIV);
- }
- }
-- REG_WRITE(ah, (u16) (AR_RTC_PLL_CONTROL), pll);
-+ REG_WRITE(ah, (AR_RTC_PLL_CONTROL), pll);
-
- udelay(RTC_PLL_SETTLE_DELAY);
-
-@@ -1550,11 +1550,11 @@ static bool ath9k_hw_set_reset(struct at
- rst_flags |= AR_RTC_RC_MAC_COLD;
- }
-
-- REG_WRITE(ah, (u16) (AR_RTC_RC), rst_flags);
-+ REG_WRITE(ah, (AR_RTC_RC), rst_flags);
- udelay(50);
-
-- REG_WRITE(ah, (u16) (AR_RTC_RC), 0);
-- if (!ath9k_hw_wait(ah, (u16) (AR_RTC_RC), AR_RTC_RC_M, 0)) {
-+ REG_WRITE(ah, (AR_RTC_RC), 0);
-+ if (!ath9k_hw_wait(ah, (AR_RTC_RC), AR_RTC_RC_M, 0)) {
- DPRINTF(ah->ah_sc, ATH_DBG_RESET,
- "RTC stuck in MAC reset\n");
- return false;
-@@ -1576,8 +1576,8 @@ static bool ath9k_hw_set_reset_power_on(
- REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN |
- AR_RTC_FORCE_WAKE_ON_INT);
-
-- REG_WRITE(ah, (u16) (AR_RTC_RESET), 0);
-- REG_WRITE(ah, (u16) (AR_RTC_RESET), 1);
-+ REG_WRITE(ah, (AR_RTC_RESET), 0);
-+ REG_WRITE(ah, (AR_RTC_RESET), 1);
-
- if (!ath9k_hw_wait(ah,
- AR_RTC_STATUS,
-@@ -2602,7 +2602,7 @@ static void ath9k_set_power_sleep(struct
- if (!AR_SREV_9100(ah))
- REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF);
-
-- REG_CLR_BIT(ah, (u16) (AR_RTC_RESET),
-+ REG_CLR_BIT(ah, (AR_RTC_RESET),
- AR_RTC_RESET_EN);
- }
- }
+++ /dev/null
-From 2084ddcc2e2e85d10b210202d8368126b0beaddd Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Mon, 5 Jan 2009 11:13:04 +0100
-Subject: [PATCH 10/11] ath9k: fix ar5416Addac_9100 values
-
-Writing the register at offset 0x98c4 causes a deadlock on the AR913x
-SoCs. Although i don't have detailed knowledge about these registers,
-but if i change the register offset according to the 'ar5416Addac' table,
-it works. Additionally there is no reference to the 0x98c4 elsewhere.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
----
- drivers/net/wireless/ath9k/initvals.h | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/ath9k/initvals.h
-+++ b/drivers/net/wireless/ath9k/initvals.h
-@@ -658,7 +658,7 @@ static const u32 ar5416Addac_9100[][2] =
- {0x0000989c, 0x00000000 },
- {0x0000989c, 0x00000000 },
- {0x0000989c, 0x00000000 },
-- {0x000098c4, 0x00000000 },
-+ {0x000098cc, 0x00000000 },
- };
-
- static const u32 ar5416Modes[][6] = {
--- /dev/null
+From a6411f449091c272ca08146238b91a0835306179 Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Mon, 5 Jan 2009 11:14:14 +0100
+Subject: [PATCH v2 10/11] ath9k: fix null pointer dereference in ani monitor code
+
+In 'ath9k_ani_reset' the 'ahp->ah_curani' will be initialized only
+if 'DO_ANI(ah)' true. In 'ath9k_hw_ani_monitor' we are using
+'ahp->ah_curani' unconditionally, and it will cause a NULL pointer
+dereference on AR9100.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+---
+ drivers/net/wireless/ath9k/ani.c | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/ath9k/ani.c
++++ b/drivers/net/wireless/ath9k/ani.c
+@@ -551,6 +551,9 @@ void ath9k_hw_ani_monitor(struct ath_hal
+ struct ar5416AniState *aniState;
+ int32_t listenTime;
+
++ if (!DO_ANI(ah))
++ return;
++
+ aniState = ahp->ah_curani;
+ ahp->ah_stats.ast_nodestats = *stats;
+
+@@ -610,9 +613,6 @@ void ath9k_hw_ani_monitor(struct ath_hal
+ aniState->cckPhyErrCount = cckPhyErrCnt;
+ }
+
+- if (!DO_ANI(ah))
+- return;
+-
+ if (aniState->listenTime > 5 * ahp->ah_aniPeriod) {
+ if (aniState->ofdmPhyErrCount <= aniState->listenTime *
+ aniState->ofdmTrigLow / 1000 &&
--- /dev/null
+From c4568c6e2a62a95c95c7875643a64a19bc8c1a2f Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Mon, 5 Jan 2009 11:10:28 +0100
+Subject: [PATCH v2 11/11] ath9k: enable support for AR9100
+
+Because we have support for the AR9100 devices now, we can enable them.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+---
+ drivers/net/wireless/ath9k/hw.c | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/ath9k/hw.c
++++ b/drivers/net/wireless/ath9k/hw.c
+@@ -373,6 +373,8 @@ static const char *ath9k_hw_devname(u16
+ return "Atheros 5418";
+ case AR9160_DEVID_PCI:
+ return "Atheros 9160";
++ case AR5416_AR9100_DEVID:
++ return "Atheros 9100";
+ case AR9280_DEVID_PCI:
+ case AR9280_DEVID_PCIE:
+ return "Atheros 9280";
+@@ -1176,6 +1178,7 @@ struct ath_hal *ath9k_hw_attach(u16 devi
+ switch (devid) {
+ case AR5416_DEVID_PCI:
+ case AR5416_DEVID_PCIE:
++ case AR5416_AR9100_DEVID:
+ case AR9160_DEVID_PCI:
+ case AR9280_DEVID_PCI:
+ case AR9280_DEVID_PCIE:
+++ /dev/null
-From 7b647404fb694f250b62a2a363b1298243ea403b Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Mon, 5 Jan 2009 11:14:14 +0100
-Subject: [PATCH 11/11] ath9k: fix null pointer dereference in ani monitor code
-
-In 'ath9k_ani_reset' the 'ahp->ah_curani' will be initialized only
-if 'DO_ANI(ah)' true. In 'ath9k_hw_ani_monitor' we are using
-'ahp->ah_curani' unconditionally, and it will cause a NULL pointer
-dereference on AR9100.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
----
- drivers/net/wireless/ath9k/ani.c | 6 +++---
- 1 files changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ath9k/ani.c
-+++ b/drivers/net/wireless/ath9k/ani.c
-@@ -551,6 +551,9 @@ void ath9k_hw_ani_monitor(struct ath_hal
- struct ar5416AniState *aniState;
- int32_t listenTime;
-
-+ if (!DO_ANI(ah))
-+ return;
-+
- aniState = ahp->ah_curani;
- ahp->ah_stats.ast_nodestats = *stats;
-
-@@ -610,9 +613,6 @@ void ath9k_hw_ani_monitor(struct ath_hal
- aniState->cckPhyErrCount = cckPhyErrCnt;
- }
-
-- if (!DO_ANI(ah))
-- return;
--
- if (aniState->listenTime > 5 * ahp->ah_aniPeriod) {
- if (aniState->ofdmPhyErrCount <= aniState->listenTime *
- aniState->ofdmTrigLow / 1000 &&