diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-02-23 10:43:23 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-02-23 10:43:23 +0000 |
commit | 77b57258af4faa86315ccd593d3b6ea5497ae179 (patch) | |
tree | 25575560d33c34d63635ddf3a5549548bd916807 | |
parent | f7cf3b2a68716b0260aa46f286631c2f5a8359b0 (diff) | |
download | mtk-20170518-77b57258af4faa86315ccd593d3b6ea5497ae179.zip mtk-20170518-77b57258af4faa86315ccd593d3b6ea5497ae179.tar.gz mtk-20170518-77b57258af4faa86315ccd593d3b6ea5497ae179.tar.bz2 |
TL-WR941ND: add DSA device for the Marvell 88E6060 switch
SVN-Revision: 14637
3 files changed, 43 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c index 418af2e..fbe8c10 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c @@ -646,3 +646,30 @@ void __init ar91xx_add_device_wmac(void) platform_device_register(&ar91xx_wmac_device); } + +static struct platform_device ar71xx_dsa_switch_device = { + .name = "dsa", + .id = 0, +}; + +void __init ar71xx_add_device_dsa(unsigned int id, + struct dsa_platform_data *d) +{ + switch (id) { + case 0: + d->netdev = &ar71xx_eth0_device.dev; + break; + case 1: + d->netdev = &ar71xx_eth1_device.dev; + break; + default: + printk(KERN_ERR + "ar71xx: invalid ethernet id %d for DSA switch\n", + id); + return; + } + d->mii_bus = &ar71xx_mdio_device.dev; + ar71xx_dsa_switch_device.dev.platform_data = d; + + platform_device_register(&ar71xx_dsa_switch_device); +} diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h index eceb780..2a0472f 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h @@ -13,8 +13,11 @@ #define __AR71XX_DEVICES_H #include <asm/mach-ar71xx/platform.h> + #include <linux/leds.h> #include <linux/gpio_buttons.h> +#include <linux/gpio_buttons.h> +#include <net/dsa.h> void ar71xx_add_device_spi(struct ar71xx_spi_platform_data *pdata, struct spi_board_info const *info, @@ -48,4 +51,7 @@ void ar71xx_add_device_wdt(void) __init; void ar91xx_add_device_wmac(void) __init; +void ar71xx_add_device_dsa(unsigned int id, + struct dsa_platform_data *d) __init; + #endif /* __AR71XX_DEVICES_H */ 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 0809b68..e24707e 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 @@ -108,6 +108,15 @@ static struct gpio_button tl_wr941nd_gpio_buttons[] __initdata = { } }; +static struct dsa_platform_data tl_wr941nd_dsa_data = { + .port_names[0] = "wan", + .port_names[1] = "lan1", + .port_names[2] = "lan2", + .port_names[3] = "lan3", + .port_names[4] = "lan4", + .port_names[5] = "cpu", +}; + static void __init tl_wr941nd_setup(void) { u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); @@ -122,6 +131,7 @@ static void __init tl_wr941nd_setup(void) ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_add_device_eth(0); + ar71xx_add_device_dsa(0, &tl_wr941nd_dsa_data); ar71xx_add_device_spi(NULL, tl_wr941nd_spi_info, ARRAY_SIZE(tl_wr941nd_spi_info)); |