2 * NETGEAR WNR2000 board support
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 * Copyright (C) 2008-2009 Andy Boyett <agb@openwrt.org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/platform_device.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/input.h>
18 #include <asm/mips_machine.h>
20 #include <asm/mach-ar71xx/ar71xx.h>
23 #include "dev-m25p80.h"
24 #include "dev-ar913x-wmac.h"
25 #include "dev-leds-gpio.h"
27 #define WNR2000_GPIO_LED_PWR_GREEN 14
28 #define WNR2000_GPIO_LED_PWR_AMBER 7
29 #define WNR2000_GPIO_LED_WPS 4
30 #define WNR2000_GPIO_LED_WLAN 6
31 #define WNR2000_GPIO_BTN_RESET 21
32 #define WNR2000_GPIO_BTN_WPS 8
34 #define WNR2000_BUTTONS_POLL_INTERVAL 20
36 #ifdef CONFIG_MTD_PARTITIONS
37 static struct mtd_partition wnr2000_partitions
[] = {
42 .mask_flags
= MTD_WRITEABLE
,
52 .name
= "user-config",
60 .name
= "language_table",
64 .name
= "rootfs_checksum",
71 .mask_flags
= MTD_WRITEABLE
,
74 #endif /* CONFIG_MTD_PARTITIONS */
76 static struct flash_platform_data wnr2000_flash_data
= {
77 #ifdef CONFIG_MTD_PARTITIONS
78 .parts
= wnr2000_partitions
,
79 .nr_parts
= ARRAY_SIZE(wnr2000_partitions
),
83 static struct gpio_led wnr2000_leds_gpio
[] __initdata
= {
85 .name
= "wnr2000:green:power",
86 .gpio
= WNR2000_GPIO_LED_PWR_GREEN
,
89 .name
= "wnr2000:amber:power",
90 .gpio
= WNR2000_GPIO_LED_PWR_AMBER
,
93 .name
= "wnr2000:green:wps",
94 .gpio
= WNR2000_GPIO_LED_WPS
,
97 .name
= "wnr2000:blue:wlan",
98 .gpio
= WNR2000_GPIO_LED_WLAN
,
103 static struct gpio_button wnr2000_gpio_buttons
[] __initdata
= {
109 .gpio
= WNR2000_GPIO_BTN_RESET
,
115 .gpio
= WNR2000_GPIO_BTN_WPS
,
119 static void __init
wnr2000_setup(void)
121 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff1000);
123 ar71xx_set_mac_base(mac
);
124 ar71xx_add_device_mdio(0x0);
126 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
127 ar71xx_eth0_data
.phy_mask
= 0xf;
128 ar71xx_eth0_data
.speed
= SPEED_100
;
129 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
130 ar71xx_eth0_data
.has_ar8216
= 1;
132 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
133 ar71xx_eth1_data
.phy_mask
= 0x10;
135 ar71xx_add_device_eth(0);
136 ar71xx_add_device_eth(1);
138 ar71xx_add_device_m25p80(&wnr2000_flash_data
);
140 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wnr2000_leds_gpio
),
143 ar71xx_add_device_gpio_buttons(-1, WNR2000_BUTTONS_POLL_INTERVAL
,
144 ARRAY_SIZE(wnr2000_gpio_buttons
),
145 wnr2000_gpio_buttons
);
148 ar913x_add_device_wmac();
151 MIPS_MACHINE(AR71XX_MACH_WNR2000
, "NETGEAR WNR2000", wnr2000_setup
);