summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath/ath_hal
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-07-30 13:37:38 +0000
committeradrian <adrian@FreeBSD.org>2011-07-30 13:37:38 +0000
commit2a8e88943b6bce373a4cfc7fe19de83c7845e536 (patch)
tree927273f094f0202a236a1aa7e94dac2d781c1ded /sys/dev/ath/ath_hal
parentcd38b7795a0aafebbccd9e07c5a879f17f3bd758 (diff)
downloadFreeBSD-src-2a8e88943b6bce373a4cfc7fe19de83c7845e536.zip
FreeBSD-src-2a8e88943b6bce373a4cfc7fe19de83c7845e536.tar.gz
Prepare for embedded use of the AR9285/AR9287.
Calibration/PCI data that's written to flash (rather than EEPROM attached to the NIC) is typically already in host-endian. The existing checks end up swapping 16 bit words incorrectly - the correct solution would be to read the magic value and determine the EEPROM endianness from that. (This is what Linux does.) This doesn't completely enable embedded use of the AR9285/AR9287 - notably, the EEPROM read methods need to be made generic and available to all EEPROM drivers. I'll worry about that later. Approved by: re (kib)
Diffstat (limited to 'sys/dev/ath/ath_hal')
-rw-r--r--sys/dev/ath/ath_hal/ah_eeprom_9287.c23
-rw-r--r--sys/dev/ath/ath_hal/ah_eeprom_v4k.c22
2 files changed, 33 insertions, 12 deletions
diff --git a/sys/dev/ath/ath_hal/ah_eeprom_9287.c b/sys/dev/ath/ath_hal/ah_eeprom_9287.c
index 4055093..099fe34 100644
--- a/sys/dev/ath/ath_hal/ah_eeprom_9287.c
+++ b/sys/dev/ath/ath_hal/ah_eeprom_9287.c
@@ -298,11 +298,18 @@ ath_hal_9287EepromAttach(struct ath_hal *ah)
uint32_t sum;
HALASSERT(ee == AH_NULL);
-
- if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
- HALDEBUG(ah, HAL_DEBUG_ANY,
- "%s Error reading Eeprom MAGIC\n", __func__);
- return HAL_EEREAD;
+
+ /*
+ * Don't check magic if we're supplied with an EEPROM block,
+ * typically this is from Howl but it may also be from later
+ * boards w/ an embedded WMAC.
+ */
+ if (ah->ah_eepromdata == NULL) {
+ if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
+ HALDEBUG(ah, HAL_DEBUG_ANY,
+ "%s Error reading Eeprom MAGIC\n", __func__);
+ return HAL_EEREAD;
+ }
}
HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
__func__, magic);
@@ -328,7 +335,11 @@ ath_hal_9287EepromAttach(struct ath_hal *ah)
}
}
/* Convert to eeprom native eeprom endian format */
- if (isBigEndian()) {
+ /*
+ * XXX this is likely incorrect but will do for now
+ * XXX to get embedded boards working.
+ */
+ if (ah->ah_eepromdata == NULL && isBigEndian()) {
for (w = 0; w < NW(HAL_EEPROM_9287); w++)
eep_data[w] = __bswap16(eep_data[w]);
}
diff --git a/sys/dev/ath/ath_hal/ah_eeprom_v4k.c b/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
index 36a6e73..348ab60 100644
--- a/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
+++ b/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
@@ -288,11 +288,17 @@ ath_hal_v4kEepromAttach(struct ath_hal *ah)
uint32_t sum;
HALASSERT(ee == AH_NULL);
-
- if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
- HALDEBUG(ah, HAL_DEBUG_ANY,
- "%s Error reading Eeprom MAGIC\n", __func__);
- return HAL_EEREAD;
+ /*
+ * Don't check magic if we're supplied with an EEPROM block,
+ * typically this is from Howl but it may also be from later
+ * boards w/ an embedded WMAC.
+ */
+ if (ah->ah_eepromdata == NULL) {
+ if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
+ HALDEBUG(ah, HAL_DEBUG_ANY,
+ "%s Error reading Eeprom MAGIC\n", __func__);
+ return HAL_EEREAD;
+ }
}
HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
__func__, magic);
@@ -318,7 +324,11 @@ ath_hal_v4kEepromAttach(struct ath_hal *ah)
}
}
/* Convert to eeprom native eeprom endian format */
- if (isBigEndian()) {
+ /*
+ * XXX this is likely incorrect but will do for now
+ * XXX to get embedded boards working.
+ */
+ if (ah->ah_eepromdata == NULL && isBigEndian()) {
for (w = 0; w < NW(struct ar5416eeprom_4k); w++)
eep_data[w] = __bswap16(eep_data[w]);
}
OpenPOWER on IntegriCloud