ar71xx: pass eeprom and mac address location to the ar913x_add_device_wmac function

SVN-Revision: 18950
This commit is contained in:
Gabor Juhos 2009-12-27 20:59:50 +00:00
parent 828221c683
commit 86a8480788
12 changed files with 40 additions and 27 deletions

View 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);

View 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 */

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);