aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2011-11-12 23:39:56 +0000
committerJohn Crispin <blogic@openwrt.org>2011-11-12 23:39:56 +0000
commite685dc989d72f0a1783f7d4ec5d1a2677d76fabf (patch)
tree2fcdcb73ceac5a43fd5fbf00f0c5f0cde1269154
parent5d23a8d4b2da465f7ec22f3c03ad52ec751bd45a (diff)
downloadupstream-e685dc989d72f0a1783f7d4ec5d1a2677d76fabf.tar.gz
upstream-e685dc989d72f0a1783f7d4ec5d1a2677d76fabf.tar.bz2
upstream-e685dc989d72f0a1783f7d4ec5d1a2677d76fabf.zip
lantiq: adds hotplug handler for handling buttons and makes w303v work with it
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28999 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh22
-rw-r--r--target/linux/lantiq/files-3.1/arch/mips/lantiq/xway/mach-arv45xx.c19
2 files changed, 39 insertions, 2 deletions
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh b/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
new file mode 100644
index 0000000000..b2fdda23f8
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+[ "${ACTION}" = "released" ] || exit 0
+
+. /lib/functions.sh
+
+case "${BUTTON}" in
+ BTN_0)
+ logger "reset pressed"
+ sync
+ reboot
+ ;;
+ BTN_1)
+ logger "factory pressed"
+ jffs2_mark_erase "rootfs_data"
+ sync
+ reboot
+ ;;
+ *)
+ logger "unknown button ${BUTTON}"
+ ;;
+esac
diff --git a/target/linux/lantiq/files-3.1/arch/mips/lantiq/xway/mach-arv45xx.c b/target/linux/lantiq/files-3.1/arch/mips/lantiq/xway/mach-arv45xx.c
index b08ada5e3f..751667514d 100644
--- a/target/linux/lantiq/files-3.1/arch/mips/lantiq/xway/mach-arv45xx.c
+++ b/target/linux/lantiq/files-3.1/arch/mips/lantiq/xway/mach-arv45xx.c
@@ -22,6 +22,7 @@
#include <lantiq_soc.h>
#include <lantiq_platform.h>
#include <dev-gpio-leds.h>
+#include <dev-gpio-buttons.h>
#include "../machtypes.h"
#include "../dev-wifi-rt2x00.h"
@@ -460,11 +461,11 @@ MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
"ARV452CPW - Arcor A801",
arv452Cpw_init);
-#define ARV4525PW_MADWIFI_ADDR 0xb07f0400
static void __init
arv4525pw_init(void)
{
+#define ARV4525PW_MADWIFI_ADDR 0xb07f0400
ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
ltq_register_nor(&arv45xx_flash_data);
ltq_pci_data.clock = PCI_CLOCK_INT;
@@ -479,13 +480,27 @@ MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
"ARV4525PW - Speedport W502V",
arv4525pw_init);
+static struct gpio_keys_button
+arv7525pw_gpio_keys[] __initdata = {
+ {
+ .desc = "restart",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 29,
+ .active_low = 1,
+ },
+};
+
static void __init
arv7525pw_init(void)
{
ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
ltq_register_nor(&arv7525_flash_data);
+ ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(arv7525pw_gpio_keys), arv7525pw_gpio_keys);
ltq_pci_data.clock = PCI_CLOCK_INT;
- ltq_pci_data.gpio |= PCI_EXIN1;
+ ltq_pci_data.gpio = PCI_GNT1 | PCI_EXIN1;
ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31);
ltq_register_pci(&ltq_pci_data);
ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;