Root/package/mac80211/patches/431-add_platform_eeprom_support_to_ath5k.patch

1--- a/drivers/net/wireless/ath/ath5k/pci.c
2+++ b/drivers/net/wireless/ath/ath5k/pci.c
3@@ -23,6 +23,7 @@
4 #include <linux/pci-aspm.h>
5 #include <linux/etherdevice.h>
6 #include <linux/module.h>
7+#include <linux/ath5k_platform.h>
8 #include "../ath.h"
9 #include "ath5k.h"
10 #include "debug.h"
11@@ -74,7 +75,7 @@ static void ath5k_pci_read_cachesize(str
12 }
13 
14 /*
15- * Read from eeprom
16+ * Read from eeprom or platform_data
17  */
18 static bool
19 ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data)
20@@ -82,6 +83,19 @@ ath5k_pci_eeprom_read(struct ath_common
21     struct ath5k_hw *ah = (struct ath5k_hw *) common->ah;
22     u32 status, timeout;
23 
24+ struct ath5k_platform_data *pdata = NULL;
25+
26+ if (ah->pdev)
27+ pdata = ah->pdev->dev.platform_data;
28+
29+ if (pdata && pdata->eeprom_data && pdata->eeprom_data[61] == AR5K_EEPROM_MAGIC_VALUE) {
30+ if (offset >= ATH5K_PLAT_EEP_MAX_WORDS)
31+ return false;
32+
33+ *data = pdata->eeprom_data[offset];
34+ return true;
35+ }
36+
37     /*
38      * Initialize EEPROM access
39      */
40@@ -125,6 +139,16 @@ static int ath5k_pci_eeprom_read_mac(str
41     u16 data;
42     int octet;
43 
44+ struct ath5k_platform_data *pdata = NULL;
45+
46+ if (ah->pdev)
47+ pdata = ah->pdev->dev.platform_data;
48+
49+ if (pdata && pdata->macaddr) {
50+ memcpy(mac, pdata->macaddr, ETH_ALEN);
51+ return 0;
52+ }
53+
54     AR5K_EEPROM_READ(0x20, data);
55 
56     for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) {
57

Archive Download this file



interactive