From b47906964d49b129ea92df095b514e950b47cdfd Mon Sep 17 00:00:00 2001 From: juhosg Date: Tue, 12 Apr 2011 09:29:10 +0000 Subject: ar71xx: Add support for WZR-HP-G301NH Add support for the Buffalo WZR-HP-G301NH. The only difference between it and the WZR-HP-G00NH is that it has a RTL8366RB instead of a RTL8366S. Since we don't do runtime detection of the switch, we need a separate machine definition for it. While we are at it, also rename the profile to reflect that it now is for more than one device. Signed-off-by: Jonas Gorski git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26601 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c | 54 +++++++++++++++++++--- .../linux/ar71xx/files/arch/mips/ar71xx/machtype.h | 1 + 2 files changed, 48 insertions(+), 7 deletions(-) (limited to 'target/linux/ar71xx/files') diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c index 383d87b5f..2806f3bf2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -225,21 +226,43 @@ static struct platform_device wzrhpg300nh_rtl8366s_device = { } }; -static void __init wzrhpg300nh_setup(void) +static struct rtl8366rb_platform_data wzrhpg301nh_rtl8366rb_data = { + .gpio_sda = WZRHPG300NH_GPIO_RTL8366_SDA, + .gpio_sck = WZRHPG300NH_GPIO_RTL8366_SCK, +}; + +static struct platform_device wzrhpg301nh_rtl8366rb_device = { + .name = RTL8366RB_DRIVER_NAME, + .id = -1, + .dev = { + .platform_data = &wzrhpg301nh_rtl8366rb_data, + } +}; + +static void __init wzrhpg30xnh_setup(bool hasrtl8366rb) { u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); u8 *mac = eeprom + WZRHPG300NH_MAC_OFFSET; ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0); - ar71xx_eth0_pll_data.pll_1000 = 0x1e000100; - ar71xx_eth0_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; + ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac, 1); + + if (hasrtl8366rb) { + ar71xx_eth0_pll_data.pll_1000 = 0x1f000000; + ar71xx_eth0_data.mii_bus_dev = &wzrhpg301nh_rtl8366rb_device.dev; + ar71xx_eth1_pll_data.pll_1000 = 0x100; + ar71xx_eth1_data.mii_bus_dev = &wzrhpg301nh_rtl8366rb_device.dev; + } else { + ar71xx_eth0_pll_data.pll_1000 = 0x1e000100; + ar71xx_eth0_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; + ar71xx_eth1_pll_data.pll_1000 = 0x1e000100; + ar71xx_eth1_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; + } + ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; - ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac, 1); - ar71xx_eth1_pll_data.pll_1000 = 0x1e000100; - ar71xx_eth1_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth1_data.phy_mask = 0x10; @@ -251,7 +274,11 @@ static void __init wzrhpg300nh_setup(void) platform_device_register(&wzrhpg300nh_74hc153_device); platform_device_register(&wzrhpg300nh_flash_device); - platform_device_register(&wzrhpg300nh_rtl8366s_device); + + if (hasrtl8366rb) + platform_device_register(&wzrhpg301nh_rtl8366rb_device); + else + platform_device_register(&wzrhpg300nh_rtl8366s_device); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpg300nh_leds_gpio), wzrhpg300nh_leds_gpio); @@ -262,5 +289,18 @@ static void __init wzrhpg300nh_setup(void) } +static void __init wzrhpg300nh_setup(void) +{ + wzrhpg30xnh_setup(false); +} + +static void __init wzrhpg301nh_setup(void) +{ + wzrhpg30xnh_setup(true); +} + MIPS_MACHINE(AR71XX_MACH_WZR_HP_G300NH, "WZR-HP-G300NH", "Buffalo WZR-HP-G300NH", wzrhpg300nh_setup); + +MIPS_MACHINE(AR71XX_MACH_WZR_HP_G301NH, "WZR-HP-G301NH", + "Buffalo WZR-HP-G301NH", wzrhpg301nh_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h index e7e57956b..4b2a08ca6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h @@ -61,6 +61,7 @@ enum ar71xx_mach_type { AR71XX_MACH_WRT160NL, /* Linksys WRT160NL */ AR71XX_MACH_WRT400N, /* Linksys WRT400N */ AR71XX_MACH_WZR_HP_G300NH, /* Buffalo WZR-HP-G300NH */ + AR71XX_MACH_WZR_HP_G301NH, /* Buffalo WZR-HP-G301NH */ AR71XX_MACH_EAP7660D, /* Senao EAP7660D */ AR71XX_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */ AR71XX_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */ -- cgit v1.2.3