ar71xx: Add support for WZR-HP-G301NH
authorGabor Juhos <juhosg@openwrt.org>
Tue, 12 Apr 2011 09:29:10 +0000 (09:29 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Tue, 12 Apr 2011 09:29:10 +0000 (09:29 +0000)
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 <jonas.gorski+openwrt@gmail.com>
SVN-Revision: 26601

target/linux/ar71xx/base-files/etc/defconfig/wzr-hp-g301nh/network [new file with mode: 0644]
target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/uci-defaults/wzr-hp-g300nh
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c
target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
target/linux/ar71xx/generic/profiles/buffalo.mk
target/linux/ar71xx/image/Makefile

diff --git a/target/linux/ar71xx/base-files/etc/defconfig/wzr-hp-g301nh/network b/target/linux/ar71xx/base-files/etc/defconfig/wzr-hp-g301nh/network
new file mode 100644 (file)
index 0000000..72a4c88
--- /dev/null
@@ -0,0 +1,26 @@
+config interface loopback
+       option ifname   lo
+       option proto    static
+       option ipaddr   127.0.0.1
+       option netmask  255.0.0.0
+
+config interface lan
+       option ifname   eth0.1
+       option type     bridge
+       option proto    static
+       option ipaddr   192.168.1.1
+       option netmask  255.255.255.0
+
+config interface wan
+       option ifname   eth1
+       option proto    dhcp
+
+config switch
+       option name     rtl8366rb
+       option reset    1
+       option enable_vlan 1
+
+config switch_vlan
+       option device   rtl8366rb
+       option vlan     1
+       option ports    "0 1 2 3 5t"
index d61a78d83ef1cd882567f6810f1313ab69c5de1c..6cd6043f8f9543bece12a5ea5c5e2c538d7f3892 100755 (executable)
@@ -123,7 +123,7 @@ get_status_led() {
        wrt160nl)
                status_led="wrt160nl:blue:wps"
                ;;
-       wzr-hp-g300nh)
+       wzr-hp-g300nh | wzr-hp-g301nh)
                status_led="wzr-hp-g300nh:green:router"
                ;;
        zcn-1523h-2 | zcn-1523h-5)
index 1308a7bb04a585bc8be976a96beec1ff92089718..1448e1f9a5e79a7e7dd6ecf12a96dde4e9023943 100755 (executable)
@@ -32,6 +32,6 @@ commit system
 EOF
 }
 
-if [ "${board}" == "wzr-hp-g300nh" ]; then
+if [ "${board}" == "wzr-hp-g300nh" || "${board}" == "wzr-hp-g301nh" ]; then
        wzrhpg300nh_set_leds
 fi
index 15f3250e805efff70abf65e49b22451da7a2fd68..25915616fda630275f4306c40401cda9a9bc2887 100755 (executable)
@@ -148,6 +148,9 @@ ar71xx_board_name() {
        *WZR-HP-G300NH)
                name="wzr-hp-g300nh"
                ;;
+       *WZR-HP-G301NH)
+               name="wzr-hp-g301nh"
+               ;;
        *ZCN-1523H-2)
                name="zcn-1523h-2"
                ;;
index f0fdd88378d7914f69ebc94bb91c4a16f2842c8d..4ccacf4ef1ebfbc1c11c2dc1f7cc282f41d2766a 100755 (executable)
@@ -69,7 +69,7 @@ platform_check_image() {
        [ "$ARGC" -gt 1 ] && return 1
 
        case "$board" in
-       ap81 | ap83 | dir-600-a1 | dir-615-c1 | dir-825-b1 | mzk-w04nu | mzk-w300nh | tew-632brp | wrt400n | bullet-m | nanostation-m | rocket-m | wzr-hp-g300nh | nbg460n_550n_550nh | unifi )
+       ap81 | ap83 | dir-600-a1 | dir-615-c1 | dir-825-b1 | mzk-w04nu | mzk-w300nh | tew-632brp | wrt400n | bullet-m | nanostation-m | rocket-m | wzr-hp-g300nh | wzr-hp-g301nh | nbg460n_550n_550nh | unifi )
                [ "$magic" != "2705" ] && {
                        echo "Invalid image type."
                        return 1
index 383d87b5f4b42fd8e5a9ea51244d20cfbf7b26e9..2806f3bf28e87ae108abac32c46cf8ca1fb99423 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/nxp_74hc153.h>
 #include <linux/rtl8366s.h>
+#include <linux/rtl8366rb.h>
 
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
@@ -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);
index e7e57956b22272bde9103fd1367eaf7a3d60c1c0..4b2a08ca6f9a4d6df31052a1c2d9343ae9a91e7f 100644 (file)
@@ -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 */
index 35c7cc34b6b8b0df740136edd69f30ada5fba877..59ddd86cb37f9831f2d384bac70033806c80147f 100644 (file)
@@ -5,13 +5,13 @@
 # See /LICENSE for more information.
 #
 
-define Profile/WZRHPG300NH
-       NAME:=Buffalo WZR-HP-G300NH
+define Profile/WZRHPG30XNH
+       NAME:=Buffalo WZR-HP-G30XNH
        PACKAGES:=kmod-ath9k wpad-mini kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
 endef
 
-define Profile/WZRHPG300NH/Description
-       Package set optimized for the Buffalo WZR-HP-G300NH
+define Profile/WZRHPG30XNH/Description
+       Package set optimized for the Buffalo WZR-HP-G300NH and WZR-HP-G301NH
 endef
 
-$(eval $(call Profile,WZRHPG300NH))
+$(eval $(call Profile,WZRHPG30XNH))
index ca5e2804282a06a167747f069e18a6fc26c17aac..e7d2f0efa202239fe881c8b26258a78bcbce26ad 100644 (file)
@@ -118,7 +118,7 @@ define Image/Build/DIR825B1
        fi; fi
 endef
 
-define Image/Build/WZRHPG300NH
+define Image/Build/WZRHPG30XNH
        $(call PatchKernelLzma,$(2),$(3))
        if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1048576 ]; then \
                echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
@@ -688,8 +688,9 @@ define Image/Build/Profile/WRT160NL
        $(call Image/Build/Template/$(fs_64k)/$(1),CyberTAN,wrt160nl,board=WRT160NL,1.00.01)
 endef
 
-define Image/Build/Profile/WZRHPG300NH
-       $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG300NH,wzr-hp-g300nh,board=WZR-HP-G300NH)
+define Image/Build/Profile/WZRHPG30XNH
+       $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g300nh,board=WZR-HP-G300NH)
+       $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g301nh,board=WZR-HP-G301NH)
 endef
 
 define Image/Build/Profile/ZCN1523H28
@@ -740,7 +741,7 @@ define Image/Build/Profile/Default
        $(call Image/Build/Profile/AP96,$(1))
        $(call Image/Build/Profile/WRT400N,$(1))
        $(call Image/Build/Profile/WRT160NL,$(1))
-       $(call Image/Build/Profile/WZRHPG300NH,$(1))
+       $(call Image/Build/Profile/WZRHPG30XNH,$(1))
        $(call Image/Build/Profile/ZCN1523H28,$(1))
        $(call Image/Build/Profile/ZCN1523H516,$(1))
 endef