[package] mac80211: update ath9k patches
[openwrt.git] / package / mac80211 / patches / 403-ath9k-introduce-bus-specific-cache-size-routine.patch
1 From b9aae7ff9c6ca6864434882cce9c9c6fea88220b Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 5 Jan 2009 10:57:42 +0100
4 Subject: [PATCH v3 03/11] ath9k: introduce bus specific cache size routine
5
6 The PCI specific bus_read_cachesize routine won't work on the AHB bus,
7 we have to replace it with a suitable one later.
8
9 Changes-licensed-under: ISC
10
11 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
12 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
13 ---
14  drivers/net/wireless/ath9k/core.h |   10 ++++++++++
15  drivers/net/wireless/ath9k/main.c |    9 +++++++--
16  2 files changed, 17 insertions(+), 2 deletions(-)
17
18 --- a/drivers/net/wireless/ath9k/core.h
19 +++ b/drivers/net/wireless/ath9k/core.h
20 @@ -693,6 +693,10 @@ enum PROT_MODE {
21  #define SC_OP_RFKILL_SW_BLOCKED        BIT(12)
22  #define SC_OP_RFKILL_HW_BLOCKED        BIT(13)
23  
24 +struct ath_bus_ops {
25 +       void            (*read_cachesize)(struct ath_softc *sc, int *csz);
26 +};
27 +
28  struct ath_softc {
29         struct ieee80211_hw *hw;
30         struct device *dev;
31 @@ -743,6 +747,7 @@ struct ath_softc {
32  #ifdef CONFIG_ATH9K_DEBUG
33         struct ath9k_debug sc_debug;
34  #endif
35 +       struct ath_bus_ops *bus_ops;
36  };
37  
38  int ath_reset(struct ath_softc *sc, bool retry_tx);
39 @@ -750,4 +755,9 @@ int ath_get_hal_qnum(u16 queue, struct a
40  int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
41  int ath_cabq_update(struct ath_softc *);
42  
43 +static inline void ath_read_cachesize(struct ath_softc *sc, int *csz)
44 +{
45 +       sc->bus_ops->read_cachesize(sc, csz);
46 +}
47 +
48  #endif /* CORE_H */
49 --- a/drivers/net/wireless/ath9k/main.c
50 +++ b/drivers/net/wireless/ath9k/main.c
51 @@ -42,7 +42,7 @@ static void ath_detach(struct ath_softc 
52  
53  /* return bus cachesize in 4B word units */
54  
55 -static void bus_read_cachesize(struct ath_softc *sc, int *csz)
56 +static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz)
57  {
58         u8 u8tmp;
59  
60 @@ -1340,7 +1340,7 @@ static int ath_init(u16 devid, struct at
61          * Cache line size is used to size and align various
62          * structures used to communicate with the hardware.
63          */
64 -       bus_read_cachesize(sc, &csz);
65 +       ath_read_cachesize(sc, &csz);
66         /* XXX assert csz is non-zero */
67         sc->sc_cachelsz = csz << 2;     /* convert to bytes */
68  
69 @@ -2538,6 +2538,10 @@ ath_rf_name(u16 rf_version)
70         return "????";
71  }
72  
73 +static struct ath_bus_ops ath_pci_bus_ops = {
74 +       .read_cachesize = ath_pci_read_cachesize,
75 +};
76 +
77  static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
78  {
79         void __iomem *mem;
80 @@ -2626,6 +2630,7 @@ static int ath_pci_probe(struct pci_dev 
81         sc->hw = hw;
82         sc->dev = &pdev->dev;
83         sc->mem = mem;
84 +       sc->bus_ops = &ath_pci_bus_ops;
85  
86         if (ath_attach(id->device, sc) != 0) {
87                 ret = -ENODEV;