2 * Buffalo WZR-HP-G450G board support
4 * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
5 * Copyright (C) 2008-2012 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/gpio.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
17 #include <asm/mach-ath79/ath79.h>
20 #include "dev-m25p80.h"
21 #include "dev-ap9x-pci.h"
22 #include "dev-gpio-buttons.h"
23 #include "dev-leds-gpio.h"
25 #include "machtypes.h"
27 #define WZRHPG450H_KEYS_POLL_INTERVAL 20 /* msecs */
28 #define WZRHPG450H_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG450H_KEYS_POLL_INTERVAL)
30 static struct mtd_partition wzrhpg450h_partitions[] = {
35 .mask_flags = MTD_WRITEABLE,
44 .mask_flags = MTD_WRITEABLE,
50 .name = "user_property",
56 static struct flash_platform_data wzrhpg450h_flash_data = {
57 .parts = wzrhpg450h_partitions,
58 .nr_parts = ARRAY_SIZE(wzrhpg450h_partitions),
61 static struct gpio_led wzrhpg450h_leds_gpio[] __initdata = {
63 .name = "buffalo:red:diag",
68 .name = "buffalo:orange:security",
75 static struct gpio_led wzrhpg450h_wmac_leds_gpio[] = {
77 .name = "buffalo:blue:movie_engine",
82 .name = "buffalo:green:router",
88 static struct gpio_keys_button wzrhpg450h_gpio_keys[] __initdata = {
93 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
100 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
106 .code = KEY_WPS_BUTTON,
107 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
111 .desc = "movie_engine",
114 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
118 .desc = "router_off",
121 .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
128 static void __init wzrhpg450h_init(void)
130 u8 *ee = (u8 *) KSEG1ADDR(0x1f051000);
131 u8 *mac = (u8 *) ee + 2;
133 ath79_register_m25p80_multi(&wzrhpg450h_flash_data);
135 ath79_register_mdio(0, ~BIT(0));
136 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
137 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
138 ath79_eth0_data.speed = SPEED_1000;
139 ath79_eth0_data.duplex = DUPLEX_FULL;
140 ath79_eth0_data.phy_mask = BIT(0);
142 ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpg450h_leds_gpio),
143 wzrhpg450h_leds_gpio);
145 ath79_register_gpio_keys_polled(-1, WZRHPG450H_KEYS_POLL_INTERVAL,
146 ARRAY_SIZE(wzrhpg450h_gpio_keys),
147 wzrhpg450h_gpio_keys);
149 ath79_register_eth(0);
151 gpio_request_one(16, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
153 ath79_register_usb();
155 ap91_pci_init(ee, NULL);
156 ap9x_pci_setup_wmac_led_pin(0, 15);
157 ap9x_pci_setup_wmac_leds(0, wzrhpg450h_wmac_leds_gpio,
158 ARRAY_SIZE(wzrhpg450h_wmac_leds_gpio));
161 MIPS_MACHINE(ATH79_MACH_WZR_HP_G450H, "WZR-HP-G450H", "Buffalo WZR-HP-G450H",