From: Gabor Juhos Date: Thu, 18 Oct 2012 07:23:11 +0000 (+0000) Subject: ramips: rt3883: add initial support for the TRENDnet TEW-691GR board X-Git-Tag: reboot~12562 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=25d53c4c28bcc3f1ace4bdc6b29da6592830f055;p=openwrt%2Fstaging%2Fxback.git ramips: rt3883: add initial support for the TRENDnet TEW-691GR board No wireless support. Signed-off-by: Gabor Juhos SVN-Revision: 33850 --- 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 d1505824b7..8f99ce10b3 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 @@ -72,5 +72,6 @@ enum ramips_mach_type { RAMIPS_MACH_RT_N56U, /* Asus RT-N56U */ /* RT3883 based machines */ - RAMIPS_MACH_TEW_692GR, /* TRENDnet TEW-692GR */ + RAMIPS_MACH_TEW_691GR, /* TRENDnet TEW-691GR */ + RAMIPS_MACH_TEW_692GR /* TRENDnet TEW-692GR */ }; diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig b/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig index c07476a6fe..507cdb38b4 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig @@ -13,6 +13,11 @@ config RT3883_MACH_DIR_645 select RALINK_DEV_GPIO_BUTTONS select RALINK_DEV_GPIO_LEDS +config RT3883_MACH_TEW_691GR + bool "TRENDnet TEW-691GR support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + config RT3883_MACH_TEW_692GR bool "TRENDnet TEW-692GR support" select HW_HAS_PCI diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile b/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile index 6c778b7d64..125471af33 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile @@ -13,4 +13,5 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_RT3883_MACH_DIR_645) += mach-dir-645.o obj-$(CONFIG_RT3883_MACH_RT_N56U) += mach-rt-n56u.o +obj-$(CONFIG_RT3883_MACH_TEW_691GR) += mach-tew-691gr.o obj-$(CONFIG_RT3883_MACH_TEW_692GR) += mach-tew-692gr.o diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-tew-691gr.c b/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-tew-691gr.c new file mode 100644 index 0000000000..cf1a7f24d5 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-tew-691gr.c @@ -0,0 +1,102 @@ +/* + * TRENDnet TEW-691GR board support + * + * Copyright (C) 2012 Gabor Juhos + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "devices.h" + +#define TEW_691GR_GPIO_LED_WPS_GREEN 9 + +#define TEW_691GR_GPIO_BUTTON_RESET 10 +#define TEW_691GR_GPIO_BUTTON_WPS 26 + +#define TEW_691GR_GPIO_SWITCH_RFKILL 0 + +#define TEW_691GR_KEYS_POLL_INTERVAL 20 +#define TEW_691GR_KEYS_DEBOUNCE_INTERVAL (3 * TEW_691GR_KEYS_POLL_INTERVAL) + +static struct gpio_led tew_691gr_leds_gpio[] __initdata = { + { + .name = "trendnet:green:wps", + .gpio = TEW_691GR_GPIO_LED_WPS_GREEN, + .active_low = 1, + }, +}; + +static struct gpio_keys_button tew_691gr_gpio_buttons[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = TEW_691GR_KEYS_DEBOUNCE_INTERVAL, + .gpio = TEW_691GR_GPIO_BUTTON_RESET, + .active_low = 1, + }, + { + .desc = "WPS button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = TEW_691GR_KEYS_DEBOUNCE_INTERVAL, + .gpio = TEW_691GR_GPIO_BUTTON_WPS, + .active_low = 1, + }, + { + .desc = "RFKILL switch", + .type = EV_SW, + .code = KEY_WPS_BUTTON, + .debounce_interval = TEW_691GR_KEYS_DEBOUNCE_INTERVAL, + .gpio = TEW_691GR_GPIO_SWITCH_RFKILL, + .active_low = 1, + }, +}; + +static void __init tew_691gr_init(void) +{ + rt3883_gpio_init(RT3883_GPIO_MODE_I2C | + RT3883_GPIO_MODE_SPI | + RT3883_GPIO_MODE_UART0(RT3883_GPIO_MODE_GPIO) | + RT3883_GPIO_MODE_JTAG | + RT3883_GPIO_MODE_PCI(RT3883_GPIO_MODE_PCI_FNC)); + + rt3883_register_pflash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(tew_691gr_leds_gpio), + tew_691gr_leds_gpio); + + ramips_register_gpio_buttons(-1, TEW_691GR_KEYS_POLL_INTERVAL, + ARRAY_SIZE(tew_691gr_gpio_buttons), + tew_691gr_gpio_buttons); + + rt3883_register_wlan(); + + rt3883_eth_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + rt3883_eth_data.phy_mask = BIT(0); + rt3883_eth_data.tx_fc = 1; + rt3883_eth_data.rx_fc = 1; + rt3883_register_ethernet(); + + rt3883_register_wdt(false); +} + +MIPS_MACHINE(RAMIPS_MACH_TEW_691GR, "TEW-691GR", "TRENDnet TEW-691GR", + tew_691gr_init); diff --git a/target/linux/ramips/rt3883/config-3.3 b/target/linux/ramips/rt3883/config-3.3 index f18780f01a..c4ddbb9a7a 100644 --- a/target/linux/ramips/rt3883/config-3.3 +++ b/target/linux/ramips/rt3883/config-3.3 @@ -96,6 +96,7 @@ CONFIG_RALINK_RT3883=y CONFIG_RAMIPS_WDT=y CONFIG_RT3883_MACH_DIR_645=y CONFIG_RT3883_MACH_RT_N56U=y +CONFIG_RT3883_MACH_TEW_691GR=y CONFIG_RT3883_MACH_TEW_692GR=y CONFIG_RTL8366_SMI=y CONFIG_RTL8367B_PHY=y