ar71xx: improve the wndr3700 quirks - move most of the code out of ath9k and instead...
[openwrt.git] / package / mac80211 / patches / 451-add-platform-eeprom-support-to-ath5k.patch
1 --- a/drivers/net/wireless/ath/ath5k/eeprom.c
2 +++ b/drivers/net/wireless/ath/ath5k/eeprom.c
3 @@ -22,6 +22,8 @@
4 \*************************************/
5
6 #include <linux/slab.h>
7 +#include <linux/ath5k_platform.h>
8 +#include <linux/pci.h>
9
10 #include "ath5k.h"
11 #include "reg.h"
12 @@ -34,6 +36,18 @@
13 static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
14 {
15 u32 status, timeout;
16 + struct ath5k_platform_data *pdata = NULL;
17 +
18 + if (ah->ah_sc->pdev)
19 + pdata = ah->ah_sc->pdev->dev.platform_data;
20 +
21 + if (pdata && pdata->eeprom_data && pdata->eeprom_data[0] == AR5K_EEPROM_MAGIC_VALUE)
22 + {
23 + ATH5K_INFO(ah->ah_sc, "using eeprom-content from platform_data\n");
24 + if (offset >= ATH5K_PLAT_EEP_MAX_WORDS) return -EIO;
25 + *data = pdata->eeprom_data[offset];
26 + return 0;
27 + }
28
29 /*
30 * Initialize EEPROM access
31 @@ -1788,7 +1802,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
32 }
33
34 /*
35 - * Read the MAC address from eeprom
36 + * Read the MAC address from eeprom or platform_data
37 */
38 int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
39 {
40 @@ -1796,6 +1810,16 @@ int ath5k_eeprom_read_mac(struct ath5k_h
41 u32 total, offset;
42 u16 data;
43 int octet, ret;
44 + struct ath5k_platform_data *pdata = NULL;
45 +
46 + if (ah->ah_sc->pdev)
47 + pdata = ah->ah_sc->pdev->dev.platform_data;
48 +
49 + if (pdata && pdata->macaddr)
50 + {
51 + memcpy(mac, pdata->macaddr, ETH_ALEN);
52 + return 0;
53 + }
54
55 ret = ath5k_hw_eeprom_read(ah, 0x20, &data);
56 if (ret)
This page took 0.049304 seconds and 5 git commands to generate.