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",
85 static struct gpio_keys_button wzrhpg450h_gpio_keys[] __initdata = {
90 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
97 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
103 .code = KEY_WPS_BUTTON,
104 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
108 .desc = "movie_engine",
111 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
115 .desc = "router_off",
118 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
125 static void __init wzrhpg450h_init(void)
127 u8 *ee = (u8 *) KSEG1ADDR(0x1f051000);
128 u8 *mac = (u8 *) ee + 2;
130 ar71xx_add_device_m25p80_multi(&wzrhpg450h_flash_data);
132 ar71xx_add_device_mdio(0, ~BIT(0));
133 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
134 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
135 ar71xx_eth0_data.speed = SPEED_1000;
136 ar71xx_eth0_data.duplex = DUPLEX_FULL;
137 ar71xx_eth0_data.phy_mask = BIT(0);
139 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpg450h_leds_gpio),
140 wzrhpg450h_leds_gpio);
142 ar71xx_register_gpio_keys_polled(-1, WZRHPG450H_KEYS_POLL_INTERVAL,
143 ARRAY_SIZE(wzrhpg450h_gpio_keys),
144 wzrhpg450h_gpio_keys);
146 ar71xx_add_device_eth(0);
148 ar71xx_add_device_usb();
149 gpio_request(16, "usb");
150 gpio_direction_output(16, 1);
152 ap91_pci_init(ee, NULL);
153 ap91_pci_setup_wmac_led_pin(15);
156 MIPS_MACHINE(AR71XX_MACH_WZR_HP_G450H, "WZR-HP-G450H", "Buffalo WZR-HP-G450H",