Support for Edimax 3G-6200N router with USB.
Signed-off-by: Lukasz Golebiowski <lgolebio@gmail.com>
SVN-Revision: 32682
get_status_led() {
case $(ramips_board_name) in
+ 3g-6200n)
+ status_led="edimax:green:power"
+ ;;
argus-atp52b)
status_led="argus-atp52b:green:run"
;;
rt2x00_eeprom_extract "u-boot" 262144 272
;;
+ 3g-6200n | \
all0256n | \
argus-atp52b | \
bc2 | \
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"
;;
ucidef_set_interface_lan "eth0.1"
;;
+ 3g-6200n | \
argus-atp52b | \
b2c | \
nw718 | \
all0256n)
lan_mac=$(ramips_get_mac_binary factory 40)
;;
-
+ 3g-6200n | \
argus-atp52b | \
b2c | \
f5d8235-v1 | \
. /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 |\
machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
case "$machine" in
+ *"Edimax 3g-6200n")
+ name="3g-6200n"
+ ;;
*"Allnet ALL0256N")
name="all0256n"
;;
[ "$ARGC" -gt 1 ] && return 1
case "$board" in
+ 3g-6200n | \
all0256n | \
bc2 | \
dir-300-b1 | \
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 */
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
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
--- /dev/null
+/*
+ * 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);
$(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
#
# 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
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))
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