diff options
Diffstat (limited to 'drivers/net/wireless/ath9k/core.h')
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 4ca2aed236e0..139566cbbf65 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -701,6 +701,7 @@ struct ath_softc { | |||
701 | struct ath_hal *sc_ah; | 701 | struct ath_hal *sc_ah; |
702 | void __iomem *mem; | 702 | void __iomem *mem; |
703 | spinlock_t sc_resetlock; | 703 | spinlock_t sc_resetlock; |
704 | spinlock_t sc_serial_rw; | ||
704 | struct mutex mutex; | 705 | struct mutex mutex; |
705 | 706 | ||
706 | u8 sc_curbssid[ETH_ALEN]; | 707 | u8 sc_curbssid[ETH_ALEN]; |
@@ -751,4 +752,36 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); | |||
751 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); | 752 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); |
752 | int ath_cabq_update(struct ath_softc *); | 753 | int ath_cabq_update(struct ath_softc *); |
753 | 754 | ||
755 | /* | ||
756 | * Read and write, they both share the same lock. We do this to serialize | ||
757 | * reads and writes on Atheros 802.11n PCI devices only. This is required | ||
758 | * as the FIFO on these devices can only accept sanely 2 requests. After | ||
759 | * that the device goes bananas. Serializing the reads/writes prevents this | ||
760 | * from happening. | ||
761 | */ | ||
762 | |||
763 | static inline void ath9k_iowrite32(struct ath_hal *ah, u32 reg_offset, u32 val) | ||
764 | { | ||
765 | if (ah->ah_config.serialize_regmode == SER_REG_MODE_ON) { | ||
766 | unsigned long flags; | ||
767 | spin_lock_irqsave(&ah->ah_sc->sc_serial_rw, flags); | ||
768 | iowrite32(val, ah->ah_sc->mem + reg_offset); | ||
769 | spin_unlock_irqrestore(&ah->ah_sc->sc_serial_rw, flags); | ||
770 | } else | ||
771 | iowrite32(val, ah->ah_sc->mem + reg_offset); | ||
772 | } | ||
773 | |||
774 | static inline unsigned int ath9k_ioread32(struct ath_hal *ah, u32 reg_offset) | ||
775 | { | ||
776 | u32 val; | ||
777 | if (ah->ah_config.serialize_regmode == SER_REG_MODE_ON) { | ||
778 | unsigned long flags; | ||
779 | spin_lock_irqsave(&ah->ah_sc->sc_serial_rw, flags); | ||
780 | val = ioread32(ah->ah_sc->mem + reg_offset); | ||
781 | spin_unlock_irqrestore(&ah->ah_sc->sc_serial_rw, flags); | ||
782 | } else | ||
783 | val = ioread32(ah->ah_sc->mem + reg_offset); | ||
784 | return val; | ||
785 | } | ||
786 | |||
754 | #endif /* CORE_H */ | 787 | #endif /* CORE_H */ |