Date: | 2010-07-15 09:36:55 (13 years 8 months ago) |
---|---|
Author: | juhosg |
Commit: | b518ed32e235740fddbfa0ab3b5e659439281a18 |
Message: | ath5k: in-flash macs and eeprom for mach-eap7660d This adds ath5k_platform.h to mac80211 and patches ath5k to respect MAC addresses and eeprom content from platform_data, if supplied. Signed-off-by: Daniel Golle <daniel.golle@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22188 3c298f89-4303-0410-b956-a3cf2f4a3e73 |
Files: |
package/mac80211/Makefile (1 diff) package/mac80211/patches/450-add-ath5k-platform.patch (1 diff) package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch (1 diff) |
Change Details
package/mac80211/Makefile | ||
---|---|---|
11 | 11 | PKG_NAME:=mac80211 |
12 | 12 | |
13 | 13 | PKG_VERSION:=2010-07-06 |
14 | PKG_RELEASE:=1 | |
14 | PKG_RELEASE:=2 | |
15 | 15 | PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources |
16 | 16 | # http://www.orbit-lab.org/kernel/compat-wireless-2.6/2010/11 \ |
17 | 17 | # http://wireless.kernel.org/download/compat-wireless-2.6 |
package/mac80211/patches/450-add-ath5k-platform.patch | ||
---|---|---|
1 | diff -Nur a/include/linux/ath5k_platform.h b/include/linux/ath5k_platform.h | |
2 | --- a/include/linux/ath5k_platform.h 1970-01-01 01:00:00.000000000 +0100 | |
3 | @@ -0,0 +1,30 @@ | |
4 | +/* | |
5 | + * Copyright (c) 2008 Atheros Communications Inc. | |
6 | + * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org> | |
7 | + * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org> | |
8 | + * Copyright (c) 2010 Daniel Golle <daniel.golle@gmail.com> | |
9 | + * | |
10 | + * Permission to use, copy, modify, and/or distribute this software for any | |
11 | + * purpose with or without fee is hereby granted, provided that the above | |
12 | + * copyright notice and this permission notice appear in all copies. | |
13 | + * | |
14 | + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
15 | + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
16 | + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
17 | + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
18 | + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
19 | + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
20 | + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
21 | + */ | |
22 | + | |
23 | +#ifndef _LINUX_ATH5K_PLATFORM_H | |
24 | +#define _LINUX_ATH5K_PLATFORM_H | |
25 | + | |
26 | +#define ATH5K_PLAT_EEP_MAX_WORDS 2048 | |
27 | + | |
28 | +struct ath5k_platform_data { | |
29 | + u16 *eeprom_data; | |
30 | + u8 *macaddr; | |
31 | +}; | |
32 | + | |
33 | +#endif /* _LINUX_ATH5K_PLATFORM_H */ | |
34 |
package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch | ||
---|---|---|
1 | --- a/drivers/net/wireless/ath/ath5k/eeprom.c 2010-06-23 03:08:32.000000000 +0200 | |
2 | @@ -22,6 +23,8 @@ | |
3 | \*************************************/ | |
4 | ||
5 | #include <linux/slab.h> | |
6 | +#include <linux/ath5k_platform.h> | |
7 | +#include <linux/pci.h> | |
8 | ||
9 | #include "ath5k.h" | |
10 | #include "reg.h" | |
11 | @@ -34,6 +37,18 @@ | |
12 | static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data) | |
13 | { | |
14 | u32 status, timeout; | |
15 | + struct ath5k_platform_data *pdata = NULL; | |
16 | + | |
17 | + if (ah->ah_sc->pdev) | |
18 | + pdata = ah->ah_sc->pdev->dev.platform_data; | |
19 | + | |
20 | + if (pdata && pdata->eeprom_data && pdata->eeprom_data[0] == AR5K_EEPROM_MAGIC_VALUE) | |
21 | + { | |
22 | + ATH5K_INFO(ah->ah_sc, "using eeprom-content from platform_data\n"); | |
23 | + if (offset >= ATH5K_PLAT_EEP_MAX_WORDS) return -EIO; | |
24 | + *data = pdata->eeprom_data[offset]; | |
25 | + return 0; | |
26 | + } | |
27 | ||
28 | /* | |
29 | * Initialize EEPROM access | |
30 | @@ -1788,7 +1802,7 @@ | |
31 | } | |
32 | ||
33 | /* | |
34 | - * Read the MAC address from eeprom | |
35 | + * Read the MAC address from eeprom or platform_data | |
36 | */ | |
37 | int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) | |
38 | { | |
39 | @@ -1796,6 +1810,16 @@ | |
40 | u32 total, offset; | |
41 | u16 data; | |
42 | int octet, ret; | |
43 | + struct ath5k_platform_data *pdata = NULL; | |
44 | + | |
45 | + if (ah->ah_sc->pdev) | |
46 | + pdata = ah->ah_sc->pdev->dev.platform_data; | |
47 | + | |
48 | + if (pdata && pdata->macaddr) | |
49 | + { | |
50 | + memcpy(mac, pdata->macaddr, ETH_ALEN); | |
51 | + return 0; | |
52 | + } | |
53 | ||
54 | ret = ath5k_hw_eeprom_read(ah, 0x20, &data); | |
55 | if (ret) | |
56 |