diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-01-14 14:17:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:00:33 -0500 |
commit | 9dbeb91a8b97e2892c04461e28d2bdd0198b719d (patch) | |
tree | 3ac42d298b739da86a991ed2bd53aa12377cb956 /drivers/net/wireless/ath9k/eeprom.c | |
parent | 09329d371e57ff9fcb645b8e2cdee1ec8b9b539f (diff) |
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
boards may store the radio calibration data at different locations.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Tested-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/eeprom.c')
-rw-r--r-- | drivers/net/wireless/ath9k/eeprom.c | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/drivers/net/wireless/ath9k/eeprom.c b/drivers/net/wireless/ath9k/eeprom.c index 1ef8b5a70e5b..50cb3883416a 100644 --- a/drivers/net/wireless/ath9k/eeprom.c +++ b/drivers/net/wireless/ath9k/eeprom.c | |||
@@ -91,53 +91,11 @@ static inline bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, | |||
91 | return false; | 91 | return false; |
92 | } | 92 | } |
93 | 93 | ||
94 | static bool ath9k_hw_eeprom_read(struct ath_hal *ah, u32 off, u16 *data) | ||
95 | { | ||
96 | (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); | ||
97 | |||
98 | if (!ath9k_hw_wait(ah, | ||
99 | AR_EEPROM_STATUS_DATA, | ||
100 | AR_EEPROM_STATUS_DATA_BUSY | | ||
101 | AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0)) { | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | *data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA), | ||
106 | AR_EEPROM_STATUS_DATA_VAL); | ||
107 | |||
108 | return true; | ||
109 | } | ||
110 | |||
111 | static int ath9k_hw_flash_map(struct ath_hal *ah) | ||
112 | { | ||
113 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
114 | |||
115 | ahp->ah_cal_mem = ioremap(AR5416_EEPROM_START_ADDR, AR5416_EEPROM_MAX); | ||
116 | |||
117 | if (!ahp->ah_cal_mem) { | ||
118 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, | ||
119 | "cannot remap eeprom region \n"); | ||
120 | return -EIO; | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static bool ath9k_hw_flash_read(struct ath_hal *ah, u32 off, u16 *data) | ||
127 | { | ||
128 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
129 | |||
130 | *data = ioread16(ahp->ah_cal_mem + off); | ||
131 | |||
132 | return true; | ||
133 | } | ||
134 | |||
135 | static inline bool ath9k_hw_nvram_read(struct ath_hal *ah, u32 off, u16 *data) | 94 | static inline bool ath9k_hw_nvram_read(struct ath_hal *ah, u32 off, u16 *data) |
136 | { | 95 | { |
137 | if (ath9k_hw_use_flash(ah)) | 96 | struct ath_softc *sc = ah->ah_sc; |
138 | return ath9k_hw_flash_read(ah, off, data); | 97 | |
139 | else | 98 | return sc->bus_ops->eeprom_read(ah, off, data); |
140 | return ath9k_hw_eeprom_read(ah, off, data); | ||
141 | } | 99 | } |
142 | 100 | ||
143 | static bool ath9k_hw_fill_4k_eeprom(struct ath_hal *ah) | 101 | static bool ath9k_hw_fill_4k_eeprom(struct ath_hal *ah) |
@@ -2825,9 +2783,6 @@ int ath9k_hw_eeprom_attach(struct ath_hal *ah) | |||
2825 | int status; | 2783 | int status; |
2826 | struct ath_hal_5416 *ahp = AH5416(ah); | 2784 | struct ath_hal_5416 *ahp = AH5416(ah); |
2827 | 2785 | ||
2828 | if (ath9k_hw_use_flash(ah)) | ||
2829 | ath9k_hw_flash_map(ah); | ||
2830 | |||
2831 | if (AR_SREV_9285(ah)) | 2786 | if (AR_SREV_9285(ah)) |
2832 | ahp->ah_eep_map = EEP_MAP_4KBITS; | 2787 | ahp->ah_eep_map = EEP_MAP_4KBITS; |
2833 | else | 2788 | else |