summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/files/arch/mips
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-12-13 13:33:44 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-12-13 13:33:44 +0000
commitec66b62afa98867774ae1e7a59a6d0a43f456a14 (patch)
tree678bda29634fec640acd7f08e2094e47371b1f03 /target/linux/ar71xx/files/arch/mips
parentb1cd4bd7d87714d8f8baaf432b056d04d5abd8b7 (diff)
ar71xx: add gpios and usb for wzr-hp-g450h
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29509 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g450h.c75
1 files changed, 73 insertions, 2 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g450h.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g450h.c
index ab6c37c94f..b06948a255 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g450h.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g450h.c
@@ -1,7 +1,7 @@
/*
- * Atheros G450 board support
+ * Buffalo WZR-HP-G450G board support
*
- * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
+ * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
* Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
@@ -13,11 +13,18 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <asm/mach-ar71xx/ar71xx.h>
+#include <asm/mach-ar71xx/gpio.h>
#include "machtype.h"
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ap91-pci.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-usb.h"
+
+#define WZRHPG450H_KEYS_POLL_INTERVAL 20 /* msecs */
+#define WZRHPG450H_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG450H_KEYS_POLL_INTERVAL)
#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition wzrhpg450h_partitions[] = {
@@ -62,6 +69,59 @@ static struct flash_platform_data wzrhpg450h_flash_data = {
#endif
};
+static struct gpio_led wzrhpg450h_leds_gpio[] __initdata = {
+ {
+ .name = "buffalo:red:diag",
+ .gpio = 14,
+ .active_low = 1,
+ },
+ {
+ .name = "buffalo:orange:security",
+ .gpio = 13,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button wzrhpg450h_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 6,
+ .active_low = 1,
+ }, {
+ .desc = "usb",
+ .type = EV_KEY,
+ .code = BTN_2,
+ .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 1,
+ .active_low = 1,
+ }, {
+ .desc = "aoss",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 8,
+ .active_low = 1,
+ }, {
+ .desc = "movie_engine",
+ .type = EV_KEY,
+ .code = BTN_6,
+ .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 7,
+ .active_low = 0,
+ }, {
+ .desc = "router_off",
+ .type = EV_KEY,
+ .code = BTN_5,
+ .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 12,
+ .active_low = 0,
+ }
+};
+
+
static void __init wzrhpg450h_init(void)
{
u8 *ee = (u8 *) KSEG1ADDR(0x1f051000);
@@ -76,8 +136,19 @@ static void __init wzrhpg450h_init(void)
ar71xx_eth0_data.duplex = DUPLEX_FULL;
ar71xx_eth0_data.phy_mask = BIT(0);
+ ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpg450h_leds_gpio),
+ wzrhpg450h_leds_gpio);
+
+ ar71xx_register_gpio_keys_polled(-1, WZRHPG450H_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(wzrhpg450h_gpio_keys),
+ wzrhpg450h_gpio_keys);
+
ar71xx_add_device_eth(0);
+ ar71xx_add_device_usb();
+ gpio_request(16, "usb");
+ gpio_direction_output(16, 1);
+
ap91_pci_init(ee, NULL);
}