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/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
16 #include <asm/mips_machine.h>
17 #include <asm/mach-ar71xx/ar71xx.h>
20 #include "dev-m25p80.h"
21 #include "dev-ar913x-wmac.h"
22 #include "dev-gpio-buttons.h"
23 #include "dev-leds-gpio.h"
25 #define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */
26 #define DIR_615C1_GPIO_LED_BLUE_WPS 3 /* BLUE:WPS */
27 #define DIR_615C1_GPIO_LED_GREEN_WAN 4 /* GREEN:WAN:TRICOLOR */
28 #define DIR_615C1_GPIO_LED_GREEN_WANCPU 5 /* GREEN:WAN:CPU:TRICOLOR */
29 #define DIR_615C1_GPIO_LED_GREEN_WLAN 6 /* GREEN:WLAN */
30 #define DIR_615C1_GPIO_LED_GREEN_STATUS 14 /* GREEN:STATUS:TRICOLOR */
31 #define DIR_615C1_GPIO_LED_ORANGE_WAN 15 /* ORANGE:WAN:TRICOLOR */
33 /* buttons may need refinement */
35 #define DIR_615C1_GPIO_BTN_WPS 12
36 #define DIR_615C1_GPIO_BTN_RESET 21
38 #define DIR_615C1_BUTTONS_POLL_INTERVAL 20
40 #ifdef CONFIG_MTD_PARTITIONS
41 static struct mtd_partition dir_615c1_partitions[] = {
46 .mask_flags = MTD_WRITEABLE,
63 .mask_flags = MTD_WRITEABLE,
70 #endif /* CONFIG_MTD_PARTITIONS */
72 static struct flash_platform_data dir_615c1_flash_data = {
73 #ifdef CONFIG_MTD_PARTITIONS
74 .parts = dir_615c1_partitions,
75 .nr_parts = ARRAY_SIZE(dir_615c1_partitions),
79 static struct gpio_led dir_615c1_leds_gpio[] __initdata = {
81 .name = "dir-615c1:orange:status",
82 .gpio = DIR_615C1_GPIO_LED_ORANGE_STATUS,
85 .name = "dir-615c1:blue:wps",
86 .gpio = DIR_615C1_GPIO_LED_BLUE_WPS,
89 .name = "dir-615c1:green:wan",
90 .gpio = DIR_615C1_GPIO_LED_GREEN_WAN,
93 .name = "dir-615c1:green:wancpu",
94 .gpio = DIR_615C1_GPIO_LED_GREEN_WANCPU,
97 .name = "dir-615c1:green:wlan",
98 .gpio = DIR_615C1_GPIO_LED_GREEN_WLAN,
101 .name = "dir-615c1:green:status",
102 .gpio = DIR_615C1_GPIO_LED_GREEN_STATUS,
105 .name = "dir-615c1:orange:wan",
106 .gpio = DIR_615C1_GPIO_LED_ORANGE_WAN,
112 static struct gpio_button dir_615c1_gpio_buttons[] __initdata = {
118 .gpio = DIR_615C1_GPIO_BTN_RESET,
124 .gpio = DIR_615C1_GPIO_BTN_WPS,
128 static void __init dir_615c1_setup(void)
130 ar71xx_add_device_mdio(0x0);
132 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
133 ar71xx_eth0_data.phy_mask = 0xf;
134 ar71xx_eth0_data.speed = SPEED_100;
135 ar71xx_eth0_data.duplex = DUPLEX_FULL;
137 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
138 ar71xx_eth1_data.phy_mask = 0x10;
140 ar71xx_add_device_eth(0);
141 ar71xx_add_device_eth(1);
143 ar71xx_add_device_m25p80(&dir_615c1_flash_data);
145 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir_615c1_leds_gpio),
146 dir_615c1_leds_gpio);
148 ar71xx_add_device_gpio_buttons(-1, DIR_615C1_BUTTONS_POLL_INTERVAL,
149 ARRAY_SIZE(dir_615c1_gpio_buttons),
150 dir_615c1_gpio_buttons);
152 ar913x_add_device_wmac();
155 MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup);