mac80211: update to 2010-12-09
[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 @@ -1726,7 +1728,7 @@ ath5k_eeprom_read_spur_chans(struct ath5
13 }
14
15 /*
16 - * Read the MAC address from eeprom
17 + * Read the MAC address from eeprom or platform_data
18 */
19 int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
20 {
21 @@ -1734,6 +1736,16 @@ int ath5k_eeprom_read_mac(struct ath5k_h
22 u32 total, offset;
23 u16 data;
24 int octet, ret;
25 + struct ath5k_platform_data *pdata = NULL;
26 +
27 + if (ah->ah_sc->pdev)
28 + pdata = ah->ah_sc->pdev->dev.platform_data;
29 +
30 + if (pdata && pdata->macaddr)
31 + {
32 + memcpy(mac, pdata->macaddr, ETH_ALEN);
33 + return 0;
34 + }
35
36 ret = ath5k_hw_nvram_read(ah, 0x20, &data);
37 if (ret)
38 --- a/drivers/net/wireless/ath/ath5k/pci.c
39 +++ b/drivers/net/wireless/ath/ath5k/pci.c
40 @@ -17,6 +17,7 @@
41 #include <linux/nl80211.h>
42 #include <linux/pci.h>
43 #include <linux/pci-aspm.h>
44 +#include <linux/ath5k_platform.h>
45 #include "../ath.h"
46 #include "ath5k.h"
47 #include "debug.h"
48 @@ -73,6 +74,19 @@ bool ath5k_pci_eeprom_read(struct ath_co
49 {
50 struct ath5k_hw *ah = (struct ath5k_hw *) common->ah;
51 u32 status, timeout;
52 + struct ath5k_platform_data *pdata = NULL;
53 +
54 + if (ah->ah_sc->pdev)
55 + pdata = ah->ah_sc->pdev->dev.platform_data;
56 +
57 + if (pdata && pdata->eeprom_data && pdata->eeprom_data[0] == AR5K_EEPROM_MAGIC_VALUE)
58 + {
59 + if (offset >= ATH5K_PLAT_EEP_MAX_WORDS)
60 + return -EIO;
61 +
62 + *data = pdata->eeprom_data[offset];
63 + return 0;
64 + }
65
66 /*
67 * Initialize EEPROM access
This page took 0.041098 seconds and 5 git commands to generate.