This patch adds support for the China made SL-R7205 Wireless 3G router. The platform is based on Ralink RT3052 and it can be found here at http://www.made-in-china.com/showroom/sissiliuwenxi/product-detailubHnaSVOnXcP/China-Wireless-3G-Router-SL-R7205-.html .
I also added the hotplug gpio-button for factory reset and wps (shared). Signed-off-by: Haipoh Teoh <[email protected]> --- diff -urN trunk/target/linux/ramips/base-files/etc/diag.sh sl-r7205/target/linux/ramips/base-files/etc/diag.sh --- trunk/target/linux/ramips/base-files/etc/diag.sh 2012-02-08 11:42:22.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/etc/diag.sh 2012-02-13 11:05:04.000000000 +0800 @@ -87,6 +87,9 @@ wr512-3gn) status_led="wr512:green:wps" ;; + sl-r7205) + status_led="sl-r7205:green:status" + ;; esac } diff -urN trunk/target/linux/ramips/base-files/etc/hotplug.d/button/00-button sl-r7205/target/linux/ramips/base-files/etc/hotplug.d/button/00-button --- trunk/target/linux/ramips/base-files/etc/hotplug.d/button/00-button 1970-01-01 07:30:00.000000000 +0730 +++ sl-r7205/target/linux/ramips/base-files/etc/hotplug.d/button/00-button 2012-02-10 08:51:40.000000000 +0800 @@ -0,0 +1,22 @@ +# +# This hotplug script does two things +# 1. Factory default reset - 5 to 10 seconds +# 2. WPS-PBC or QSS - 0 to 3 seconds +# + +[ "$ACTION" = "released" -a "$BUTTON" = "reset" ] && { + + if [ 0 -le $SEEN -a 3 -ge $SEEN ] ; then + + for dir in /var/run/hostapd-*; do + [ -d "$dir" ] || continue + hostapd_cli -p "$dir" wps_pbc + done + + elif [ 5 -le $SEEN -a 10 -ge $SEEN ] ; then + + echo "none" > /sys/devices/platform/rt2800_wmac.0/leds/rt2800pci-phy0::radio/trigger + firstboot && reboot + + fi +} \ No newline at end of file diff -urN trunk/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom sl-r7205/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom --- trunk/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom 2012-02-13 11:02:46.000000000 +0800 @@ -65,7 +65,8 @@ wl-351 | \ wli-tx4-ag300n | \ wr512-3gn | \ - wr6202) + wr6202 | \ + sl-r7205) rt2x00_eeprom_extract "factory" 0 272 ;; diff -urN trunk/target/linux/ramips/base-files/etc/uci-defaults/leds sl-r7205/target/linux/ramips/base-files/etc/uci-defaults/leds --- trunk/target/linux/ramips/base-files/etc/uci-defaults/leds 2012-02-08 11:42:22.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/etc/uci-defaults/leds 2012-02-13 11:07:27.000000000 +0800 @@ -67,4 +67,7 @@ wcr-150gn) set_usb_led "wcr150gn:amber:user" ;; + sl-r7205) + set_wifi_led "rt2800pci-phy0::radio" + ;; esac diff -urN trunk/target/linux/ramips/base-files/etc/uci-defaults/network sl-r7205/target/linux/ramips/base-files/etc/uci-defaults/network --- trunk/target/linux/ramips/base-files/etc/uci-defaults/network 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/etc/uci-defaults/network 2012-02-13 11:13:25.000000000 +0800 @@ -24,7 +24,8 @@ b2c | \ nw718 | \ w502u | \ - wr6202) + wr6202 | \ + sl-r7205) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ;; @@ -85,7 +86,8 @@ f5d8235-v1 | \ nw718 | \ rt-n15 | \ - wl-351) + wl-351 | \ + sl-r7205) lan_mac=$(ramips_get_mac_binary factory 4) wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1) ;; diff -urN trunk/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac sl-r7205/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac --- trunk/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac 2012-02-13 11:24:51.000000000 +0800 @@ -10,7 +10,8 @@ case $(ramips_board_name) in bc2 |\ nw718 |\ - esr-9753) + esr-9753 | \ + sl-r7205) mac=$(ramips_get_mac_binary factory 4) mac=$(maccalc or "$mac" "02:00:00:00:00:00") ifconfig eth0 hw ether $mac 2>/dev/null diff -urN trunk/target/linux/ramips/base-files/lib/ramips.sh sl-r7205/target/linux/ramips/base-files/lib/ramips.sh --- trunk/target/linux/ramips/base-files/lib/ramips.sh 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/lib/ramips.sh 2012-02-15 14:35:26.000000000 +0800 @@ -131,6 +131,9 @@ *"AWB WR6202") name="wr6202" ;; + *"SL_R7205") + name="sl-r7205" + ;; *) name="generic" ;; diff -urN trunk/target/linux/ramips/base-files/lib/upgrade/platform.sh sl-r7205/target/linux/ramips/base-files/lib/upgrade/platform.sh --- trunk/target/linux/ramips/base-files/lib/upgrade/platform.sh 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/base-files/lib/upgrade/platform.sh 2012-02-13 11:27:50.000000000 +0800 @@ -34,7 +34,8 @@ wl341v3 | \ wli-tx4-ag300n | \ whr-g300n |\ - wr512-3gn) + wr512-3gn | \ + sl-r7205) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 diff -urN trunk/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h sl-r7205/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h --- trunk/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h 2012-02-15 13:57:48.000000000 +0800 @@ -46,4 +46,5 @@ RAMIPS_MACH_WL351, /* Sitecom WL-351 v1 002 */ RAMIPS_MACH_WR512_3GN, /* SH-WR512NU/WS-WR512N1-like 3GN*/ RAMIPS_MACH_WR6202, /* Accton WR6202 */ + RAMIPS_MACH_SL_R7205, /* Wireless 3G Router SL-R7205 */ }; diff -urN trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig sl-r7205/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig --- trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig 2012-02-13 11:32:40.000000000 +0800 @@ -111,6 +111,11 @@ select RALINK_DEV_GPIO_BUTTONS select RALINK_DEV_GPIO_LEDS +config RT305X_MACH_SL_R7205 + bool "Wireless 3G Router SL-R7205 support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + endmenu endif diff -urN trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c sl-r7205/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c --- trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c 1970-01-01 07:30:00.000000000 +0730 +++ sl-r7205/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c 2012-02-15 14:01:45.000000000 +0800 @@ -0,0 +1,113 @@ +/* + * Wireless 3G Router SL-R7205 board support + * + * Copyright (C) 2012 Haipoh Teoh <[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 <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 SL_R7205_GPIO_BUTTON_WPS 0 +#define SL_R7205_GPIO_BUTTON_RESET 10 /* active low */ + +#define SL_R7205_GPIO_LED_WIFI 7 + +#define SL_R7205_KEYS_POLL_INTERVAL 20 +#define SL_R7205_KEYS_DEBOUNCE_INTERVAL (3 * SL_R7205_KEYS_POLL_INTERVAL) + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition sl_r7205_partitions[] = { + { + .name = "u-boot", + .offset = 0, + .size = 0x030000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "u-boot-env", + .offset = 0x030000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "factory", + .offset = 0x040000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "kernel", + .offset = 0x050000, + .size = 0x0a0000, + }, { + .name = "rootfs", + .offset = 0x150000, + .size = 0x2b0000, + }, { + .name = "firmware", + .offset = 0x050000, + .size = 0x3b0000, + } +}; +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct gpio_led sl_r7205_leds_gpio[] __initdata = { + { + .name = "sl_r7205:green:wifi", + .gpio = SL_R7205_GPIO_LED_WIFI, + .active_low = 1, + } +}; + +static struct gpio_keys_button sl_r7205_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = SL_R7205_KEYS_DEBOUNCE_INTERVAL, + .gpio = SL_R7205_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = SL_R7205_KEYS_DEBOUNCE_INTERVAL, + .gpio = SL_R7205_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init sl_r7205_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_flash0_data.nr_parts = ARRAY_SIZE(sl_r7205_partitions); + rt305x_flash0_data.parts = sl_r7205_partitions; + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(sl_r7205_leds_gpio), + sl_r7205_leds_gpio); + ramips_register_gpio_buttons(-1, SL_R7205_KEYS_POLL_INTERVAL, + ARRAY_SIZE(sl_r7205_gpio_buttons), + sl_r7205_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_SL_R7205, "SL_R7205", "Wireless 3G Router SL_R7205", + sl_r7205_init); diff -urN trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile sl-r7205/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile --- trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile 2012-02-13 11:33:58.000000000 +0800 @@ -33,3 +33,4 @@ obj-$(CONFIG_RT305X_MACH_WL341V3) += mach-wl341v3.o obj-$(CONFIG_RT305X_MACH_WL351) += mach-wl351.o obj-$(CONFIG_RT305X_MACH_WR6202) += mach-wr6202.o +obj-$(CONFIG_RT305X_MACH_SL_R7205) += mach-sl-r7205.o diff -urN trunk/target/linux/ramips/image/Makefile sl-r7205/target/linux/ramips/image/Makefile --- trunk/target/linux/ramips/image/Makefile 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/image/Makefile 2012-02-15 14:34:42.000000000 +0800 @@ -313,6 +313,10 @@ $(call Image/Build/Template/GENERIC_8M,$(1),wr512-3gn-8M,WR512-3GN) endef +define Image/Build/Profile/SLR7205 + $(call Image/Build/Template/GENERIC_4M,$(1),sl-r7205,SL_R7205) +endef + ifeq ($(CONFIG_RALINK_RT305X),y) define Image/Build/Profile/Default $(call Image/Build/Profile/ARGUS_ATP52B,$(1)) @@ -337,6 +341,7 @@ $(call Image/Build/Profile/WL341V3,$(1)) $(call Image/Build/Profile/WL351,$(1)) $(call Image/Build/Profile/WR6202,$(1)) + $(call Image/Build/Profile/SLR7205,$(1)) endef endif diff -urN trunk/target/linux/ramips/Makefile sl-r7205/target/linux/ramips/Makefile --- trunk/target/linux/ramips/Makefile 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/Makefile 2012-02-15 10:55:02.000000000 +0800 @@ -13,7 +13,7 @@ CFLAGS:=-Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves FEATURES:=squashfs -LINUX_VERSION:=3.2.5 +LINUX_VERSION:=2.6.39.4 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES+=\ diff -urN trunk/target/linux/ramips/rt305x/config-2.6.39 sl-r7205/target/linux/ramips/rt305x/config-2.6.39 --- trunk/target/linux/ramips/rt305x/config-2.6.39 2012-02-13 10:22:20.000000000 +0800 +++ sl-r7205/target/linux/ramips/rt305x/config-2.6.39 2012-02-13 11:58:28.000000000 +0800 @@ -114,6 +114,7 @@ CONFIG_RT305X_MACH_WL351=y CONFIG_RT305X_MACH_WR512_3GN=y CONFIG_RT305X_MACH_WR6202=y +CONFIG_RT305X_MACH_SL_R7205=y # CONFIG_SCSI_DMA is not set CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RT288X=y
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
