2 * Netgear WNDR3700 board support
4 * Copyright (C) 2009 Marco Porsch
5 * Copyright (C) 2009 Gabor Juhos <juhosg@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>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #include <linux/input.h>
19 #include <asm/mips_machine.h>
20 #include <asm/mach-ar71xx/ar71xx.h>
21 #include <asm/mach-ar71xx/pci.h>
25 #define WNDR3700_GPIO_LED_WPS_ORANGE 0
26 #define WNDR3700_GPIO_LED_POWER_ORANGE 1
27 #define WNDR3700_GPIO_LED_POWER_GREEN 2
28 #define WNDR3700_GPIO_LED_WPS_GREEN 4
30 #define WNDR3700_GPIO_BTN_WPS 3
31 #define WNDR3700_GPIO_BTN_RESET 8
32 #define WNDR3700_GPIO_BTN_WIFI 11
34 #define WNDR3700_BUTTONS_POLL_INTERVAL 20
36 #ifdef CONFIG_MTD_PARTITIONS
37 static struct mtd_partition wndr3700_partitions
[] = {
42 .mask_flags
= MTD_WRITEABLE
,
47 .mask_flags
= MTD_WRITEABLE
,
56 .mask_flags
= MTD_WRITEABLE
,
61 .mask_flags
= MTD_WRITEABLE
,
66 .mask_flags
= MTD_WRITEABLE
,
68 .name
= "traffic_meter",
71 .mask_flags
= MTD_WRITEABLE
,
76 .mask_flags
= MTD_WRITEABLE
,
81 .mask_flags
= MTD_WRITEABLE
,
84 #endif /* CONFIG_MTD_PARTITIONS */
86 static struct flash_platform_data wndr3700_flash_data
= {
87 #ifdef CONFIG_MTD_PARTITIONS
88 .parts
= wndr3700_partitions
,
89 .nr_parts
= ARRAY_SIZE(wndr3700_partitions
),
93 static struct ar71xx_pci_irq wndr3700_pci_irqs
[] __initdata
= {
97 .irq
= AR71XX_PCI_IRQ_DEV0
,
101 .irq
= AR71XX_PCI_IRQ_DEV1
,
105 static struct spi_board_info wndr3700_spi_info
[] = {
109 .max_speed_hz
= 25000000,
110 .modalias
= "m25p80",
111 .platform_data
= &wndr3700_flash_data
,
115 static struct gpio_led wndr3700_leds_gpio
[] __initdata
= {
117 .name
= "wndr3700:green:power",
118 .gpio
= WNDR3700_GPIO_LED_POWER_GREEN
,
121 .name
= "wndr3700:orange:power",
122 .gpio
= WNDR3700_GPIO_LED_POWER_ORANGE
,
125 .name
= "wndr3700:green:wps",
126 .gpio
= WNDR3700_GPIO_LED_WPS_GREEN
,
129 .name
= "wndr3700:orange:wps",
130 .gpio
= WNDR3700_GPIO_LED_WPS_ORANGE
,
135 static struct gpio_button wndr3700_gpio_buttons
[] __initdata
= {
141 .gpio
= WNDR3700_GPIO_BTN_RESET
,
147 .gpio
= WNDR3700_GPIO_BTN_WPS
,
153 .gpio
= WNDR3700_GPIO_BTN_WIFI
,
157 static void __init
wndr3700_setup(void)
159 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff0000);
161 ar71xx_set_mac_base(mac
);
162 ar71xx_add_device_mdio(0x0);
164 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
165 ar71xx_eth0_data
.phy_mask
= 0xf;
166 ar71xx_eth0_data
.speed
= SPEED_1000
;
167 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
169 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
170 ar71xx_eth1_data
.phy_mask
= 0x10;
172 ar71xx_add_device_eth(0);
173 ar71xx_add_device_eth(1);
175 ar71xx_add_device_usb();
177 ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs
), wndr3700_pci_irqs
);
179 ar71xx_add_device_spi(NULL
, wndr3700_spi_info
,
180 ARRAY_SIZE(wndr3700_spi_info
));
182 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio
),
185 ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL
,
186 ARRAY_SIZE(wndr3700_gpio_buttons
),
187 wndr3700_gpio_buttons
);
190 MIPS_MACHINE(AR71XX_MACH_WNDR3700
, "NETGEAR WNDR3700", wndr3700_setup
);