2 * TRENDnet TEW-691GR board support
4 * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/ethtool.h>
14 #include <linux/pci.h>
15 #include <linux/phy.h>
16 #include <linux/rt2x00_platform.h>
17 #include <linux/ar8216_platform.h>
19 #include <asm/mach-ralink/machine.h>
20 #include <asm/mach-ralink/dev-gpio-buttons.h>
21 #include <asm/mach-ralink/dev-gpio-leds.h>
22 #include <asm/mach-ralink/rt3883.h>
23 #include <asm/mach-ralink/rt3883_regs.h>
24 #include <asm/mach-ralink/ramips_eth_platform.h>
28 #define TEW_691GR_GPIO_LED_WPS_GREEN 9
30 #define TEW_691GR_GPIO_BUTTON_RESET 10
31 #define TEW_691GR_GPIO_BUTTON_WPS 26
33 #define TEW_691GR_GPIO_SWITCH_RFKILL 0
35 #define TEW_691GR_KEYS_POLL_INTERVAL 20
36 #define TEW_691GR_KEYS_DEBOUNCE_INTERVAL (3 * TEW_691GR_KEYS_POLL_INTERVAL)
38 static struct gpio_led tew_691gr_leds_gpio[] __initdata = {
40 .name = "trendnet:green:wps",
41 .gpio = TEW_691GR_GPIO_LED_WPS_GREEN,
46 static struct gpio_keys_button tew_691gr_gpio_buttons[] __initdata = {
48 .desc = "Reset button",
51 .debounce_interval = TEW_691GR_KEYS_DEBOUNCE_INTERVAL,
52 .gpio = TEW_691GR_GPIO_BUTTON_RESET,
58 .code = KEY_WPS_BUTTON,
59 .debounce_interval = TEW_691GR_KEYS_DEBOUNCE_INTERVAL,
60 .gpio = TEW_691GR_GPIO_BUTTON_WPS,
64 .desc = "RFKILL switch",
67 .debounce_interval = TEW_691GR_KEYS_DEBOUNCE_INTERVAL,
68 .gpio = TEW_691GR_GPIO_SWITCH_RFKILL,
73 static void __init tew_691gr_init(void)
75 rt3883_gpio_init(RT3883_GPIO_MODE_I2C |
76 RT3883_GPIO_MODE_SPI |
77 RT3883_GPIO_MODE_UART0(RT3883_GPIO_MODE_GPIO) |
78 RT3883_GPIO_MODE_JTAG |
79 RT3883_GPIO_MODE_PCI(RT3883_GPIO_MODE_PCI_FNC));
81 rt3883_register_pflash(0);
83 ramips_register_gpio_leds(-1, ARRAY_SIZE(tew_691gr_leds_gpio),
86 ramips_register_gpio_buttons(-1, TEW_691GR_KEYS_POLL_INTERVAL,
87 ARRAY_SIZE(tew_691gr_gpio_buttons),
88 tew_691gr_gpio_buttons);
90 rt3883_wlan_data.disable_5ghz = 1;
91 rt3883_register_wlan();
93 rt3883_eth_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
94 rt3883_eth_data.phy_mask = BIT(0);
95 rt3883_eth_data.tx_fc = 1;
96 rt3883_eth_data.rx_fc = 1;
97 rt3883_register_ethernet();
99 rt3883_register_wdt(false);
102 MIPS_MACHINE(RAMIPS_MACH_TEW_691GR, "TEW-691GR", "TRENDnet TEW-691GR",