summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-07-12 13:29:46 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-07-12 13:29:46 +0000
commit533fe2fa9ffc57afdab424c18a01e87b74b09428 (patch)
tree1f36504c6c0cc83dd46217e2fe76f15f95f81ed7
parent7f1dc18d4bedbf4f5411dc1efeb055881012d1f1 (diff)
ramips: rt305x: add support for Edimax 3G-6200N
Support for Edimax 3G-6200N router with USB. Signed-off-by: Lukasz Golebiowski <lgolebio@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32682 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xtarget/linux/ramips/base-files/etc/diag.sh3
-rw-r--r--target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom1
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/leds4
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/network3
-rw-r--r--target/linux/ramips/base-files/lib/preinit/06_set_iface_mac4
-rwxr-xr-xtarget/linux/ramips/base-files/lib/ramips.sh3
-rwxr-xr-xtarget/linux/ramips/base-files/lib/upgrade/platform.sh1
-rw-r--r--target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h1
-rw-r--r--target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig5
-rw-r--r--target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile1
-rw-r--r--target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c86
-rw-r--r--target/linux/ramips/image/Makefile10
-rw-r--r--target/linux/ramips/rt305x/config-3.31
13 files changed, 122 insertions, 1 deletions
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 95e504f1d..68aa0ee86 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -30,6 +30,9 @@ status_led_off() {
get_status_led() {
case $(ramips_board_name) in
+ 3g-6200n)
+ status_led="edimax:green:power"
+ ;;
argus-atp52b)
status_led="argus-atp52b:green:run"
;;
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 c5d0d6978..d7542cab4 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
@@ -48,6 +48,7 @@ case "$FIRMWARE" in
rt2x00_eeprom_extract "u-boot" 262144 272
;;
+ 3g-6200n | \
all0256n | \
argus-atp52b | \
bc2 | \
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/leds b/target/linux/ramips/base-files/etc/uci-defaults/leds
index fdfce39e8..fbbd09d9e 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/leds
+++ b/target/linux/ramips/base-files/etc/uci-defaults/leds
@@ -14,6 +14,10 @@ set_wifi_led() {
board=$(ramips_board_name)
case $board in
+ 3g-6200n)
+ set_wifi_led "edimax:amber:wlan"
+ set_usb_led "edimax:blue:3g"
+ ;;
all0256n)
set_wifi_led "rt2800pci-phy0::radio"
;;
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/network b/target/linux/ramips/base-files/etc/uci-defaults/network
index cc3f21215..1c65b65a7 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/network
@@ -21,6 +21,7 @@ ramips_setup_interfaces()
ucidef_set_interface_lan "eth0.1"
;;
+ 3g-6200n | \
argus-atp52b | \
b2c | \
nw718 | \
@@ -89,7 +90,7 @@ ramips_setup_macs()
all0256n)
lan_mac=$(ramips_get_mac_binary factory 40)
;;
-
+ 3g-6200n | \
argus-atp52b | \
b2c | \
f5d8235-v1 | \
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 a605b22f8..db6e5c82f 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
@@ -8,6 +8,10 @@ preinit_set_mac_address() {
. /lib/ramips.sh
case $(ramips_board_name) in
+ 3g-6200n)
+ mac=$(ramips_get_mac_binary factory 4)
+ ifconfig eth0 hw ether $mac 2>/dev/null
+ ;;
bc2 |\
esr-9753 |\
freestation5 |\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index a5a173436..277d9da99 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -47,6 +47,9 @@ ramips_board_name() {
machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
case "$machine" in
+ *"Edimax 3g-6200n")
+ name="3g-6200n"
+ ;;
*"Allnet ALL0256N")
name="all0256n"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 1292b83e7..dba5e793b 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -14,6 +14,7 @@ platform_check_image() {
[ "$ARGC" -gt 1 ] && return 1
case "$board" in
+ 3g-6200n | \
all0256n | \
bc2 | \
dir-300-b1 | \
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 d0476f59b..6ff24f2f9 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
@@ -21,6 +21,7 @@ enum ramips_mach_type {
RAMIPS_MACH_WZR_AGL300NH, /* Buffalo WZR-AGL300NH */
/* RT3050 based machines */
+ RAMIPS_MACH_3G_6200N, /* Edimax 3G-6200N */
RAMIPS_MACH_ALL0256N, /* Allnet ALL0256N */
RAMIPS_MACH_DIR_300_B1, /* D-Link DIR-300 B1 */
RAMIPS_MACH_DIR_600_B1, /* D-Link DIR-600 B1 */
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
index 15d3a4c29..77269fe5c 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
@@ -2,6 +2,11 @@ if RALINK_RT305X
menu "Ralink RT350x machine selection"
+config RT305X_MACH_3G_6200N
+ bool "Edimax 3G-6200N board support"
+ select RALINK_DEV_GPIO_BUTTONS
+ select RALINK_DEV_GPIO_LEDS
+
config RT305X_MACH_WR6202
bool "Accton WR6202"
select RALINK_DEV_GPIO_BUTTONS
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
index 9fe1991fc..bb8cf0706 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
@@ -11,6 +11,7 @@ obj-y := irq.o setup.o devices.o rt305x.o clock.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+obj-$(CONFIG_RT305X_MACH_3G_6200N) += mach-3g-6200n.o
obj-$(CONFIG_RT305X_MACH_ARGUS_ATP52B) += mach-argus-atp52b.o
obj-$(CONFIG_RT305X_MACH_BC2) += mach-bc2.o
obj-$(CONFIG_RT305X_MACH_ALL0256N) += mach-all0256n.o
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c
new file mode 100644
index 000000000..ade4fe900
--- /dev/null
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c
@@ -0,0 +1,86 @@
+/*
+ * Edimax 3g-6200n board support
+ *
+ * Copyright (C) 2011 Andrzej Hajda <andrzej.hajda@wp.pl>
+ * Copyright (C) 2012 Lukasz Golebiowski <lgolebio@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 <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 EDIMAX_GPIO_BUTTON_WPS 12
+#define EDIMAX_GPIO_BTN_0 13 /* Wifi on/off switch button */
+
+#define EDIMAX_GPIO_LED_POWER 9
+#define EDIMAX_GPIO_LED_WLAN 14
+#define EDIMAX_GPIO_LED_3G 7
+
+#define EDIMAX_KEYS_POLL_INTERVAL 20
+#define EDIMAX_KEYS_DEBOUNCE_INTERVAL (3 * EDIMAX_KEYS_POLL_INTERVAL)
+
+static struct gpio_led edimax_leds_gpio[] __initdata = {
+ {
+ .name = "edimax:green:power",
+ .gpio = EDIMAX_GPIO_LED_POWER,
+ .active_low = 1,
+ }, {
+ .name = "edimax:amber:wlan",
+ .gpio = EDIMAX_GPIO_LED_WLAN,
+ .active_low = 1,
+ }, {
+ .name = "edimax:blue:3g",
+ .gpio = EDIMAX_GPIO_LED_3G,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_button edimax_gpio_buttons[] __initdata = {
+ {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = EDIMAX_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = EDIMAX_GPIO_BUTTON_WPS,
+ .active_low = 1,
+ }, {
+ .desc = "wlanswitch",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .debounce_interval = EDIMAX_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = EDIMAX_GPIO_BTN_0,
+ .active_low = 1,
+ }
+};
+
+static void __init edimax_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(edimax_leds_gpio),
+ edimax_leds_gpio);
+ ramips_register_gpio_buttons(-1, EDIMAX_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(edimax_gpio_buttons),
+ edimax_gpio_buttons);
+ rt305x_register_wifi();
+ rt305x_register_wdt();
+ rt305x_register_usb();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_3G_6200N, "3G-6200N", "Edimax 3g-6200n",
+ edimax_init);
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index bf8613426..ce817282d 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -124,6 +124,11 @@ define BuildFirmware/GENERIC_8M/initramfs
$(call BuildFirmware/Generic/initramfs,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)))
endef
+mtdlayout_edimax_3g6200n=192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,896k(kernel),2752k(rootfs),128k@0x3e0000(cimage)ro,3648k@0x50000(firmware)
+define BuildFirmware/3G6200N
+ $(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_edimax_3g6200n)),917504,2818048)
+endef
+
mtdlayout_argus_atp52b=192k(bootloader)ro,64k(config),64k(factory),1152k(kernel),6656k(rootfs),7808k@0x50000(firmware)
mtd_argus_atp52b_kernel_part_size=1179648
mtd_argus_atp52b_rootfs_part_size=6815744
@@ -312,6 +317,10 @@ endif
#
# RT305X Profiles
#
+define Image/Build/Profile/3G6200N
+ $(call Image/Build/Template/$(fs_squash)/$(1),3G6200N,3g-6200n,3G-6200N,ttyS1,57600,phys)
+endef
+
define Image/Build/Profile/ALL0256N
$(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,all0256n,ALL0256N,ttyS1,57600,spi)
endef
@@ -444,6 +453,7 @@ endef
ifeq ($(CONFIG_RALINK_RT305X),y)
define Image/Build/Profile/Default
+ $(call Image/Build/Profile/3G6200N,$(1))
$(call Image/Build/Profile/ALL0256N,$(1))
$(call Image/Build/Profile/ARGUS_ATP52B,$(1))
$(call Image/Build/Profile/BC2,$(1))
diff --git a/target/linux/ramips/rt305x/config-3.3 b/target/linux/ramips/rt305x/config-3.3
index 019f89930..3ad2857a3 100644
--- a/target/linux/ramips/rt305x/config-3.3
+++ b/target/linux/ramips/rt305x/config-3.3
@@ -87,6 +87,7 @@ CONFIG_RALINK_DEV_GPIO_LEDS=y
CONFIG_RALINK_RT305X=y
# CONFIG_RALINK_RT3883 is not set
CONFIG_RAMIPS_WDT=y
+CONFIG_RT305X_MACH_3G_6200N=y
CONFIG_RT305X_MACH_ALL0256N=y
CONFIG_RT305X_MACH_ARGUS_ATP52B=y
CONFIG_RT305X_MACH_BC2=y