2 * Linksys WRT400N board support
4 * Copyright (C) 2009-2010 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/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
19 #include "dev-ap94-pci.h"
20 #include "dev-m25p80.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.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 #define WRT400N_MAC_ADDR_OFFSET 0x120c
35 #define WRT400N_CALDATA0_OFFSET 0x1000
36 #define WRT400N_CALDATA1_OFFSET 0x5000
38 #ifdef CONFIG_MTD_PARTITIONS
39 static struct mtd_partition wrt400n_partitions
[] = {
44 .mask_flags
= MTD_WRITEABLE
,
49 .mask_flags
= MTD_WRITEABLE
,
62 .mask_flags
= MTD_WRITEABLE
,
67 .mask_flags
= MTD_WRITEABLE
,
72 .mask_flags
= MTD_WRITEABLE
,
77 .mask_flags
= MTD_WRITEABLE
,
84 #endif /* CONFIG_MTD_PARTITIONS */
86 static struct flash_platform_data wrt400n_flash_data
= {
87 #ifdef CONFIG_MTD_PARTITIONS
88 .parts
= wrt400n_partitions
,
89 .nr_parts
= ARRAY_SIZE(wrt400n_partitions
),
93 static struct gpio_led wrt400n_leds_gpio
[] __initdata
= {
95 .name
= "wrt400n:green:status",
96 .gpio
= WRT400N_GPIO_LED_GREEN
,
99 .name
= "wrt400n:amber:aoss",
100 .gpio
= WRT400N_GPIO_LED_ORANGE
,
103 .name
= "wrt400n:green:wlan",
104 .gpio
= WRT400N_GPIO_LED_WLAN
,
107 .name
= "wrt400n:green:power",
108 .gpio
= WRT400N_GPIO_LED_POWER
,
113 static struct gpio_button wrt400n_gpio_buttons
[] __initdata
= {
119 .gpio
= WRT400N_GPIO_BTN_RESET
,
124 .code
= KEY_WPS_BUTTON
,
126 .gpio
= WRT400N_GPIO_BTN_WLSEC
,
131 static void __init
wrt400n_setup(void)
133 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
134 u8
*mac
= art
+ WRT400N_MAC_ADDR_OFFSET
;
136 ar71xx_add_device_mdio(0x0);
138 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, mac
, 1);
139 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
140 ar71xx_eth0_data
.speed
= SPEED_100
;
141 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
143 ar71xx_init_mac(ar71xx_eth1_data
.mac_addr
, mac
, 2);
144 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
145 ar71xx_eth1_data
.phy_mask
= 0x10;
147 ar71xx_add_device_eth(0);
148 ar71xx_add_device_eth(1);
150 ar71xx_add_device_m25p80(&wrt400n_flash_data
);
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 ap94_pci_init(art
+ WRT400N_CALDATA0_OFFSET
, NULL
,
160 art
+ WRT400N_CALDATA1_OFFSET
, NULL
);
163 MIPS_MACHINE(AR71XX_MACH_WRT400N
, "WRT400N", "Linksys WRT400N", wrt400n_setup
);