2 * Buffalo WZR-HP-G450G board support
4 * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@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/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
16 #include <asm/mach-ar71xx/gpio.h>
20 #include "dev-m25p80.h"
21 #include "dev-ap91-pci.h"
22 #include "dev-gpio-buttons.h"
23 #include "dev-leds-gpio.h"
26 #define WZRHPG450H_KEYS_POLL_INTERVAL 20 /* msecs */
27 #define WZRHPG450H_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG450H_KEYS_POLL_INTERVAL)
29 #ifdef CONFIG_MTD_PARTITIONS
30 static struct mtd_partition wzrhpg450h_partitions
[] = {
35 .mask_flags
= MTD_WRITEABLE
,
44 .mask_flags
= MTD_WRITEABLE
,
54 .name
= "user_property",
63 #endif /* CONFIG_MTD_PARTITIONS */
65 static struct flash_platform_data wzrhpg450h_flash_data
= {
66 #ifdef CONFIG_MTD_PARTITIONS
67 .parts
= wzrhpg450h_partitions
,
68 .nr_parts
= ARRAY_SIZE(wzrhpg450h_partitions
),
72 static struct gpio_led wzrhpg450h_leds_gpio
[] __initdata
= {
74 .name
= "buffalo:red:diag",
79 .name
= "buffalo:orange:security",
86 static struct gpio_led wzrhpg450h_wmac_leds_gpio
[] = {
88 .name
= "buffalo:blue:movie_engine",
93 .name
= "buffalo:green:router",
99 static struct gpio_keys_button wzrhpg450h_gpio_keys
[] __initdata
= {
104 .debounce_interval
= WZRHPG450H_KEYS_DEBOUNCE_INTERVAL
,
111 .debounce_interval
= WZRHPG450H_KEYS_DEBOUNCE_INTERVAL
,
117 .code
= KEY_WPS_BUTTON
,
118 .debounce_interval
= WZRHPG450H_KEYS_DEBOUNCE_INTERVAL
,
122 .desc
= "movie_engine",
125 .debounce_interval
= WZRHPG450H_KEYS_DEBOUNCE_INTERVAL
,
129 .desc
= "router_off",
132 .debounce_interval
= WZRHPG450H_KEYS_DEBOUNCE_INTERVAL
,
139 static void __init
wzrhpg450h_init(void)
141 u8
*ee
= (u8
*) KSEG1ADDR(0x1f051000);
142 u8
*mac
= (u8
*) ee
+ 2;
144 ar71xx_add_device_m25p80_multi(&wzrhpg450h_flash_data
);
146 ar71xx_add_device_mdio(0, ~BIT(0));
147 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, mac
, 0);
148 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
149 ar71xx_eth0_data
.speed
= SPEED_1000
;
150 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
151 ar71xx_eth0_data
.phy_mask
= BIT(0);
153 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpg450h_leds_gpio
),
154 wzrhpg450h_leds_gpio
);
156 ar71xx_register_gpio_keys_polled(-1, WZRHPG450H_KEYS_POLL_INTERVAL
,
157 ARRAY_SIZE(wzrhpg450h_gpio_keys
),
158 wzrhpg450h_gpio_keys
);
160 ar71xx_add_device_eth(0);
162 ar71xx_add_device_usb();
163 gpio_request(16, "usb");
164 gpio_direction_output(16, 1);
166 ap91_pci_init(ee
, NULL
);
167 ap91_pci_setup_wmac_led_pin(15);
168 ap91_pci_setup_wmac_leds(wzrhpg450h_wmac_leds_gpio
,
169 ARRAY_SIZE(wzrhpg450h_wmac_leds_gpio
));
172 MIPS_MACHINE(AR71XX_MACH_WZR_HP_G450H
, "WZR-HP-G450H", "Buffalo WZR-HP-G450H",