2 * D-Link DIR-600 rev. A1 board support
4 * Copyright (C) 2010 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/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
14 #include <asm/mach-ar71xx/ar71xx.h>
18 #include "dev-m25p80.h"
19 #include "dev-ap91-pci.h"
20 #include "dev-gpio-buttons.h"
21 #include "dev-leds-gpio.h"
23 #define DIR_600_A1_GPIO_LED_WPS 0
24 #define DIR_600_A1_GPIO_LED_POWER_AMBER 1
25 #define DIR_600_A1_GPIO_LED_POWER_GREEN 6
27 #define DIR_600_A1_GPIO_BTN_RESET 8
28 #define DIR_600_A1_GPIO_BTN_WPS 12
30 #define DIR_600_A1_BUTTONS_POLL_INTERVAL 20
32 #ifdef CONFIG_MTD_PARTITIONS
33 static struct mtd_partition dir_600_a1_partitions
[] = {
38 .mask_flags
= MTD_WRITEABLE
,
55 .mask_flags
= MTD_WRITEABLE
,
60 .mask_flags
= MTD_WRITEABLE
,
67 #endif /* CONFIG_MTD_PARTITIONS */
69 static struct flash_platform_data dir_600_a1_flash_data
= {
70 #ifdef CONFIG_MTD_PARTITIONS
71 .parts
= dir_600_a1_partitions
,
72 .nr_parts
= ARRAY_SIZE(dir_600_a1_partitions
),
76 static struct gpio_led dir_600_a1_leds_gpio
[] __initdata
= {
78 .name
= "dir-600-a1:green:power",
79 .gpio
= DIR_600_A1_GPIO_LED_POWER_GREEN
,
81 .name
= "dir-600-a1:amber:power",
82 .gpio
= DIR_600_A1_GPIO_LED_POWER_AMBER
,
84 .name
= "dir-600-a1:blue:wps",
85 .gpio
= DIR_600_A1_GPIO_LED_WPS
,
90 static struct gpio_button dir_600_a1_gpio_buttons
[] __initdata
= {
96 .gpio
= DIR_600_A1_GPIO_BTN_RESET
,
103 .gpio
= DIR_600_A1_GPIO_BTN_WPS
,
108 static void __init
dir_600_a1_setup(void)
110 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff0000);
111 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
113 ar71xx_set_mac_base(mac
);
114 ar71xx_add_device_mdio(0x0);
117 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
118 ar71xx_eth0_data
.phy_mask
= 0x0;
119 ar71xx_eth0_data
.speed
= SPEED_100
;
120 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
121 ar71xx_eth0_data
.fifo_cfg1
= 0x0fff0000;
122 ar71xx_eth0_data
.fifo_cfg2
= 0x00001fff;
123 ar71xx_eth0_data
.fifo_cfg3
= 0x008001ff;
126 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
127 ar71xx_eth1_data
.phy_mask
= 0x0;
128 ar71xx_eth1_data
.speed
= SPEED_1000
;
129 ar71xx_eth1_data
.duplex
= DUPLEX_FULL
;
130 ar71xx_eth1_data
.fifo_cfg1
= 0x0fff0000;
131 ar71xx_eth1_data
.fifo_cfg2
= 0x00001fff;
132 ar71xx_eth1_data
.fifo_cfg3
= 0x008001ff;
134 ar71xx_add_device_eth(1);
135 ar71xx_add_device_eth(0);
137 ar71xx_add_device_m25p80(&dir_600_a1_flash_data
);
139 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir_600_a1_leds_gpio
),
140 dir_600_a1_leds_gpio
);
142 ar71xx_add_device_gpio_buttons(-1, DIR_600_A1_BUTTONS_POLL_INTERVAL
,
143 ARRAY_SIZE(dir_600_a1_gpio_buttons
),
144 dir_600_a1_gpio_buttons
);
146 ap91_pci_init(ee
, NULL
);
149 MIPS_MACHINE(AR71XX_MACH_DIR_600_A1
, "DIR-600-A1", "D-Link DIR-600 rev. A1",