ar71xx: add v3.18 support
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.18 / 501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch
1 --- a/arch/mips/ath79/dev-wmac.c
2 +++ b/arch/mips/ath79/dev-wmac.c
3 @@ -15,6 +15,7 @@
4 #include <linux/init.h>
5 #include <linux/delay.h>
6 #include <linux/irq.h>
7 +#include <linux/etherdevice.h>
8 #include <linux/platform_device.h>
9 #include <linux/ath9k_platform.h>
10
11 @@ -22,6 +23,7 @@
12 #include <asm/mach-ath79/ar71xx_regs.h>
13 #include "dev-wmac.h"
14
15 +static u8 ath79_wmac_mac[ETH_ALEN];
16 static struct ath9k_platform_data ath79_wmac_data;
17
18 static struct resource ath79_wmac_resources[] = {
19 @@ -160,7 +162,7 @@ static void qca955x_wmac_setup(void)
20 ath79_wmac_data.is_clk_25mhz = true;
21 }
22
23 -void __init ath79_register_wmac(u8 *cal_data)
24 +void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
25 {
26 if (soc_is_ar913x())
27 ar913x_wmac_setup();
28 @@ -177,5 +179,10 @@ void __init ath79_register_wmac(u8 *cal_
29 memcpy(ath79_wmac_data.eeprom_data, cal_data,
30 sizeof(ath79_wmac_data.eeprom_data));
31
32 + if (mac_addr) {
33 + memcpy(ath79_wmac_mac, mac_addr, sizeof(ath79_wmac_mac));
34 + ath79_wmac_data.macaddr = ath79_wmac_mac;
35 + }
36 +
37 platform_device_register(&ath79_wmac_device);
38 }
39 --- a/arch/mips/ath79/dev-wmac.h
40 +++ b/arch/mips/ath79/dev-wmac.h
41 @@ -12,6 +12,6 @@
42 #ifndef _ATH79_DEV_WMAC_H
43 #define _ATH79_DEV_WMAC_H
44
45 -void ath79_register_wmac(u8 *cal_data);
46 +void ath79_register_wmac(u8 *cal_data, u8 *mac_addr);
47
48 #endif /* _ATH79_DEV_WMAC_H */
49 --- a/arch/mips/ath79/mach-ap81.c
50 +++ b/arch/mips/ath79/mach-ap81.c
51 @@ -98,7 +98,7 @@ static void __init ap81_setup(void)
52 ap81_gpio_keys);
53 ath79_register_spi(&ap81_spi_data, ap81_spi_info,
54 ARRAY_SIZE(ap81_spi_info));
55 - ath79_register_wmac(cal_data);
56 + ath79_register_wmac(cal_data, NULL);
57 ath79_register_usb();
58 }
59
60 --- a/arch/mips/ath79/mach-db120.c
61 +++ b/arch/mips/ath79/mach-db120.c
62 @@ -134,7 +134,7 @@ static void __init db120_setup(void)
63 ath79_register_spi(&db120_spi_data, db120_spi_info,
64 ARRAY_SIZE(db120_spi_info));
65 ath79_register_usb();
66 - ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET);
67 + ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET, NULL);
68 db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET);
69 }
70
71 --- a/arch/mips/ath79/mach-ap121.c
72 +++ b/arch/mips/ath79/mach-ap121.c
73 @@ -91,7 +91,7 @@ static void __init ap121_setup(void)
74 ath79_register_spi(&ap121_spi_data, ap121_spi_info,
75 ARRAY_SIZE(ap121_spi_info));
76 ath79_register_usb();
77 - ath79_register_wmac(cal_data);
78 + ath79_register_wmac(cal_data, NULL);
79 }
80
81 MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",