Skip to contentSkip to conversation

ath9k: add support for reading eeprom from platform data on PCI devices

PATCH Superseded Felix Fietkau 1 participant 3 messages Nov 17, 2010 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ath9k: add support for reading eeprom from platform data on PCI devices

Some embedded boards store platform data for connected PCIe AR92xx chips in the system flash instead of a separate EEPROM chip.

---
 drivers/net/wireless/ath/ath9k/hw.c   |    4 ----
 drivers/net/wireless/ath/ath9k/init.c |    3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -4
index 986c779..1dbe53b 100644
@@ -419,10 +419,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
 	ah->hw_version.magic = AR5416_MAGIC;
 	ah->hw_version.subvendorid = 0;
 
-	ah->ah_flags = 0;
-	if (!AR_SREV_9100(ah))
-		ah->ah_flags = AH_USE_EEPROM;
-
 	ah->atim_window = 0;
 	ah->sta_id1_defaults =
 		AR_STA_ID1_CRPT_MIC_ENABLE |
drivers/net/wireless/ath/ath9k/init.c +3 -0
index 5c26818d..7eef1fa 100644
@@ -533,6 +533,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
 	ah->hw_version.subsysid = subsysid;
 	sc->sc_ah = ah;
 
+	if (!sc->dev->platform_data)
+		ah->ah_flags |= AH_USE_EEPROM;
+
 	common = ath9k_hw_common(ah);
 	common->ops = &ath9k_common_ops;
 	common->bus_ops = bus_ops;
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 2/2 ath9k_hw: support reading calibration data from flash on AR9003

Embedded boards do not have compressed EEPROM data, they use the struct ar9003_eeprom layout, with little endian fields, so copying the raw data to the eeprom buffer is enough.

---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +15 -0
index 230a122..9a7e151 100644
@@ -3271,6 +3271,18 @@ static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
 	return ar9300_check_header(header);
 }
 
+static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
+				       int mdata_size)
+{
+	struct ath_common *common = ath9k_hw_common(ah);
+	u16 *data = (u16 *) mptr;
+	int i;
+
+	for (i = 0; i < mdata_size / 2; i++, data++)
+		ath9k_hw_nvram_read(common, i, data);
+
+	return 0;
+}
 /*
  * Read the configuration data from the eeprom.
  * The data can be put in any specified memory buffer.
@@ -3293,6 +3305,9 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
 	struct ath_common *common = ath9k_hw_common(ah);
 	eeprom_read_op read;
 
+	if (ath9k_hw_use_flash(ah))
+		return ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
+
 	word = kzalloc(2048, GFP_KERNEL);
 	if (!word)
 		return -1;
Signature · 1 line
1.7.3.2
#2 lore raw

PATCH v2 1/2 ath9k: add support for reading eeprom from platform data on PCI devices

In reply to Felix Fietkau

Some embedded boards store platform data for connected PCIe AR92xx chips in the system flash instead of a separate EEPROM chip.

---
 drivers/net/wireless/ath/ath9k/hw.c   |    4 ---
 drivers/net/wireless/ath/ath9k/init.c |    3 ++
 drivers/net/wireless/ath/ath9k/pci.c  |   42 ++++++++++++++++++++++----------
 3 files changed, 32 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -4
index 986c779..1dbe53b 100644
@@ -419,10 +419,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
 	ah->hw_version.magic = AR5416_MAGIC;
 	ah->hw_version.subvendorid = 0;
 
-	ah->ah_flags = 0;
-	if (!AR_SREV_9100(ah))
-		ah->ah_flags = AH_USE_EEPROM;
-
 	ah->atim_window = 0;
 	ah->sta_id1_defaults =
 		AR_STA_ID1_CRPT_MIC_ENABLE |
drivers/net/wireless/ath/ath9k/init.c +3 -0
index 5c26818d..7eef1fa 100644
@@ -533,6 +533,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
 	ah->hw_version.subsysid = subsysid;
 	sc->sc_ah = ah;
 
+	if (!sc->dev->platform_data)
+		ah->ah_flags |= AH_USE_EEPROM;
+
 	common = ath9k_hw_common(ah);
 	common->ops = &ath9k_common_ops;
 	common->bus_ops = bus_ops;
drivers/net/wireless/ath/ath9k/pci.c +29 -13

56 lines not on this page · raw message