This patch adds support for the D-Link DIR-600 Rev B2 (ramips rt305x).

Signed-off-by: Layne Edwards <ledwa...@astrumtech.net>



Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig   (revision 26505)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig   (working copy)
@@ -20,6 +20,12 @@
        select RALINK_DEV_GPIO_BUTTONS
        select RALINK_DEV_GPIO_LEDS
 
+config RT305X_MACH_DIR_600_REVB
+       bool "D-Link DIR-600 revB board support"
+       default y
+       select RALINK_DEV_GPIO_BUTTONS
+       select RALINK_DEV_GPIO_LEDS
+
 config RT305X_MACH_V22RW_2X2
        bool "Ralink AP-RT3052-V22RW-2X2 board support"
        default y
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-600-revb.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-600-revb.c       
(revision 0)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-600-revb.c       
(revision 0)
@@ -0,0 +1,124 @@
+/*
+ *  D-Link DIR-600 Rev B board support
+ *
+ *  Copyright (C) 2011 Layne Edwards <ledward...@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+#include <asm/mach-ralink/machine.h>
+#include <asm/mach-ralink/dev-gpio-buttons.h>
+#include <asm/mach-ralink/dev-gpio-leds.h>
+#include <asm/mach-ralink/rt305x.h>
+#include <asm/mach-ralink/rt305x_regs.h>
+
+#include "devices.h"
+
+#define DIR_600B_GPIO_LED_STATUS_AMBER 8
+#define DIR_600B_GPIO_LED_STATUS_GREEN 9
+#define DIR_600B_GPIO_LED_WPS          13
+
+#define DIR_600B_GPIO_BUTTON_WPS       0       /* active low */
+#define DIR_600B_GPIO_BUTTON_RESET     10      /* active low */
+
+#define DIR_600B_BUTTONS_POLL_INTERVAL 20
+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition dir_600b_partitions[] = {
+       {
+               .name   = "u-boot",
+               .offset = 0,
+               .size   = 0x030000,
+               .mask_flags = MTD_WRITEABLE,
+       }, {
+               .name   = "devdata",
+               .offset = 0x030000,
+               .size   = 0x010000,
+               .mask_flags = MTD_WRITEABLE,
+       }, {
+               .name   = "devconf",
+               .offset = 0x040000,
+               .size   = 0x010000,
+               .mask_flags = MTD_WRITEABLE,
+       }, {
+               .name   = "kernel",
+               .offset = 0x050000,
+               .size   = 0x0f0000,
+       }, {
+               .name   = "rootfs",
+               .offset = 0x140000,
+               .size   = 0x2B0000,
+       }, {
+               .name   = "openwrt",
+               .offset = 0x050000,
+               .size   = 0x3a0000,
+       }
+};
+#endif /* CONFIG_MTD_PARTITIONS */
+
+static struct physmap_flash_data dir_600b_flash_data = {
+#ifdef CONFIG_MTD_PARTITIONS
+       .nr_parts       = ARRAY_SIZE(dir_600b_partitions),
+       .parts          = dir_600b_partitions,
+#endif
+};
+
+static struct gpio_led dir_600b_leds_gpio[] __initdata = {
+       {
+               .name           = "dir-600b:amber:status",
+               .gpio           = DIR_600B_GPIO_LED_STATUS_AMBER,
+               .active_low     = 1,
+       }, {
+               .name           = "dir-600b:green:status",
+               .gpio           = DIR_600B_GPIO_LED_STATUS_GREEN,
+               .active_low     = 1,
+       }, {
+               .name           = "dir-600b:blue:wps",
+               .gpio           = DIR_600B_GPIO_LED_WPS,
+               .active_low     = 1,
+       }
+};
+
+static struct gpio_button dir_600b_gpio_buttons[] __initdata = {
+       {
+               .desc           = "reset",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .threshold      = 3,
+               .gpio           = DIR_600B_GPIO_BUTTON_RESET,
+               .active_low     = 1,
+       }, {
+               .desc           = "wps",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .threshold      = 3,
+               .gpio           = DIR_600B_GPIO_BUTTON_WPS,
+               .active_low     = 1,
+       }
+};
+
+static void __init dir_600b_init(void)
+{
+       rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
+
+       rt305x_register_flash(0, &dir_600b_flash_data);
+       rt305x_register_ethernet();
+       ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_600b_leds_gpio),
+                                 dir_600b_leds_gpio);
+       ramips_register_gpio_buttons(-1, DIR_600B_BUTTONS_POLL_INTERVAL,
+                                    ARRAY_SIZE(dir_600b_gpio_buttons),
+                                    dir_600b_gpio_buttons);
+       rt305x_register_wifi();
+       rt305x_register_wdt();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_DIR_600_REVB, "DIR-600-revB", "D-Link DIR-600 revB",
+            dir_600b_init);
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile  (revision 26505)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile  (working copy)
@@ -13,6 +13,7 @@
 
 obj-$(CONFIG_RT305X_MACH_F5D8235_V2)    += mach-f5d8235-v2.o
 obj-$(CONFIG_RT305X_MACH_DIR_300_REVB) += mach-dir-300-revb.o
