2 * Asus RT-N56U board support
4 * Copyright (C) 2011-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/rtl8367.h>
14 #include <linux/ethtool.h>
16 #include <asm/mach-ralink/machine.h>
17 #include <asm/mach-ralink/dev-gpio-buttons.h>
18 #include <asm/mach-ralink/dev-gpio-leds.h>
19 #include <asm/mach-ralink/rt3883.h>
20 #include <asm/mach-ralink/rt3883_regs.h>
21 #include <asm/mach-ralink/ramips_eth_platform.h>
25 #define RT_N56U_GPIO_LED_POWER 0
26 #define RT_N56U_GPIO_LED_LAN 19
27 #define RT_N56U_GPIO_LED_USB 24
28 #define RT_N56U_GPIO_LED_WAN 27
29 #define RT_N56U_GPIO_BUTTON_RESET 13
30 #define RT_N56U_GPIO_BUTTON_WPS 26
32 #define RT_N56U_GPIO_RTL8367_SCK 2
33 #define RT_N56U_GPIO_RTL8367_SDA 1
35 #define RT_N56U_KEYS_POLL_INTERVAL 20
36 #define RT_N56U_KEYS_DEBOUNCE_INTERVAL (3 * RT_N56U_KEYS_POLL_INTERVAL)
38 static struct gpio_led rt_n56u_leds_gpio
[] __initdata
= {
40 .name
= "asus:blue:power",
41 .gpio
= RT_N56U_GPIO_LED_POWER
,
45 .name
= "asus:blue:lan",
46 .gpio
= RT_N56U_GPIO_LED_LAN
,
50 .name
= "asus:blue:wan",
51 .gpio
= RT_N56U_GPIO_LED_WAN
,
55 .name
= "asus:blue:usb",
56 .gpio
= RT_N56U_GPIO_LED_USB
,
61 static struct gpio_keys_button rt_n56u_gpio_buttons
[] __initdata
= {
66 .debounce_interval
= RT_N56U_KEYS_DEBOUNCE_INTERVAL
,
67 .gpio
= RT_N56U_GPIO_BUTTON_RESET
,
73 .code
= KEY_WPS_BUTTON
,
74 .debounce_interval
= RT_N56U_KEYS_DEBOUNCE_INTERVAL
,
75 .gpio
= RT_N56U_GPIO_BUTTON_WPS
,
80 static struct rtl8367_extif_config rt_n56u_rtl8367_extif1_cfg
= {
83 .mode
= RTL8367_EXTIF_MODE_RGMII
,
90 .speed
= RTL8367_PORT_SPEED_1000
,
94 static struct rtl8367_platform_data rt_n56u_rtl8367_data
= {
95 .gpio_sda
= RT_N56U_GPIO_RTL8367_SDA
,
96 .gpio_sck
= RT_N56U_GPIO_RTL8367_SCK
,
97 .extif1_cfg
= &rt_n56u_rtl8367_extif1_cfg
,
100 static struct platform_device rt_n56u_rtl8367_device
= {
101 .name
= RTL8367_DRIVER_NAME
,
104 .platform_data
= &rt_n56u_rtl8367_data
,
108 static void __init
rt_n56u_init(void)
110 rt3883_gpio_init(RT3883_GPIO_MODE_I2C
|
111 RT3883_GPIO_MODE_UART0(RT3883_GPIO_MODE_GPIO
) |
112 RT3883_GPIO_MODE_JTAG
|
113 RT3883_GPIO_MODE_PCI(RT3883_GPIO_MODE_PCI_FNC
));
115 rt3883_register_pflash(0);
117 ramips_register_gpio_leds(-1, ARRAY_SIZE(rt_n56u_leds_gpio
),
120 ramips_register_gpio_buttons(-1, RT_N56U_KEYS_POLL_INTERVAL
,
121 ARRAY_SIZE(rt_n56u_gpio_buttons
),
122 rt_n56u_gpio_buttons
);
124 platform_device_register(&rt_n56u_rtl8367_device
);
126 rt3883_register_wlan();
128 rt3883_eth_data
.speed
= SPEED_1000
;
129 rt3883_eth_data
.duplex
= DUPLEX_FULL
;
130 rt3883_eth_data
.tx_fc
= 1;
131 rt3883_eth_data
.rx_fc
= 1;
132 rt3883_register_ethernet();
134 rt3883_register_wdt(false);
135 rt3883_register_usbhost();
138 MIPS_MACHINE(RAMIPS_MACH_RT_N56U
, "RT-N56U", "Asus RT-N56U", rt_n56u_init
);