ath5k: Introduce ath5k_init_softc function as in ath9k
A message that is not in the archive (sent off-list or not yet received): 3897066.1181291281847588.JavaMail.wlan@CHBU500181
PATCH v7 2/9 ath5k: Introduce ath5k_init_softc function as in ath9k
From: Felix Fietkau <[email protected]>
Split pci initialization into hardware specific functions and softc structure initialization. Make function naming similar to ones ath9k. Introduce ath_bus_opts in ath5k for later AHB bus integration.
Signed-off-by Felix Fietkau <[email protected]>
Signed-off-by Wojciech Dubowik <[email protected]>
--- drivers/net/wireless/ath/ath5k/ath5k.h | 13 +- drivers/net/wireless/ath/ath5k/attach.c | 10 +- drivers/net/wireless/ath/ath5k/base.c | 344 ++++++++++++++++++------------- drivers/net/wireless/ath/ath5k/base.h | 1 + drivers/net/wireless/ath/ath5k/eeprom.c | 2 +- 5 files changed, 217 insertions(+), 153 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +10 -3
@@ -1146,9 +1146,11 @@ struct ath5k_hw {* Prototypes */ -/* Attach/Detach Functions */ -int ath5k_hw_attach (struct ath5k_softc *sc); -void ath5k_hw_detach (struct ath5k_hw *ah); +/* Initialization and detach functions */ +int ath5k_init_softc (struct ath5k_softc *sc,const struct ath_bus_ops *bus_ops); +void ath5k_deinit_softc (struct ath5k_softc *sc); +int ath5k_hw_init (struct ath5k_softc *sc); +void ath5k_hw_deinit (struct ath5k_hw *ah);int ath5k_sysfs_register (struct ath5k_softc *sc);void ath5k_sysfs_unregister (struct ath5k_softc *sc);
@@ -1332,6 +1334,11 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)iowrite32 (val, ah->ah_iobase + reg); } +static inline void ath5k_read_cachesize (struct ath_common *common,int *csz) +{ + common->bus_ops->read_cachesize (common, csz); +} +static inline u32 ath5k_hw_bitswap (u32 val,unsigned int bits) {u32 retval =0 , bit, i;
drivers/net/wireless/ath/ath5k/attach.c +5 -5
@@ -93,16 +93,16 @@ static int ath5k_hw_post(struct ath5k_hw *ah) }/** -* ath5k_hw_attach - Check if hw is supported and init the needed structs +* ath5k_hw_init - Check if hw is supported and init the needed structs * -* @sc: The &struct ath5k_softc we got from the driver's attach function +* @sc: The &struct ath5k_softc we got from the driver's init_softc function * * Check if the device is supported, perform a POST and initialize the needed * structs. Returns -ENOMEM if we don't have memory for the needed structs, * -ENODEV if the device is not supported or prints an error msg if something * else went wrong. */ -int ath5k_hw_attach (struct ath5k_softc *sc) +int ath5k_hw_init (struct ath5k_softc *sc) {struct ath5k_hw *ah = sc->ah;struct ath_common *common =ath5k_hw_common (ah);
@@ -346,11 +346,11 @@ err: }/** -* ath5k_hw_detach - Free the ath5k_hw struct +* ath5k_hw_deinit - Free the ath5k_hw struct * * @ah: The &struct ath5k_hw */ -void ath5k_hw_detach (struct ath5k_hw *ah) +void ath5k_hw_deinit (struct ath5k_hw *ah) {__set_bit (ATH_STAT_INVALID , ah->ah_sc->status);
drivers/net/wireless/ath/ath5k/base.c +200 -144
453 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/base.h +1 -0
@@ -172,6 +172,7 @@ struct ath5k_softc {struct pci_dev *pdev;struct device *dev;/* for dma mapping */ int irq; +u16 devid;void __iomem *iobase;/* address of the device */ struct mutex lock;/* dev-level lock */ struct ieee80211_hw *hw;/* IEEE 802.11 common */
drivers/net/wireless/ath/ath5k/eeprom.c +1 -1
@@ -208,7 +208,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)* * XXX: Serdes values seem to be fixed so * no need to read them here, we write them -* during ath5k_hw_attach */ +* during ath5k_hw_init */ AR5K_EEPROM_READ (AR5K_EEPROM_PCIE_OFFSET , val); ee->ee_serdes = (val ==AR5K_EEPROM_PCIE_SERDES_SECTION ) ? true : false;
Signature · 1 line
1.7.1