+obj-$(CONFIG_RT305X_MACH_DIR_600_REVB) += mach-dir-600-revb.o
 obj-$(CONFIG_RT305X_MACH_V22RW_2X2)    += mach-v22rw-2x2.o
 obj-$(CONFIG_RT305X_MACH_WCR150GN)     += mach-wcr150gn.o
 obj-$(CONFIG_RT305X_MACH_WHR_G300N)    += mach-whr-g300n.o
Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
===================================================================
--- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h       
(revision 26505)
+++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h       
(working copy)
@@ -19,6 +19,7 @@
 
        /* RT3050 based machines */
        RAMIPS_MACH_DIR_300_REVB,       /* D-Link DIR-300 rev B */
+       RAMIPS_MACH_DIR_600_REVB,       /* D-Link DIR-600 rev B */
 
        /* RT3052 based machines */
        RAMIPS_MACH_F5D8235_V2,         /* Belkin F5D8235 v2 */
Index: target/linux/ramips/image/Makefile
===================================================================
--- target/linux/ramips/image/Makefile  (revision 26505)
+++ target/linux/ramips/image/Makefile  (working copy)
@@ -84,6 +84,10 @@
        $(call Image/Build/Template/GENERIC_4M,$(1),dir-300-b1,DIR-300-revB)
 endef
 
+define Image/Build/Profile/DIR600B2
+       $(call Image/Build/Template/GENERIC_4M,$(1),dir-600-b2,DIR-600-revB)
+endef
+
 define Image/Build/Profile/FONERA20N
        $(call Image/Build/Template/GENERIC_8M,$(1),fonera20n,FONERA20N)
 endef
@@ -135,6 +139,7 @@
 ifeq ($(CONFIG_RALINK_RT305X),y)
 define Image/Build/Profile/Default
        $(call Image/Build/Profile/DIR300B1,$(1))
+       $(call Image/Build/Profile/DIR600B2,$(1))
        $(call Image/Build/Profile/FONERA20N,$(1))
        $(call Image/Build/Profile/V22RW2X2,$(1))
        $(call Image/Build/Profile/PWH2004,$(1))
Index: target/linux/ramips/rt305x/config-2.6.37
===================================================================
--- target/linux/ramips/rt305x/config-2.6.37    (revision 26505)
+++ target/linux/ramips/rt305x/config-2.6.37    (working copy)
@@ -92,6 +92,7 @@
 CONFIG_RALINK_RT305X=y
 CONFIG_RAMIPS_WDT=y
 CONFIG_RT305X_MACH_DIR_300_REVB=y
+CONFIG_RT305X_MACH_DIR_600_REVB=y
 CONFIG_RT305X_MACH_F5D8235_V2=y
 CONFIG_RT305X_MACH_FONERA20N=y
 CONFIG_RT305X_MACH_HW550_3G=y
Index: target/linux/ramips/base-files/lib/ramips.sh
===================================================================
--- target/linux/ramips/base-files/lib/ramips.sh        (revision 26505)
+++ target/linux/ramips/base-files/lib/ramips.sh        (working copy)
@@ -13,6 +13,9 @@
        *"DIR-300 revB")
                name="dir-300-b1"
                ;;
+       *"DIR-600 revB")
+               name="dir-600-b2"
+               ;;
        *"La Fonera 2.0N")
                name="fonera20n"
                ;;
Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ramips/base-files/lib/upgrade/platform.sh      (revision 26505)
+++ target/linux/ramips/base-files/lib/upgrade/platform.sh      (working copy)
@@ -14,7 +14,7 @@
        [ "$ARGC" -gt 1 ] && return 1
 
        case "$board" in
-       dir-300-b1 | fonera20n | v22rw-2x2 | whr-g300n | hw550-3g | 
mofi3500-3gn)
+       dir-300-b1 | dir-600-b2 | fonera20n | v22rw-2x2 | whr-g300n | hw550-3g 
| mofi3500-3gn)
                [ "$magic" != "2705" ] && {
                        echo "Invalid image type."
                        return 1
Index: target/linux/ramips/base-files/etc/diag.sh
===================================================================
--- target/linux/ramips/base-files/etc/diag.sh  (revision 26505)
+++ target/linux/ramips/base-files/etc/diag.sh  (working copy)
@@ -33,6 +33,9 @@
        dir-300-b1)
                status_led="dir-300b:green:status"
                ;;
+       dir-600-b2)
+               status_led="dir-600b:green:status"
+               ;;
        fonera20n)
                status_led="fonera20n:green:power"
                ;;

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to