atheros: implement common read/write ops
Subsystems (3)
v2 cover atheros: implement common read/write ops
This is a respin on my fourth series. We leave ath5k as is and only use the common read/write ops for it for shared hw code. ath9k however does need to use the common ops as we need to make read/write code driver core independent to share with ath9k_htc, even before its moved into ath hw common code.
Other changes worth noting are the order of the write op arguments to coincide more with more kernel code.
Luis R. Rodriguez (4):
atheros/ath9k: add common read/write ops and port ath9k to use it
ath5k: allocate ath5k_hw prior to initializing hw
ath5k: define ath_common ops
atheros: define shared bssidmask setting
drivers/net/wireless/ath/Makefile | 5 +- drivers/net/wireless/ath/ath.h | 9 ++ drivers/net/wireless/ath/ath5k/ath5k.h | 20 +++-- drivers/net/wireless/ath/ath5k/attach.c | 25 +----- drivers/net/wireless/ath/ath5k/base.c | 38 ++++++++- drivers/net/wireless/ath/ath5k/base.h | 11 --- drivers/net/wireless/ath/ath5k/initvals.c | 4 +- drivers/net/wireless/ath/ath5k/pcu.c | 121 ++-------------------------- drivers/net/wireless/ath/ath5k/reg.h | 8 +-- drivers/net/wireless/ath/ath9k/ath9k.h | 13 --- drivers/net/wireless/ath/ath9k/hw.c | 42 +--------- drivers/net/wireless/ath/ath9k/hw.h | 17 ++++- drivers/net/wireless/ath/ath9k/main.c | 43 ++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 2 +- drivers/net/wireless/ath/ath9k/reg.h | 5 +- drivers/net/wireless/ath/ath9k/virtual.c | 2 +- drivers/net/wireless/ath/hw.c | 126 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/reg.h | 27 ++++++ 18 files changed, 290 insertions(+), 228 deletions(-) create mode 100644 drivers/net/wireless/ath/hw.c create mode 100644 drivers/net/wireless/ath/reg.h
PATCH v2 1/4 atheros/ath9k: add common read/write ops and port ath9k to use it
In an effort to make hw code driver core agnostic read and write operations are defined on the ath_common structure. This patch adds that and makes ath9k use it. This allows drivers like ath9k_htc to define its own read/write ops and still rely on the same hw code. This also paves the way for sharing code between ath9k/ath5k/ath9k_htc.
--- drivers/net/wireless/ath/ath.h | 6 ++++ drivers/net/wireless/ath/ath9k/ath9k.h | 13 ---------- drivers/net/wireless/ath/ath9k/hw.c | 32 ------------------------ drivers/net/wireless/ath/ath9k/hw.h | 17 +++++++++++- drivers/net/wireless/ath/ath9k/main.c | 42 ++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 47 deletions(-)
drivers/net/wireless/ath/ath.h +6 -0
@@ -39,6 +39,11 @@ struct ath_regulatory {struct reg_dmn_pair_mapping *regpair; }; +struct ath_ops { +unsigned int (*read)(void *,u32 reg_offset); +void (*write)(void *,u32 val,u32 reg_offset); +}; +struct ath_common {u16 cachelsz;u16 curaid;
@@ -46,6 +51,7 @@ struct ath_common {u8 curbssid[ETH_ALEN ];u8 bssidmask[ETH_ALEN ];struct ath_regulatory regulatory; +struct ath_ops *ops; }; struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
drivers/net/wireless/ath/ath9k/ath9k.h +0 -13
@@ -646,16 +646,6 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);int ath_get_mac80211_qnum (u32 queue,struct ath_softc *sc);int ath_cabq_update (struct ath_softc *); -static inline struct ath_common *ath9k_hw_common (struct ath_hw *ah) -{ -return &ah->common; -} - -static inline struct ath_regulatory *ath9k_hw_regulatory (struct ath_hw *ah) -{ -return &(ath9k_hw_common (ah)->regulatory); -} -static inline void ath_read_cachesize (struct ath_softc *sc,int *csz) { sc->bus_ops->read_cachesize (sc, csz);
@@ -718,8 +708,5 @@ bool ath9k_wiphy_scanning(struct ath_softc *sc);void ath9k_wiphy_work (struct work_struct *work);bool ath9k_all_wiphys_idle (struct ath_softc *sc); -void ath9k_iowrite32 (struct ath_hw *ah,u32 reg_offset,u32 val); -unsigned int ath9k_ioread32 (struct ath_hw *ah,u32 reg_offset); -int ath_tx_get_qnum (struct ath_softc *sc,int qtype,int haltype);#endif /* ATH9K_H */
drivers/net/wireless/ath/ath9k/hw.c +0 -32
@@ -81,38 +81,6 @@ static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)return ath9k_hw_mac_clks (ah, usecs); } -/* -* Read and write, they both share the same lock. We do this to serialize -* reads and writes on Atheros 802.11n PCI devices only. This is required -* as the FIFO on these devices can only accept sanely 2 requests. After -* that the device goes bananas. Serializing the reads/writes prevents this -* from happening. -*/ - -void ath9k_iowrite32 (struct ath_hw *ah,u32 reg_offset,u32 val) -{ -if (ah->config.serialize_regmode ==SER_REG_MODE_ON ) { -unsigned long flags; -spin_lock_irqsave (&ah->ah_sc->sc_serial_rw, flags); -iowrite32 (val, ah->ah_sc->mem + reg_offset); -spin_unlock_irqrestore (&ah->ah_sc->sc_serial_rw, flags); - }else -iowrite32 (val, ah->ah_sc->mem + reg_offset); -} - -unsigned int ath9k_ioread32 (struct ath_hw *ah,u32 reg_offset) -{ -u32 val; -if (ah->config.serialize_regmode ==SER_REG_MODE_ON ) { -unsigned long flags; -spin_lock_irqsave (&ah->ah_sc->sc_serial_rw, flags); - val =ioread32 (ah->ah_sc->mem + reg_offset); -spin_unlock_irqrestore (&ah->ah_sc->sc_serial_rw, flags); - }else - val =ioread32 (ah->ah_sc->mem + reg_offset); -return val; -} -bool ath9k_hw_wait (struct ath_hw *ah,u32 reg,u32 mask,u32 val,u32 timeout) {int i;
drivers/net/wireless/ath/ath9k/hw.h +15 -2
@@ -51,8 +51,11 @@#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab/* Register read/write primitives */ -#define REG_WRITE (_ah, _reg, _val) ath9k_iowrite32((_ah), (_reg), (_val)) -#define REG_READ (_ah, _reg) ath9k_ioread32((_ah), (_reg)) +#define REG_WRITE (_ah, _reg, _val) \ + ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) + +#define REG_READ (_ah, _reg) \ + ath9k_hw_common(_ah)->ops->read((_ah), (_reg))#define SM (_v, _f) (((_v) << _f##_S) & _f)#define MS (_v, _f) (((_v) & _f) >> _f##_S)
@@ -588,6 +591,16 @@ struct ath_hw {struct ath_gen_timer_table hw_gen_timers; }; +static inline struct ath_common *ath9k_hw_common (struct ath_hw *ah) +{ +return &ah->common; +} + +static inline struct ath_regulatory *ath9k_hw_regulatory (struct ath_hw *ah) +{ +return &(ath9k_hw_common (ah)->regulatory); +} +/* Initialization, Detach, Reset */ const char *ath9k_hw_probe (u16 vendorid,u16 devid);void ath9k_hw_detach (struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/main.c +42 -0
54 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH v2 2/4 ath5k: allocate ath5k_hw prior to initializing hw
In reply to Luis R. RodriguezWe can propagate better errors upon failed hw initialization, and set up the ath_common structure for attach purposes. This will become important once we start using the ath_common for read/write ops.
--- drivers/net/wireless/ath/ath.h | 2 +- drivers/net/wireless/ath/ath5k/ath5k.h | 2 +- drivers/net/wireless/ath/ath5k/attach.c | 23 ++++------------------- drivers/net/wireless/ath/ath5k/base.c | 20 ++++++++++++++++---- 4 files changed, 22 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath.h +1 -1
@@ -51,7 +51,7 @@ struct ath_common {u8 curbssid[ETH_ALEN ];u8 bssidmask[ETH_ALEN ];struct ath_regulatory regulatory; -struct ath_ops *ops; +const struct ath_ops *ops; }; struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
drivers/net/wireless/ath/ath5k/ath5k.h +1 -1
@@ -1147,7 +1147,7 @@ struct ath5k_hw {*/ /* Attach/Detach Functions */ -extern struct ath5k_hw *ath5k_hw_attach (struct ath5k_softc *sc); +extern int ath5k_hw_attach (struct ath5k_softc *sc);extern void ath5k_hw_detach (struct ath5k_hw *ah);/* LED functions */
drivers/net/wireless/ath/ath5k/attach.c +4 -19
@@ -101,28 +101,15 @@ static int ath5k_hw_post(struct ath5k_hw *ah)* -ENODEV if the device is not supported or prints an error msg if something * else went wrong. */ -struct ath5k_hw *ath5k_hw_attach (struct ath5k_softc *sc) +int ath5k_hw_attach (struct ath5k_softc *sc) { -struct ath5k_hw *ah; +struct ath5k_hw *ah = sc->ah;struct ath_common *common;struct pci_dev *pdev = sc->pdev;struct ath5k_eeprom_info *ee;int ret;u32 srev; -/*If we passed the test malloc a ath5k_hw struct*/ - ah =kzalloc (sizeof (struct ath5k_hw ),GFP_KERNEL ); -if (ah ==NULL ) { - ret = -ENOMEM ; -ATH5K_ERR (sc,"out of memory\n" ); - goto err; - } - - ah->ah_sc = sc; - ah->ah_sc->ah = ah; - ah->ah_iobase = sc->iobase; - common =ath5k_hw_common (ah); -/* * HW information */
@@ -347,11 +334,10 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)/* turn on HW LEDs */ ath5k_hw_set_ledstate (ah,AR5K_LED_INIT ); -return ah; +return 0 ; err_free:kfree (ah); -err: -return ERR_PTR (ret); +return ret; }/**
@@ -371,5 +357,4 @@ void ath5k_hw_detach(struct ath5k_hw *ah)ath5k_eeprom_detach (ah);/* assume interrupts are down */ -kfree (ah); }
drivers/net/wireless/ath/ath5k/base.c +16 -4
@@ -565,16 +565,25 @@ ath5k_pci_probe(struct pci_dev *pdev, goto err_free; } -/* Initialize device */ - sc->ah =ath5k_hw_attach (sc); -if (IS_ERR (sc->ah)) { - ret =PTR_ERR (sc->ah); +/*If we passed the test malloc a ath5k_hw struct*/ + sc->ah =kzalloc (sizeof (struct ath5k_hw ),GFP_KERNEL ); +if (!sc->ah) { + ret = -ENOMEM ; +ATH5K_ERR (sc,"out of memory\n" ); goto err_irq; } + sc->ah->ah_sc = sc; + sc->ah->ah_iobase = sc->iobase; common =ath5k_hw_common (sc->ah); common->cachelsz = csz <<2 ;/* convert to bytes */ +/* Initialize device */ + ret =ath5k_hw_attach (sc); +if (ret) { + goto err_free_ah; + } +/* set up multi-rate retry capabilities */ if (sc->ah->ah_version ==AR5K_AR5212 ) { hw->max_rates =4 ;
@@ -643,6 +652,8 @@ err_ah:ath5k_hw_detach (sc->ah); err_irq:free_irq (pdev->irq, sc); +err_free_ah: +kfree (sc->ah); err_free:ieee80211_free_hw (hw); err_map:
@@ -664,6 +675,7 @@ ath5k_pci_remove(struct pci_dev *pdev)ath5k_debug_finish_device (sc);ath5k_detach (pdev, hw);ath5k_hw_detach (sc->ah); +kfree (sc->ah);free_irq (pdev->irq, sc);pci_iounmap (pdev, sc->iobase);pci_release_region (pdev,0 );
Signature · 1 line
1.6.3.3
PATCH v2 2/4 ath5k: allocate ath5k_hw prior to initializing hw
drivers/net/wireless/ath/ath.h struct ath_common { · line 54
Quoted 8 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath.h +1
-1@@ -51,7 +51,7 @@ struct ath_common {u8 curbssid[ETH_ALEN ];u8 bssidmask[ETH_ALEN ];struct ath_regulatory regulatory; -struct ath_ops *ops; +const struct ath_ops *ops;
If I'm looking correctly, this will emit a warning for ath9k.
PATCH v2 2/4 ath5k: allocate ath5k_hw prior to initializing hw
Quoted 11 lines · Jiri Slaby
drivers/net/wireless/ath/ath.h struct ath_common { · line 54
Quoted 8 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath.h +1
-1@@ -51,7 +51,7 @@ struct ath_common { ? ? ? u8 curbssid[ETH_ALEN]; ? ? ? u8 bssidmask[ETH_ALEN]; ? ? ? struct ath_regulatory regulatory; - ? ? struct ath_ops *ops; + ? ? const struct ath_ops *ops;If I'm looking correctly, this will emit a warning for ath9k.
Hm, I'm using C=1 when compiling and see no warnings even from sparse.
Luis
PATCH v2 2/4 ath5k: allocate ath5k_hw prior to initializing hw
Quoted 13 lines · Luis R. Rodriguez
Quoted 11 lines · Jiri Slaby
drivers/net/wireless/ath/ath.h struct ath_common { · line 54
Quoted 8 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath.h +1
-1@@ -51,7 +51,7 @@ struct ath_common { ? ? ? u8 curbssid[ETH_ALEN]; ? ? ? u8 bssidmask[ETH_ALEN]; ? ? ? struct ath_regulatory regulatory; - ? ? struct ath_ops *ops; + ? ? const struct ath_ops *ops;If I'm looking correctly, this will emit a warning for ath9k.
Quoted 1 line
Hm, I'm using C=1 when compiling and see no warnings even from sparse.
Well, as my tree is now, let me rebase and see how it was back then, I thought I tested compiled that patch.
Luis
PATCH v2 2/4 ath5k: allocate ath5k_hw prior to initializing hw
Quoted 15 lines · Luis R. Rodriguez
Quoted 13 lines · Luis R. Rodriguez
Quoted 11 lines · Jiri Slaby
drivers/net/wireless/ath/ath.h struct ath_common { · line 54
Quoted 8 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath.h +1
-1@@ -51,7 +51,7 @@ struct ath_common { ? ? ? u8 curbssid[ETH_ALEN]; ? ? ? u8 bssidmask[ETH_ALEN]; ? ? ? struct ath_regulatory regulatory; - ? ? struct ath_ops *ops; + ? ? const struct ath_ops *ops;If I'm looking correctly, this will emit a warning for ath9k.
Quoted 4 lines
Quoted 1 line
Hm, I'm using C=1 when compiling and see no warnings even from sparse.
Well, as my tree is now, let me rebase and see how it was back then, I thought I tested compiled that patch.
Yeah looks peachy.
Luis
PATCH v2 2/4 ath5k: allocate ath5k_hw prior to initializing hw
Quoted 1 line · Luis R. Rodriguez
Yeah looks peachy.
Yeah, I realized it would emit a warning if ath9k_common_ops was const and ath_common->ops wasn't. This way it is OK. Sorry for the noise.
Anyway making ath9k_common_ops const would be good ;).
PATCH v2 3/4 ath5k: define ath_common ops
In reply to Luis R. RodriguezOnly common ath read/write ops go through the common ops.
--- drivers/net/wireless/ath/ath5k/ath5k.h | 16 ++++++++++------ drivers/net/wireless/ath/ath5k/base.c | 17 +++++++++++++++++ drivers/net/wireless/ath/ath5k/base.h | 11 ----------- 3 files changed, 27 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +10 -6
@@ -1315,17 +1315,21 @@ static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)return turbo ? (clock /80 ) : (clock /40 ); } -/* -* Read from a register -*/ +static inline struct ath_common *ath5k_hw_common (struct ath5k_hw *ah) +{ +return &ah->common; +} + +static inline struct ath_regulatory *ath5k_hw_regulatory (struct ath5k_hw *ah) +{ +return &(ath5k_hw_common (ah)->regulatory); +} +static inline u32 ath5k_hw_reg_read (struct ath5k_hw *ah,u16 reg) {return ioread32 (ah->ah_iobase + reg); } -/* -* Write to a register -*/ static inline void ath5k_hw_reg_write (struct ath5k_hw *ah,u32 val,u16 reg) {iowrite32 (val, ah->ah_iobase + reg);
drivers/net/wireless/ath/ath5k/base.c +17 -0
@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)return name; } +static unsigned int ath5k_ioread32 (void *hw_priv,u32 reg_offset) +{ +struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; +return ioread32 (ah->ah_iobase + reg_offset); +} + +static void ath5k_iowrite32 (void *hw_priv,u32 val,u32 reg_offset) +{ +struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; +iowrite32 (val, ah->ah_iobase + reg_offset); +} + +const static struct ath_ops ath5k_common_ops = { + .read = ath5k_ioread32, + .write = ath5k_iowrite32, +}; static int __devinit ath5k_pci_probe(struct pci_dev *pdev,
@@ -576,6 +592,7 @@ ath5k_pci_probe(struct pci_dev *pdev, sc->ah->ah_sc = sc; sc->ah->ah_iobase = sc->iobase; common =ath5k_hw_common (sc->ah); + common->ops = &ath5k_common_ops; common->cachelsz = csz <<2 ;/* convert to bytes */ /* Initialize device */
drivers/net/wireless/ath/ath5k/base.h +0 -11
@@ -201,15 +201,4 @@ struct ath5k_softc {#define ath5k_hw_hasveol (_ah) \ (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) -static inline struct ath_common *ath5k_hw_common (struct ath5k_hw *ah) -{ -return &ah->common; -} - -static inline struct ath_regulatory *ath5k_hw_regulatory (struct ath5k_hw *ah) -{ -return &(ath5k_hw_common (ah)->regulatory); - -} -#endif
Signature · 1 line
1.6.3.3
PATCH v2 3/4 ath5k: define ath_common ops
drivers/net/wireless/ath/ath5k/base.c ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) · line 443
Quoted 10 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath5k/base.c +4
-0@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)return name; } +static unsigned int ath5k_ioread32 (void *hw_priv,u32 reg_offset) +{ +struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; +return ioread32 (ah->ah_iobase + reg_offset);
Why not just
return ath5k_hw_reg_read(hw_priv, reg_offset)
as I suggested?
drivers/net/wireless/ath/ath5k/base.c ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) · line 449
Quoted 4 lines
drivers/net/wireless/ath/ath5k/base.c +4
-0+static void ath5k_iowrite32 (void *hw_priv,u32 val,u32 reg_offset) +{ +struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; +iowrite32 (val, ah->ah_iobase + reg_offset);
and ath5k_hw_reg_write(hw_priv, val, reg_offset)
If we ever decide to not use ioread32/iowrite32, it will need a change on a single place.
drivers/net/wireless/ath/ath5k/base.c ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) · line 452
Quoted 3 lines
drivers/net/wireless/ath/ath5k/base.c +3
-0+} + +const static struct ath_ops ath5k_common_ops = {
C99, 6.11.5 Storage-class specifiers:
1 The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature.
I.e. use static const, please.
PATCH v2 3/4 ath5k: define ath_common ops
Quoted 23 lines · Jiri Slaby
drivers/net/wireless/ath/ath5k/base.c ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) · line 443
Quoted 10 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath5k/base.c +4
-0@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) ? ? ? return name; ?} +static unsigned int ath5k_ioread32 (void *hw_priv,u32 reg_offset) +{ + ? ? struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; + ? ? return ioread32(ah->ah_iobase + reg_offset);Why not just
returnath5k_hw_reg_read(hw_priv, reg_offset)
as I suggested?drivers/net/wireless/ath/ath5k/base.c ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
Quoted 4 lines
drivers/net/wireless/ath/ath5k/base.c +4
-0+static void ath5k_iowrite32 (void *hw_priv,u32 val,u32 reg_offset) +{ + ? ? struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; + ? ? iowrite32(val, ah->ah_iobase + reg_offset);and
ath5k_hw_reg_write(hw_priv, val, reg_offset)
Quoted 2 lines
If we ever decide to not use ioread32/iowrite32, it will need a change on a single place.
Alright, will respin, sorry meant to have done that.
Quoted 10 lines
drivers/net/wireless/ath/ath5k/base.c ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) · line 452
Quoted 3 lines
drivers/net/wireless/ath/ath5k/base.c +3
-0+} + +const static struct ath_ops ath5k_common_ops = {C99, 6.11.5 Storage-class specifiers:
1 The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature.I.e. use static const, please.
Sure thanks for the review.
Luis
PATCH v2 4/4 atheros: define shared bssidmask setting
In reply to Luis R. RodriguezAlso make ath5k and ath9k use it, and share register definitions.
--- drivers/net/wireless/ath/Makefile | 5 +- drivers/net/wireless/ath/ath.h | 3 + drivers/net/wireless/ath/ath5k/ath5k.h | 2 +- drivers/net/wireless/ath/ath5k/attach.c | 2 +- drivers/net/wireless/ath/ath5k/base.c | 1 + drivers/net/wireless/ath/ath5k/initvals.c | 4 +- drivers/net/wireless/ath/ath5k/pcu.c | 121 ++-------------------------- drivers/net/wireless/ath/ath5k/reg.h | 8 +-- drivers/net/wireless/ath/ath9k/hw.c | 10 +-- drivers/net/wireless/ath/ath9k/main.c | 1 + drivers/net/wireless/ath/ath9k/recv.c | 2 +- drivers/net/wireless/ath/ath9k/reg.h | 5 +- drivers/net/wireless/ath/ath9k/virtual.c | 2 +- drivers/net/wireless/ath/hw.c | 126 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/reg.h | 27 ++++++ 15 files changed, 179 insertions(+), 140 deletions(-) create mode 100644 drivers/net/wireless/ath/hw.c create mode 100644 drivers/net/wireless/ath/reg.h
drivers/net/wireless/ath/Makefile +4 -1
@@ -3,4 +3,7 @@ obj-$(CONFIG_ATH9K) += ath9k/ obj-$(CONFIG_AR9170_USB) += ar9170/ obj-$(CONFIG_ATH_COMMON) += ath.o -ath-objs := main.o regd.o + +ath-objs := main.o \ + regd.o \ + hw.o
drivers/net/wireless/ath/ath.h +3 -0
@@ -45,6 +45,7 @@ struct ath_ops { };struct ath_common { +void *ah;u16 cachelsz;u16 curaid;u8 macaddr[ETH_ALEN ];
@@ -58,4 +59,6 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,u32 len, gfp_t gfp_mask); +void ath_hw_setbssidmask (struct ath_common *common); +#endif /* ATH_H */
drivers/net/wireless/ath/ath5k/ath5k.h +1 -1
@@ -1192,7 +1192,7 @@ extern int ath5k_hw_set_opmode(struct ath5k_hw *ah);/* BSSID Functions */ extern int ath5k_hw_set_lladdr (struct ath5k_hw *ah,const u8 *mac);extern void ath5k_hw_set_associd (struct ath5k_hw *ah,const u8 *bssid,u16 assoc_id); -extern int ath5k_hw_set_bssid_mask (struct ath5k_hw *ah,const u8 *mask); +extern void ath5k_hw_set_bssid_mask (struct ath5k_hw *ah,const u8 *mask);/* Receive start/stop functions */ extern void ath5k_hw_start_rx_pcu (struct ath5k_hw *ah);extern void ath5k_hw_stop_rx_pcu (struct ath5k_hw *ah);
drivers/net/wireless/ath/ath5k/attach.c +1 -1
@@ -104,7 +104,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah)int ath5k_hw_attach (struct ath5k_softc *sc) {struct ath5k_hw *ah = sc->ah; -struct ath_common *common; +struct ath_common *common =ath5k_hw_common (ah);struct pci_dev *pdev = sc->pdev;struct ath5k_eeprom_info *ee;int ret;
drivers/net/wireless/ath/ath5k/base.c +1 -0
@@ -593,6 +593,7 @@ ath5k_pci_probe(struct pci_dev *pdev, sc->ah->ah_iobase = sc->iobase; common =ath5k_hw_common (sc->ah); common->ops = &ath5k_common_ops; + common->ah = sc->ah; common->cachelsz = csz <<2 ;/* convert to bytes */ /* Initialize device */
drivers/net/wireless/ath/ath5k/initvals.c +2 -2
@@ -560,8 +560,8 @@ static const struct ath5k_ini ar5212_ini_common_start[] = { { AR5K_SLEEP0, 0x0002aaaa }, { AR5K_SLEEP1, 0x02005555 }, { AR5K_SLEEP2, 0x00000000 }, - { AR5K_BSS_IDM0, 0xffffffff }, - { AR5K_BSS_IDM1, 0x0000ffff }, + { AR_BSSMSKL, 0xffffffff }, + { AR_BSSMSKU, 0x0000ffff }, { AR5K_TXPC, 0x00000000 }, { AR5K_PROFCNT_TX, 0x00000000 }, { AR5K_PROFCNT_RX, 0x00000000 },
drivers/net/wireless/ath/ath5k/pcu.c +7 -114
151 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reg.h +1 -7
@@ -35,7 +35,7 @@* released by Atheros and on various debug messages found on the net. */ - +#include "../reg.h" /*====MAC DMA REGISTERS====*/
@@ -1650,12 +1650,6 @@#define AR5K_SLEEP2_DTIM_PER_S 16/* -* BSSID mask registers -*/ -#define AR5K_BSS_IDM0 0x80e0/* Upper bits */ -#define AR5K_BSS_IDM1 0x80e4/* Lower bits */ - -/* * TX power control (TPC) register * * XXX: PCDAC steps (0.5dbm) or DBM ?
drivers/net/wireless/ath/ath9k/hw.c +1 -9
@@ -2423,7 +2423,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | ah->sta_id1_defaults);ath9k_hw_set_operating_mode (ah, ah->opmode); -ath9k_hw_setbssidmask (ah); +ath_hw_setbssidmask (common);REG_WRITE (ah,AR_DEF_ANTENNA , saveDefAntenna);
@@ -3950,14 +3950,6 @@ void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1)REG_WRITE (ah,AR_MCAST_FIL1 , filter1); } -void ath9k_hw_setbssidmask (struct ath_hw *ah) -{ -struct ath_common *common =ath9k_hw_common (ah); - -REG_WRITE (ah,AR_BSSMSKL ,get_unaligned_le32 (common->bssidmask)); -REG_WRITE (ah,AR_BSSMSKU ,get_unaligned_le16 (common->bssidmask +4 )); -} -void ath9k_hw_write_associd (struct ath_hw *ah) {struct ath_common *common =ath9k_hw_common (ah);
drivers/net/wireless/ath/ath9k/main.c +1 -0
@@ -1574,6 +1574,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid) common =ath9k_hw_common (ah); common->ops = &ath9k_common_ops; + common->ah = ah;/* * Cache line size is used to size and align various
drivers/net/wireless/ath/ath9k/recv.c +1 -1
@@ -282,7 +282,7 @@ static void ath_opmode_init(struct ath_softc *sc)/* configure bssid mask */ if (ah->caps.hw_caps &ATH9K_HW_CAP_BSSIDMASK ) -ath9k_hw_setbssidmask (ah); +ath_hw_setbssidmask (common);/* configure operational mode */ ath9k_hw_setopmode (ah);
drivers/net/wireless/ath/ath9k/reg.h +2 -3
@@ -17,6 +17,8 @@#ifndef REG_H #define REG_H +#include "../reg.h" +#define AR_CR 0x0008#define AR_CR_RXE 0x00000004#define AR_CR_RXD 0x00000020
@@ -1420,9 +1422,6 @@ enum {#define AR_SLEEP2_BEACON_TIMEOUT 0xFFE00000#define AR_SLEEP2_BEACON_TIMEOUT_S 21 -#define AR_BSSMSKL 0x80e0 -#define AR_BSSMSKU 0x80e4 -#define AR_TPC 0x80e8#define AR_TPC_ACK 0x0000003f#define AR_TPC_ACK_S 0x00
drivers/net/wireless/ath/ath9k/virtual.c +1 -1
@@ -94,7 +94,7 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw) common->bssidmask[4 ] = ~mask[4 ]; common->bssidmask[5 ] = ~mask[5 ]; -ath9k_hw_setbssidmask (sc->sc_ah); +ath_hw_setbssidmask (common); }int ath9k_wiphy_add (struct ath_softc *sc)
drivers/net/wireless/ath/hw.c new file +126 -0
126 lines not on this page · raw message
drivers/net/wireless/ath/reg.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (c) 2008-2009 Atheros Communications Inc. +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef ATH_REGISTERS_H +#define ATH_REGISTERS_H + +/* +* BSSID mask registers. See ath_hw_set_bssid_mask() +* for detailed documentation about these registers. +*/ +#define AR_BSSMSKL 0x80e0 +#define AR_BSSMSKU 0x80e4 + +#endif /* ATH_REGISTERS_H */
Signature · 1 line
1.6.3.3