2 * Linksys WRT400N board support
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #include <linux/input.h>
19 #include <asm/mips_machine.h>
20 #include <asm/mach-ar71xx/ar71xx.h>
24 #define WRT400N_GPIO_LED_ORANGE 5
25 #define WRT400N_GPIO_LED_GREEN 4
26 #define WRT400N_GPIO_LED_POWER 1
27 #define WRT400N_GPIO_LED_WLAN 0
29 #define WRT400N_GPIO_BTN_RESET 8
30 #define WRT400N_GPIO_BTN_WLSEC 3
32 #define WRT400N_BUTTONS_POLL_INTERVAL 20
34 #ifdef CONFIG_MTD_PARTITIONS
35 static struct mtd_partition wrt400n_partitions[] = {
40 .mask_flags = MTD_WRITEABLE,
45 .mask_flags = MTD_WRITEABLE,
58 .mask_flags = MTD_WRITEABLE,
63 .mask_flags = MTD_WRITEABLE,
68 .mask_flags = MTD_WRITEABLE,
73 .mask_flags = MTD_WRITEABLE,
76 #endif /* CONFIG_MTD_PARTITIONS */
78 static struct flash_platform_data wrt400n_flash_data = {
79 #ifdef CONFIG_MTD_PARTITIONS
80 .parts = wrt400n_partitions,
81 .nr_parts = ARRAY_SIZE(wrt400n_partitions),
85 static struct spi_board_info wrt400n_spi_info[] = {
89 .max_speed_hz = 25000000,
91 .platform_data = &wrt400n_flash_data,
95 static struct gpio_led wrt400n_leds_gpio[] __initdata = {
97 .name = "wrt400n:green:status",
98 .gpio = WRT400N_GPIO_LED_GREEN,
101 .name = "wrt400n:amber:aoss",
102 .gpio = WRT400N_GPIO_LED_ORANGE,
105 .name = "wrt400n:green:wlan",
106 .gpio = WRT400N_GPIO_LED_WLAN,
109 .name = "wrt400n:green:power",
110 .gpio = WRT400N_GPIO_LED_POWER,
115 static struct gpio_button wrt400n_gpio_buttons[] __initdata = {
121 .gpio = WRT400N_GPIO_BTN_RESET,
128 .gpio = WRT400N_GPIO_BTN_WLSEC,
133 static void __init wrt400n_setup(void)
135 ar71xx_add_device_mdio(0x0);
137 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
138 ar71xx_eth0_data.phy_mask = 0xf;
139 ar71xx_eth0_data.speed = SPEED_100;
140 ar71xx_eth0_data.duplex = DUPLEX_FULL;
141 ar71xx_eth0_data.has_ar8216 = 1;
143 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
144 ar71xx_eth1_data.phy_mask = 0x10;
146 ar71xx_add_device_eth(0);
147 ar71xx_add_device_eth(1);
149 ar71xx_add_device_spi(NULL, wrt400n_spi_info,
150 ARRAY_SIZE(wrt400n_spi_info));
152 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt400n_leds_gpio),
155 ar71xx_add_device_gpio_buttons(-1, WRT400N_BUTTONS_POLL_INTERVAL,
156 ARRAY_SIZE(wrt400n_gpio_buttons),
157 wrt400n_gpio_buttons);
159 /* TODO: PCI support */
162 MIPS_MACHINE(AR71XX_MACH_WRT400N, "Linksys WRT400N", wrt400n_setup);