Signed-off-by: Serge Vasilugin <vasilugin at yandex.ru> Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig =================================================================== --- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (revision 32760) +++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (working copy) @@ -159,6 +159,11 @@ select RALINK_DEV_GPIO_BUTTONS select RALINK_DEV_GPIO_LEDS
+config RT305X_MACH_DIR_620_REVA + bool "D-Link DIR-620 revA board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + endmenu endif Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-620-reva.c =================================================================== --- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-620-reva.c (revision 0) +++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-620-reva.c (revision 0) @@ -0,0 +1,104 @@ +/* + * D-Link DIR-620 rev A board support + * + * Copyright (C) 2009-2010 Gabor Juhos <[email protected]> + * Copyright (C) 2012 Sergey Vasiliugin <[email protected]> + * + * 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 <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_620A_GPIO_LED_STATUS_AMBER 8 +#define DIR_620A_GPIO_LED_STATUS_GREEN 9 +#define DIR_620A_GPIO_LED_WPS_BLUE 11 +#define DIR_620A_GPIO_LED_WPS_GREEN 13 +/* + * NOTE: The wan led is also connected to the switch, both + * switch and gpio must be active to make it light up + */ +#define DIR_620A_GPIO_LED_WAN_GREEN 12 +#define DIR_620A_GPIO_LED_WAN_AMBER 14 + +#define DIR_620A_GPIO_BUTTON_WPS 0 /* active low */ +#define DIR_620A_GPIO_BUTTON_RESET 10 /* active low */ + +#define DIR_620A_KEYS_POLL_INTERVAL 20 +#define DIR_620A_KEYS_DEBOUNCE_INTERVAL (3 * DIR_620A_KEYS_POLL_INTERVAL) + +static struct gpio_led dir_620a_leds_gpio[] __initdata = { + { + .name = "d-link:amber:status", + .gpio = DIR_620A_GPIO_LED_STATUS_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:status", + .gpio = DIR_620A_GPIO_LED_STATUS_GREEN, + .active_low = 1, + }, { + .name = "d-link:amber:wan", + .gpio = DIR_620A_GPIO_LED_WAN_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:wan", + .gpio = DIR_620A_GPIO_LED_WAN_GREEN, + .active_low = 1, + }, { + .name = "d-link:blue:wps", + .gpio = DIR_620A_GPIO_LED_WPS_BLUE, + .active_low = 1, + }, { + .name = "d-link:orange:wps", + .gpio = DIR_620A_GPIO_LED_WPS_GREEN, + .active_low = 1, + } +}; + +static struct gpio_keys_button dir_620a_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = DIR_620A_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_620A_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = DIR_620A_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_620A_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init dir_620a_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_620a_leds_gpio), + dir_620a_leds_gpio); + ramips_register_gpio_buttons(-1, DIR_620A_KEYS_POLL_INTERVAL, + ARRAY_SIZE(dir_620a_gpio_buttons), + dir_620a_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_DIR_620_A1, "DIR-620-A1", "D-Link DIR-620 A1", + dir_620a_init); Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile =================================================================== --- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (revision 32760) +++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (working copy) @@ -43,3 +43,4 @@ obj-$(CONFIG_RT305X_MACH_WL351) += mach-wl351.o obj-$(CONFIG_RT305X_MACH_WR6202) += mach-wr6202.o obj-$(CONFIG_RT305X_MACH_XDX_RN502J) += mach-xdx-rn502j.o +obj-$(CONFIG_RT305X_MACH_DIR_620_REVA) += mach-dir-620-reva.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 32760) +++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h (working copy) @@ -58,6 +58,7 @@ RAMIPS_MACH_WR6202, /* Accton WR6202 */ RAMIPS_MACH_XDXRN502J, /* unknown XDX-RN502J */ RAMIPS_MACH_UR_336UN, /* UPVEL ROUTER */ + RAMIPS_MACH_DIR_620_A1, /* D-Link DIR-620 A1 */ /* RT3662 based machines */ RAMIPS_MACH_RT_N56U, /* Asus RT-N56U */ Index: target/linux/ramips/image/Makefile =================================================================== --- target/linux/ramips/image/Makefile (revision 32760) +++ target/linux/ramips/image/Makefile (working copy) @@ -451,6 +451,10 @@ $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,xdxrn502j,XDXRN502J,ttyS1,57600,phys) endef +define Image/Build/Profile/DIR620A1 + $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_8M,dir-620-a1,DIR-620-A1,ttyS1,57600,phys) +endef + ifeq ($(CONFIG_RALINK_RT305X),y) define Image/Build/Profile/Default $(call Image/Build/Profile/3G6200N,$(1)) @@ -484,6 +488,7 @@ $(call Image/Build/Profile/WR5123GN,$(1)) $(call Image/Build/Profile/WR6202,$(1)) $(call Image/Build/Profile/XDXRN502J,$(1)) + $(call Image/Build/Profile/DIR620A1,$(1)) endef endif Index: target/linux/ramips/rt305x/config-3.3 =================================================================== --- target/linux/ramips/rt305x/config-3.3 (revision 32760) +++ target/linux/ramips/rt305x/config-3.3 (working copy) @@ -119,6 +119,7 @@ CONFIG_RT305X_MACH_WR512_3GN=y CONFIG_RT305X_MACH_WR6202=y CONFIG_RT305X_MACH_XDX_RN502J=y +CONFIG_RT305X_MACH_DIR_620_REVA=y # CONFIG_SCSI_DMA is not set CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RT288X=y Index: target/linux/ramips/base-files/lib/ramips.sh =================================================================== --- target/linux/ramips/base-files/lib/ramips.sh (revision 32760) +++ target/linux/ramips/base-files/lib/ramips.sh (working copy) @@ -167,6 +167,9 @@ *"XDX RN502J") name="xdxrn502j" ;; + *"DIR-620 A1") + name="dir-620-a1" + ;; *) name="generic" ;; Index: target/linux/ramips/base-files/lib/upgrade/platform.sh =================================================================== --- target/linux/ramips/base-files/lib/upgrade/platform.sh (revision 32760) +++ target/linux/ramips/base-files/lib/upgrade/platform.sh (working copy) @@ -20,6 +20,7 @@ dir-300-b1 | \ dir-600-b1 | \ dir-600-b2 | \ + dir-620-a1 | \ esr-9753 | \ fonera20n | \ freestation5 | \ Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac =================================================================== --- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 32760) +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy) @@ -39,7 +39,8 @@ wl-330n |\ wl-330n3g |\ wr6202 |\ - xdxrn502j) + xdxrn502j | \ + dir-620-a1) mac=$(ramips_get_mac_binary factory 40) ifconfig eth0 hw ether $mac 2>/dev/null ;; Index: target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom =================================================================== --- target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (revision 32760) +++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (working copy) @@ -78,6 +78,7 @@ wr512-3gn | \ wr6202 | \ ur-336un | \ + dir-620-a1 | \ xdxrn502j) rt2x00_eeprom_extract "factory" 0 272 ;; Index: target/linux/ramips/base-files/etc/uci-defaults/leds =================================================================== --- target/linux/ramips/base-files/etc/uci-defaults/leds (revision 32760) +++ target/linux/ramips/base-files/etc/uci-defaults/leds (working copy) @@ -26,9 +26,11 @@ ;; dir-300-b1|\ dir-600-b1|\ - dir-600-b2) + dir-600-b2|\ + dir-620-a1) # ANDed with vlan switch port 4 led state ucidef_set_led_default "wan" "WAN LED (amber)" "d-link:amber:wan" "1" + set_wifi_led "rt2800pci-phy0::radio" ;; esr-9753) set_wifi_led "rt2800pci-phy0::radio" Index: target/linux/ramips/base-files/etc/uci-defaults/network =================================================================== --- target/linux/ramips/base-files/etc/uci-defaults/network (revision 32760) +++ target/linux/ramips/base-files/etc/uci-defaults/network (working copy) @@ -98,6 +98,7 @@ psr-680w | \ rt-n15 | \ sl-r7205 | \ + dir-620-a1 | \ wl-351) lan_mac=$(ramips_get_mac_binary factory 4) wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1) Index: target/linux/ramips/base-files/etc/diag.sh =================================================================== --- target/linux/ramips/base-files/etc/diag.sh (revision 32760) +++ target/linux/ramips/base-files/etc/diag.sh (working copy) @@ -36,7 +36,7 @@ argus-atp52b) status_led="argus-atp52b:green:run" ;; - dir-300-b1 | dir-600-b1 | dir-600-b2) + dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-620-a1) status_led="d-link:green:status" ;; esr-9753) _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
