2 * D-Link DIR-615 rev C1 board support
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 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-m25p80.h"
20 #include "dev-ar913x-wmac.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
24 #define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */
25 #define DIR_615C1_GPIO_LED_BLUE_WPS 3 /* BLUE:WPS */
26 #define DIR_615C1_GPIO_LED_GREEN_WAN 4 /* GREEN:WAN:TRICOLOR */
27 #define DIR_615C1_GPIO_LED_GREEN_WANCPU 5 /* GREEN:WAN:CPU:TRICOLOR */
28 #define DIR_615C1_GPIO_LED_GREEN_WLAN 6 /* GREEN:WLAN */
29 #define DIR_615C1_GPIO_LED_GREEN_STATUS 14 /* GREEN:STATUS:TRICOLOR */
30 #define DIR_615C1_GPIO_LED_ORANGE_WAN 15 /* ORANGE:WAN:TRICOLOR */
32 /* buttons may need refinement */
34 #define DIR_615C1_GPIO_BTN_WPS 12
35 #define DIR_615C1_GPIO_BTN_RESET 21
37 #define DIR_615C1_BUTTONS_POLL_INTERVAL 20
39 #ifdef CONFIG_MTD_PARTITIONS
40 static struct mtd_partition dir_615c1_partitions
[] = {
45 .mask_flags
= MTD_WRITEABLE
,
62 .mask_flags
= MTD_WRITEABLE
,
69 #endif /* CONFIG_MTD_PARTITIONS */
71 static struct flash_platform_data dir_615c1_flash_data
= {
72 #ifdef CONFIG_MTD_PARTITIONS
73 .parts
= dir_615c1_partitions
,
74 .nr_parts
= ARRAY_SIZE(dir_615c1_partitions
),
78 static struct gpio_led dir_615c1_leds_gpio
[] __initdata
= {
80 .name
= "dir-615c1:orange:status",
81 .gpio
= DIR_615C1_GPIO_LED_ORANGE_STATUS
,
84 .name
= "dir-615c1:blue:wps",
85 .gpio
= DIR_615C1_GPIO_LED_BLUE_WPS
,
88 .name
= "dir-615c1:green:wan",
89 .gpio
= DIR_615C1_GPIO_LED_GREEN_WAN
,
92 .name
= "dir-615c1:green:wancpu",
93 .gpio
= DIR_615C1_GPIO_LED_GREEN_WANCPU
,
96 .name
= "dir-615c1:green:wlan",
97 .gpio
= DIR_615C1_GPIO_LED_GREEN_WLAN
,
100 .name
= "dir-615c1:green:status",
101 .gpio
= DIR_615C1_GPIO_LED_GREEN_STATUS
,
104 .name
= "dir-615c1:orange:wan",
105 .gpio
= DIR_615C1_GPIO_LED_ORANGE_WAN
,
111 static struct gpio_button dir_615c1_gpio_buttons
[] __initdata
= {
117 .gpio
= DIR_615C1_GPIO_BTN_RESET
,
123 .gpio
= DIR_615C1_GPIO_BTN_WPS
,
127 static void __init
dir_615c1_setup(void)
129 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff1000);
131 ar71xx_add_device_mdio(0x0);
133 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
134 ar71xx_eth0_data
.phy_mask
= 0xf;
135 ar71xx_eth0_data
.speed
= SPEED_100
;
136 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
138 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
139 ar71xx_eth1_data
.phy_mask
= 0x10;
141 ar71xx_add_device_eth(0);
142 ar71xx_add_device_eth(1);
144 ar71xx_add_device_m25p80(&dir_615c1_flash_data
);
146 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir_615c1_leds_gpio
),
147 dir_615c1_leds_gpio
);
149 ar71xx_add_device_gpio_buttons(-1, DIR_615C1_BUTTONS_POLL_INTERVAL
,
150 ARRAY_SIZE(dir_615c1_gpio_buttons
),
151 dir_615c1_gpio_buttons
);
153 ar913x_add_device_wmac(eeprom
, NULL
);
156 MIPS_MACHINE(AR71XX_MACH_DIR_615_C1
, "D-Link DIR-615 rev. C1", dir_615c1_setup
);