ar71xx: pass eeprom and mac address location to the ar913x_add_device_wmac function
authorGabor Juhos <juhosg@openwrt.org>
Sun, 27 Dec 2009 20:59:50 +0000 (20:59 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 27 Dec 2009 20:59:50 +0000 (20:59 +0000)
SVN-Revision: 18950

12 files changed:
target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c
target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c

index 342f8de28eb191664705752b0ec6b7d6752da25e..67eaa833b8dbdb4423e7f3803a33cf345a9d2bda 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "dev-ar913x-wmac.h"
 
+static struct ath9k_platform_data ar913x_wmac_data;
+static char ar913x_wmac_mac[6];
+
 static struct resource ar913x_wmac_resources[] = {
        {
                .start  = AR91XX_WMAC_BASE,
@@ -34,8 +37,6 @@ static struct resource ar913x_wmac_resources[] = {
        },
 };
 
-static struct ath9k_platform_data ar913x_wmac_data;
-
 static struct platform_device ar913x_wmac_device = {
        .name           = "ath9k",
        .id             = -1,
@@ -46,12 +47,16 @@ static struct platform_device ar913x_wmac_device = {
        },
 };
 
-void __init ar913x_add_device_wmac(void)
+void __init ar913x_add_device_wmac(u8 *cal_data, u8 *mac_addr)
 {
-       u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+       if (cal_data)
+               memcpy(ar913x_wmac_data.eeprom_data, cal_data,
+                      sizeof(ar913x_wmac_data.eeprom_data));
 
-       memcpy(ar913x_wmac_data.eeprom_data, ee,
-              sizeof(ar913x_wmac_data.eeprom_data));
+       if (mac_addr) {
+               memcpy(ar913x_wmac_mac, mac_addr, sizeof(ar913x_wmac_mac));
+               ar913x_wmac_data.macaddr = ar913x_wmac_mac;
+       }
 
        ar71xx_device_stop(RESET_MODULE_AMBA2WMAC);
        mdelay(10);
index 1fa0093e412da48691f66e99cc5de2cb9dd2412e..72d8d72884bf69e1c1a152cf3363e6ba7d5108fb 100644 (file)
@@ -14,6 +14,6 @@
 #ifndef _AR71XX_DEV_AR913X_WMAC_H
 #define _AR71XX_DEV_AR913X_WMAC_H
 
-void ar913x_add_device_wmac(void) __init;
+void ar913x_add_device_wmac(u8 *cal_data, u8 *mac_addr) __init;
 
 #endif /* _AR71XX_DEV_AR913X_WMAC_H */
index 0011ba419a021df2ad0322b5b5c548ff3700492b..1b0b06c7a78b3a9d6ab78d6696065aab4f49648f 100644 (file)
@@ -107,9 +107,9 @@ static struct gpio_button ap81_gpio_buttons[] __initdata = {
 
 static void __init ap81_setup(void)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
-       ar71xx_set_mac_base(mac);
+       ar71xx_set_mac_base(eeprom);
        ar71xx_add_device_mdio(0x0);
 
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
@@ -135,7 +135,7 @@ static void __init ap81_setup(void)
                                        ARRAY_SIZE(ap81_gpio_buttons),
                                        ap81_gpio_buttons);
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);
index d2cbc218748d05cab94afa2ae51c1727e2d040df..e72574ac0912ebf2c21bb6a3154a592301156bec 100644 (file)
@@ -194,9 +194,9 @@ static struct spi_board_info ap83_spi_info[] = {
 
 static void __init ap83_generic_setup(void)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
-       ar71xx_set_mac_base(mac);
+       ar71xx_set_mac_base(eeprom);
 
        ar71xx_add_device_mdio(0xfffffffe);
 
@@ -223,7 +223,7 @@ static void __init ap83_generic_setup(void)
 
        ar71xx_add_device_usb();
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 
        platform_device_register(&ap83_flash_device);
 
index 3f1cbeb3f5862a805c8ede18c49296cc0ed46dd9..b5dde368b6cdbc70a5334111080234a90718a730 100644 (file)
@@ -126,6 +126,8 @@ static struct gpio_button dir_615c1_gpio_buttons[] __initdata = {
 
 static void __init dir_615c1_setup(void)
 {
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
+
        ar71xx_add_device_mdio(0x0);
 
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
@@ -148,7 +150,7 @@ static void __init dir_615c1_setup(void)
                                        ARRAY_SIZE(dir_615c1_gpio_buttons),
                                        dir_615c1_gpio_buttons);
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup);
index 127d90f26ad1258975368167436ae2a1b39191fa..bc755022f3359d4df0f1f2c7640bdf346edd5d15 100644 (file)
@@ -128,9 +128,9 @@ static struct gpio_button mzk_w04nu_gpio_buttons[] __initdata = {
 
 static void __init mzk_w04nu_setup(void)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
-       ar71xx_set_mac_base(mac);
+       ar71xx_set_mac_base(eeprom);
 
        ar71xx_add_device_mdio(0x0);
 
@@ -156,7 +156,7 @@ static void __init mzk_w04nu_setup(void)
                                        mzk_w04nu_gpio_buttons);
        ar71xx_add_device_usb();
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "Planex MZK-W04NU", mzk_w04nu_setup);
index 098c1a60608e3dd27d65be72e24fb660e0c0e989..0e55888523b0ee274a2501932bf03cfcd7a4809d 100644 (file)
@@ -127,9 +127,9 @@ static struct gpio_button mzk_w300nh_gpio_buttons[] __initdata = {
 
 static void __init mzk_w300nh_setup(void)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
-       ar71xx_set_mac_base(mac);
+       ar71xx_set_mac_base(eeprom);
 
        ar71xx_add_device_mdio(0x0);
 
@@ -153,7 +153,7 @@ static void __init mzk_w300nh_setup(void)
        ar71xx_add_device_gpio_buttons(-1, MZK_W04NU_BUTTONS_POLL_INTERVAL,
                                       ARRAY_SIZE(mzk_w300nh_gpio_buttons),
                                       mzk_w300nh_gpio_buttons);
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "Planex MZK-W300NH", mzk_w300nh_setup);
index 00e90da07966adc23c3545474c4e4f180ee1f7dc..cb2e16d25fa7ea59c905a1f70750c5e0b154e778 100644 (file)
@@ -102,6 +102,8 @@ static struct gpio_button tew_632brp_gpio_buttons[] __initdata = {
 
 static void __init tew_632brp_setup(void)
 {
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
+
        ar71xx_add_device_mdio(0x0);
 
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
@@ -124,7 +126,7 @@ static void __init tew_632brp_setup(void)
                                        ARRAY_SIZE(tew_632brp_gpio_buttons),
                                        tew_632brp_gpio_buttons);
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TRENDnet TEW-632BRP", tew_632brp_setup);
index f34a4ab61300be6912e8934448092c859e1f5676..9c6f65e93b245c98585a776d24357e12c524d1e5 100644 (file)
@@ -107,6 +107,7 @@ static struct gpio_button tl_wr1043nd_gpio_buttons[] __initdata = {
 static void __init tl_wr1043nd_setup(void)
 {
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
        ar71xx_set_mac_base(mac);
 
@@ -129,7 +130,7 @@ static void __init tl_wr1043nd_setup(void)
        ar71xx_add_device_gpio_buttons(-1, TL_WR1043ND_BUTTONS_POLL_INTERVAL,
                                        ARRAY_SIZE(tl_wr1043nd_gpio_buttons),
                                        tl_wr1043nd_gpio_buttons);
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TP-LINK TL-WR1043ND", tl_wr1043nd_setup);
index da26cc51bb8b355796c2a8ef1105d3d12e6385ff..7fe5a1cbc54277d7928a17806f89829711b32a85 100644 (file)
@@ -111,6 +111,7 @@ static struct dsa_platform_data tl_wr941nd_dsa_data = {
 static void __init tl_wr941nd_setup(void)
 {
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
        ar71xx_set_mac_base(mac);
 
@@ -132,7 +133,7 @@ static void __init tl_wr941nd_setup(void)
        ar71xx_add_device_gpio_buttons(-1, TL_WR941ND_BUTTONS_POLL_INTERVAL,
                                        ARRAY_SIZE(tl_wr941nd_gpio_buttons),
                                        tl_wr941nd_gpio_buttons);
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, mac);
 }
 
 MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TP-LINK TL-WR941ND", tl_wr941nd_setup);
index 251def844eddbc57e0af4a12b8602a2fa91a4d14..c07619c163123fa82ddc03954926eb4046f047b6 100644 (file)
@@ -116,9 +116,9 @@ static struct gpio_button wnr2000_gpio_buttons[] __initdata = {
 
 static void __init wnr2000_setup(void)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
-       ar71xx_set_mac_base(mac);
+       ar71xx_set_mac_base(eeprom);
        ar71xx_add_device_mdio(0x0);
 
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
@@ -143,7 +143,7 @@ static void __init wnr2000_setup(void)
                                        wnr2000_gpio_buttons);
 
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);
index 618a4aa0ba468006b54083301132ba8d131e2975..d62ece6ff6735cd03289607004b9cca50aabd38c 100644 (file)
@@ -112,6 +112,8 @@ static struct gpio_button wrt160nl_gpio_buttons[] __initdata = {
 
 static void __init wrt160nl_setup(void)
 {
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
+
        ar71xx_add_device_mdio(0x0);
 
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
@@ -126,7 +128,7 @@ static void __init wrt160nl_setup(void)
        ar71xx_add_device_m25p80(&wrt160nl_flash_data);
 
        ar71xx_add_device_usb();
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio),
                                        wrt160nl_leds_gpio);