#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 ath9k_platform_data ar913x_wmac_data;
-
static struct platform_device ar913x_wmac_device = {
.name = "ath9k",
.id = -1,
},
};
-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);
#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 */
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;
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);
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_usb();
- ar913x_add_device_wmac();
+ ar913x_add_device_wmac(eeprom, NULL);
platform_device_register(&ap83_flash_device);
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;
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);
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);
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);
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_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);
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;
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);
static void __init tl_wr1043nd_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
ar71xx_set_mac_base(mac);
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);
static void __init tl_wr941nd_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
ar71xx_set_mac_base(mac);
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);
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;
wnr2000_gpio_buttons);
- ar913x_add_device_wmac();
+ ar913x_add_device_wmac(eeprom, NULL);
}
MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);
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_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);