diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-10-18 07:23:06 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-10-18 07:23:06 +0000 |
commit | 7f8b7207c9a86a95ed9adcb7e0ccf9981aaa70cd (patch) | |
tree | e5bd4e6be97bc6ddbc2a410510a5fd852ca5d7f2 | |
parent | bf9ae9432b165d1236fb0048742fc3d8ad7097ed (diff) | |
download | upstream-7f8b7207c9a86a95ed9adcb7e0ccf9981aaa70cd.tar.gz upstream-7f8b7207c9a86a95ed9adcb7e0ccf9981aaa70cd.tar.bz2 upstream-7f8b7207c9a86a95ed9adcb7e0ccf9981aaa70cd.zip |
ramips: rt3883: add initial support for TRENDnet TEW-692GR board
No wireless support.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 33846
5 files changed, 159 insertions, 0 deletions
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 71fe2f9a13..d1505824b7 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 @@ -70,4 +70,7 @@ enum ramips_mach_type { /* RT3662 based machines */ RAMIPS_MACH_DIR_645, /* D-Link DIR-645 */ RAMIPS_MACH_RT_N56U, /* Asus RT-N56U */ + + /* RT3883 based machines */ + 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 852ee4fda8..c07476a6fe 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig @@ -13,6 +13,12 @@ config RT3883_MACH_DIR_645 select RALINK_DEV_GPIO_BUTTONS select RALINK_DEV_GPIO_LEDS +config RT3883_MACH_TEW_692GR + bool "TRENDnet TEW-692GR support" + select HW_HAS_PCI + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + endmenu endif diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile b/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile index 8e9eceaaf3..6c778b7d64 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile @@ -13,3 +13,4 @@ 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_692GR) += mach-tew-692gr.o diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-tew-692gr.c b/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-tew-692gr.c new file mode 100644 index 0000000000..80f6b36a7b --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-tew-692gr.c @@ -0,0 +1,146 @@ +/* + * TRENDnet TEW-692GR board support + * + * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org> + * + * 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/ethtool.h> +#include <linux/pci.h> +#include <linux/phy.h> +#include <linux/rt2x00_platform.h> +#include <linux/ar8216_platform.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/rt3883.h> +#include <asm/mach-ralink/rt3883_regs.h> +#include <asm/mach-ralink/ramips_eth_platform.h> + +#include "devices.h" + +#define TEW_692GR_GPIO_LED_WPS_ORANGE 9 +#define TEW_692GR_GPIO_LED_WPS_GREEN 28 + +#define TEW_692GR_GPIO_BUTTON_RESET 10 +#define TEW_692GR_GPIO_BUTTON_WPS 26 + +#define TEW_692GR_KEYS_POLL_INTERVAL 20 +#define TEW_692GR_KEYS_DEBOUNCE_INTERVAL (3 * TEW_692GR_KEYS_POLL_INTERVAL) + +static struct gpio_led tew_692gr_leds_gpio[] __initdata = { + { + .name = "trendnet:orange:wps", + .gpio = TEW_692GR_GPIO_LED_WPS_ORANGE, + .active_low = 1, + }, + { + .name = "trendnet:green:wps", + .gpio = TEW_692GR_GPIO_LED_WPS_GREEN, + .active_low = 1, + }, +}; + +static struct gpio_keys_button tew_692gr_gpio_buttons[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = TEW_692GR_KEYS_DEBOUNCE_INTERVAL, + .gpio = TEW_692GR_GPIO_BUTTON_RESET, + .active_low = 1, + }, + { + .desc = "WPS button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = TEW_692GR_KEYS_DEBOUNCE_INTERVAL, + .gpio = TEW_692GR_GPIO_BUTTON_WPS, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg tew_692gr_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_RGMII, + .txclk_delay_en = true, + .rxclk_delay_en = true, + .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, +}; + +static struct ar8327_pad_cfg tew_692gr_ar8327_pad6_cfg = { + .mode = AR8327_PAD_MAC_RGMII, + .rxclk_delay_en = true, + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, +}; + +static struct ar8327_led_cfg tew_692gr_ar8327_led_cfg = { + .led_ctrl0 = 0xc437c437, + .led_ctrl1 = 0xc337c337, + .led_ctrl2 = 0x00000000, + .led_ctrl3 = 0x03ffff00, + .open_drain = false, +}; + +static struct ar8327_platform_data tew_692gr_ar8327_data = { + .pad0_cfg = &tew_692gr_ar8327_pad0_cfg, + .pad6_cfg = &tew_692gr_ar8327_pad6_cfg, + .cpuport_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .led_cfg = &tew_692gr_ar8327_led_cfg, +}; + +static struct mdio_board_info tew_692gr_mdio0_info[] = { + { + .bus_id = "ramips_mdio", + .phy_addr = 0, + .platform_data = &tew_692gr_ar8327_data, + }, +}; + +static void __init tew_692gr_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_692gr_leds_gpio), + tew_692gr_leds_gpio); + + ramips_register_gpio_buttons(-1, TEW_692GR_KEYS_POLL_INTERVAL, + ARRAY_SIZE(tew_692gr_gpio_buttons), + tew_692gr_gpio_buttons); + + rt3883_register_wlan(); + + mdiobus_register_board_info(tew_692gr_mdio0_info, + ARRAY_SIZE(tew_692gr_mdio0_info)); + + 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); + + rt3883_pci_init(RT3883_PCI_MODE_PCIE); +} + +MIPS_MACHINE(RAMIPS_MACH_TEW_692GR, "TEW-692GR", "TRENDnet TEW-692GR", + tew_692gr_init); diff --git a/target/linux/ramips/rt3883/config-3.3 b/target/linux/ramips/rt3883/config-3.3 index 9662bd7cc9..f18780f01a 100644 --- a/target/linux/ramips/rt3883/config-3.3 +++ b/target/linux/ramips/rt3883/config-3.3 @@ -1,3 +1,4 @@ +CONFIG_AR8216_PHY=y CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y CONFIG_ARCH_DISCARD_MEMBLOCK=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y @@ -24,6 +25,7 @@ CONFIG_CSRC_R4K_LIB=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y @@ -94,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_692GR=y CONFIG_RTL8366_SMI=y CONFIG_RTL8367B_PHY=y CONFIG_RTL8367_PHY=y |