diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-12-27 20:59:50 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-12-27 20:59:50 +0000 |
commit | 86a8480788f408731daef0fee27e9082f146eaee (patch) | |
tree | c2a49636d0be78bce72057883ac9913367a96bb1 /target/linux/ar71xx | |
parent | 828221c6834cf9693a5458546827bbdc6063db9c (diff) | |
download | upstream-86a8480788f408731daef0fee27e9082f146eaee.tar.gz upstream-86a8480788f408731daef0fee27e9082f146eaee.tar.bz2 upstream-86a8480788f408731daef0fee27e9082f146eaee.zip |
ar71xx: pass eeprom and mac address location to the ar913x_add_device_wmac function
SVN-Revision: 18950
Diffstat (limited to 'target/linux/ar71xx')
12 files changed, 40 insertions, 27 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c index 342f8de28e..67eaa833b8 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h index 1fa0093e41..72d8d72884 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h @@ -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 */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c index 0011ba419a..1b0b06c7a7 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c index d2cbc21874..e72574ac09 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c index 3f1cbeb3f5..b5dde368b6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c index 127d90f26a..bc755022f3 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c index 098c1a6060..0e55888523 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c index 00e90da079..cb2e16d25f 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c index f34a4ab613..9c6f65e93b 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c index da26cc51bb..7fe5a1cbc5 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c index 251def844e..c07619c163 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c index 618a4aa0ba..d62ece6ff6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c @@ -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); |