ar71xx: pass eeprom and mac address location to the ar913x_add_device_wmac function
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 27 Dec 2009 20:59:50 +0000 (20:59 +0000)
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 27 Dec 2009 20:59:50 +0000 (20:59 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18950 3c298f89-4303-0410-b956-a3cf2f4a3e73

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 342f8de..67eaa83 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "dev-ar913x-wmac.h"
 
 
 #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,
 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,
 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);
 
        ar71xx_device_stop(RESET_MODULE_AMBA2WMAC);
        mdelay(10);
index 1fa0093..72d8d72 100644 (file)
@@ -14,6 +14,6 @@
 #ifndef _AR71XX_DEV_AR913X_WMAC_H
 #define _AR71XX_DEV_AR913X_WMAC_H
 
 #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 */
 
 #endif /* _AR71XX_DEV_AR913X_WMAC_H */
index 0011ba4..1b0b06c 100644 (file)
@@ -107,9 +107,9 @@ static struct gpio_button ap81_gpio_buttons[] __initdata = {
 
 static void __init ap81_setup(void)
 {
 
 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;
        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);
 
                                        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);
index d2cbc21..e72574a 100644 (file)
@@ -194,9 +194,9 @@ static struct spi_board_info ap83_spi_info[] = {
 
 static void __init ap83_generic_setup(void)
 {
 
 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);
 
 
        ar71xx_add_device_mdio(0xfffffffe);
 
@@ -223,7 +223,7 @@ static void __init ap83_generic_setup(void)
 
        ar71xx_add_device_usb();
 
 
        ar71xx_add_device_usb();
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 
        platform_device_register(&ap83_flash_device);
 
 
        platform_device_register(&ap83_flash_device);
 
index 3f1cbeb..b5dde36 100644 (file)
@@ -126,6 +126,8 @@ static struct gpio_button dir_615c1_gpio_buttons[] __initdata = {
 
 static void __init dir_615c1_setup(void)
 {
 
 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;
        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);
 
                                        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup);
index 127d90f..bc75502 100644 (file)
@@ -128,9 +128,9 @@ static struct gpio_button mzk_w04nu_gpio_buttons[] __initdata = {
 
 static void __init mzk_w04nu_setup(void)
 {
 
 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);
 
 
        ar71xx_add_device_mdio(0x0);
 
@@ -156,7 +156,7 @@ static void __init mzk_w04nu_setup(void)
                                        mzk_w04nu_gpio_buttons);
        ar71xx_add_device_usb();
 
                                        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "Planex MZK-W04NU", mzk_w04nu_setup);
index 098c1a6..0e55888 100644 (file)
@@ -127,9 +127,9 @@ static struct gpio_button mzk_w300nh_gpio_buttons[] __initdata = {
 
 static void __init mzk_w300nh_setup(void)
 {
 
 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);
 
 
        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);
        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "Planex MZK-W300NH", mzk_w300nh_setup);
index 00e90da..cb2e16d 100644 (file)
@@ -102,6 +102,8 @@ static struct gpio_button tew_632brp_gpio_buttons[] __initdata = {
 
 static void __init tew_632brp_setup(void)
 {
 
 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;
        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);
 
                                        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TRENDnet TEW-632BRP", tew_632brp_setup);
index f34a4ab..9c6f65e 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);
 static void __init tl_wr1043nd_setup(void)
 {
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
        ar71xx_set_mac_base(mac);
 
 
        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);
        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TP-LINK TL-WR1043ND", tl_wr1043nd_setup);
index da26cc5..7fe5a1c 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);
 static void __init tl_wr941nd_setup(void)
 {
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
 
        ar71xx_set_mac_base(mac);
 
 
        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);
        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);
 }
 
 MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TP-LINK TL-WR941ND", tl_wr941nd_setup);
index 251def8..c07619c 100644 (file)
@@ -116,9 +116,9 @@ static struct gpio_button wnr2000_gpio_buttons[] __initdata = {
 
 static void __init wnr2000_setup(void)
 {
 
 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;
        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);
 
 
                                        wnr2000_gpio_buttons);
 
 
-       ar913x_add_device_wmac();
+       ar913x_add_device_wmac(eeprom, NULL);
 }
 
 MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);
 }
 
 MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);
index 618a4aa..d62ece6 100644 (file)
@@ -112,6 +112,8 @@ static struct gpio_button wrt160nl_gpio_buttons[] __initdata = {
 
 static void __init wrt160nl_setup(void)
 {
 
 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;
        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();
        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);
 
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio),
                                        wrt160nl_leds_gpio);
This page took 0.04287 seconds and 4 git commands to generate.