Add support for unknown router name/model, PCB marked with XDX-RN502R V2.0 Known names:
* Bococom DWR-150 * TopLink RT-3GWT * CDR-King CW-G3 * Widemac SL-R7206 This patch is also available here: https://github.com/elecnix/openwrt/commit/9c10f085d997b22326d20e454d056d0d8baa70b6 $ git show <commit id> commit 9c10f085d997b22326d20e454d056d0d8baa70b6 Author: Nicolas Marchildon <[email protected]> Date: Tue Aug 28 22:11:15 2012 -0400 Add support for unbranded XDX-RN502R V2.0 diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 4720130..b67223f 100755 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -118,6 +118,9 @@ get_status_led() { xdxrn502j) status_led="xdxrn502j:green:power" ;; + xdxrn502r) + status_led="xdxrn502r:green:power" + ;; esac } diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index 5dadd71..8e1ae2e 100644 --- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -86,7 +86,8 @@ case "$FIRMWARE" in wr512-3gn | \ wr6202 | \ ur-336un | \ - xdxrn502j) + xdxrn502j | \ + xdxrn502r) rt2x00_eeprom_extract "factory" 0 272 ;; diff --git a/target/linux/ramips/base-files/etc/uci-defaults/network b/target/linux/ramips/base-files/etc/uci-defaults/network index 106a613..589200b 100755 --- a/target/linux/ramips/base-files/etc/uci-defaults/network +++ b/target/linux/ramips/base-files/etc/uci-defaults/network @@ -67,8 +67,9 @@ ramips_setup_interfaces() ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1" ;; - wli-tx4-ag300n) - ucidef_set_interface_lan "eth0" + wli-tx4-ag300n | \ + xdxrn502r) + ucidef_set_interface_lan "eth0.2" ;; *) diff --git a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac index 8c2b039..060999b 100644 --- a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac +++ b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac @@ -51,6 +51,10 @@ preinit_set_mac_address() { mac=$(ramips_get_mac_binary factory 40) ifconfig eth0 hw ether $mac 2>/dev/null ;; + xdxrn502r) + mac=$(ramips_get_mac_binary factory 4) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; wl341v3) mac=$(ramips_get_mac_binary board-nvram 65440) ifconfig eth0 hw ether $mac 2>/dev/null diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index b07f4e9..18659f8 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -182,6 +182,9 @@ ramips_board_name() { *"XDX RN502J") name="xdxrn502j" ;; + *"XDX RN502R") + name="xdxrn502r" + ;; *) name="generic" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index d7380f0..edfe780 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -49,7 +49,9 @@ platform_check_image() { wli-tx4-ag300n | \ whr-g300n |\ ur-336un |\ - wr512-3gn) + wr512-3gn |\ + xdxrn502j |\ + xdxrn502r) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 diff --git a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h index 89b4373..a52f249 100644 --- a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h +++ b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h @@ -33,6 +33,7 @@ enum ramips_mach_type { RAMIPS_MACH_NW718, /* Netcore NW718 */ RAMIPS_MACH_WL_330N, /* Asus WL-330N */ RAMIPS_MACH_WL_330N3G, /* Asus WL-330N3G */ + RAMIPS_MACH_XDXRN502R, /* unknown XDX-RN502R V2.0 */ /* RT3052 based machines */ RAMIPS_MACH_ALL0239_3G, /* ALL0239-3G */ diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig index 5837196..f00f387 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig @@ -174,6 +174,11 @@ config RT305X_MACH_XDX_RN502J select RALINK_DEV_GPIO_BUTTONS select RALINK_DEV_GPIO_LEDS +config RT305X_MACH_XDX_RN502R + bool "Unknown board XDX-RN502R" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + endmenu endif diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile index 0dcb1f9..b2bb2e0 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile @@ -46,3 +46,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_XDX_RN502J) += mach-xdx-rn502j.o +obj-$(CONFIG_RT305X_MACH_XDX_RN502R) += mach-xdx-rn502r.o diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-xdx-rn502r.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-xdx-rn502r.c new file mode 100644 index 0000000..c6716bf --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-xdx-rn502r.c @@ -0,0 +1,85 @@ +/* + * Unknown router name/model, PCB marked with XDX-RN502R V2.0 + * + * Known names: + * Bococom DWR-150 + * TopLink RT-3GWT + * CDR-King CW-G3 + * Widemac SL-R7206 + * + * Copyright (C) 2012 Nicolas Marchildon <[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 XDXRN502R_GPIO_BUTTON_RESET 12 +#define XDXRN502R_GPIO_LED_WIFI 7 +#define XDXRN502R_GPIO_LED_POWER 9 + +#define XDXRN502R_BUTTONS_POLL_INTERVAL 20 +#define XDXRN502R_BUTTONS_DEBOUNCE_INTERVAL (3 * XDXRN502R_BUTTONS_POLL_INTERVAL) + + +static struct gpio_led xdxrn502r_leds_gpio[] __initdata = { + { + .name = "xdxrn502r:green:wifi", + .gpio = XDXRN502R_GPIO_LED_WIFI, + .active_low = 1, + }, { + .name = "xdxrn502r:green:power", + .gpio = XDXRN502R_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static struct gpio_keys_button xdxrn502r_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = XDXRN502R_BUTTONS_DEBOUNCE_INTERVAL, + .gpio = XDXRN502R_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +#define XDXRN502R_GPIO_MODE \ + ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \ + RT305X_GPIO_MODE_MDIO) + +static void __init xdxrn502r_init(void) +{ + rt305x_gpio_init(XDXRN502R_GPIO_MODE); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(xdxrn502r_leds_gpio), + xdxrn502r_leds_gpio); + + ramips_register_gpio_buttons(-1, XDXRN502R_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(xdxrn502r_gpio_buttons), + xdxrn502r_gpio_buttons); + + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_XDXRN502R, "XDXRN502R", "XDX RN502R", + xdxrn502r_init); diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index e43b501..6495644 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -530,6 +530,10 @@ define Image/Build/Profile/XDXRN502J $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,xdxrn502j,XDXRN502J,ttyS1,57600,phys) endef +define Image/Build/Profile/XDXRN502R + $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,xdxrn502r,XDXRN502R,ttyS1,57600,phys) +endef + ifeq ($(CONFIG_RALINK_RT305X),y) define Image/Build/Profile/Default $(call Image/Build/Profile/3G6200N,$(1)) @@ -567,6 +571,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/WR5123GN,$(1)) $(call Image/Build/Profile/WR6202,$(1)) $(call Image/Build/Profile/XDXRN502J,$(1)) + $(call Image/Build/Profile/XDXRN502R,$(1)) endef endif diff --git a/target/linux/ramips/rt305x/config-3.3 b/target/linux/ramips/rt305x/config-3.3 index 409bdbb..ae9a458 100644 --- a/target/linux/ramips/rt305x/config-3.3 +++ b/target/linux/ramips/rt305x/config-3.3 @@ -122,6 +122,7 @@ CONFIG_RT305X_MACH_WL_330N3G=y CONFIG_RT305X_MACH_WR512_3GN=y CONFIG_RT305X_MACH_WR6202=y CONFIG_RT305X_MACH_XDX_RN502J=y +CONFIG_RT305X_MACH_XDX_RN502R=y # CONFIG_SCSI_DMA is not set CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RT288X=y --- commit 9c10f085d997b22326d20e454d056d0d8baa70b6 Author: Nicolas Marchildon <[email protected]> Date: Tue Aug 28 22:11:15 2012 -0400 Add support for unbranded XDX-RN502R V2.0 target/linux/ramips/base-files/etc/diag.sh | 3 + .../etc/hotplug.d/firmware/10-rt2x00-eeprom | 3 +- .../ramips/base-files/etc/uci-defaults/network | 5 +- .../ramips/base-files/lib/preinit/06_set_iface_mac | 4 + target/linux/ramips/base-files/lib/ramips.sh | 3 + .../ramips/base-files/lib/upgrade/platform.sh | 4 +- .../arch/mips/include/asm/mach-ralink/machine.h | 1 + .../ramips/files/arch/mips/ralink/rt305x/Kconfig | 5 ++ .../ramips/files/arch/mips/ralink/rt305x/Makefile | 1 + .../arch/mips/ralink/rt305x/mach-xdx-rn502r.c | 85 ++++++++++++++++++++ target/linux/ramips/image/Makefile | 5 ++ target/linux/ramips/rt305x/config-3.3 | 1 + 12 files changed, 116 insertions(+), 4 deletions(-)
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
