From: Aurelien Jarno <aurelien@aurel32.net>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: [PATCH 5/6] [MIPS] Add WGT634U reset button support
Date: Wed, 24 Sep 2008 21:23:19 +0200 [thread overview]
Message-ID: <20080924192319.GF18700@volta.aurel32.net> (raw)
In-Reply-To: <20080924191840.GA18700@volta.aurel32.net>
This patch adds support for the reset button of WGT634U machine, using
GPIO interrupts. Based on a patch from Michel Lespinasse.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/bcm47xx/wgt634u.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index f9e309a..db1a72f 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -11,6 +11,9 @@
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
#include <linux/ssb/ssb.h>
+#include <linux/interrupt.h>
+#include <linux/reboot.h>
+#include <asm/gpio.h>
#include <asm/mach-bcm47xx/bcm47xx.h>
/* GPIO definitions for the WGT634U */
@@ -99,6 +102,30 @@ static struct platform_device *wgt634u_devices[] __initdata = {
&wgt634u_gpio_leds,
};
+static irqreturn_t gpio_interrupt(int irq, void *ignored)
+{
+ int state;
+
+ /* Interrupts are shared, check if the current one is
+ a GPIO interrupt. */
+ if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco,
+ SSB_CHIPCO_IRQ_GPIO))
+ return IRQ_NONE;
+
+ state = gpio_get_value(WGT634U_GPIO_RESET);
+
+ /* Interrupt are level triggered, revert the interrupt polarity
+ to clear the interrupt. */
+ gpio_polarity(WGT634U_GPIO_RESET, state);
+
+ if (!state) {
+ printk(KERN_INFO "Reset button pressed");
+ ctrl_alt_del();
+ }
+
+ return IRQ_HANDLED;
+}
+
static int __init wgt634u_init(void)
{
/* There is no easy way to detect that we are running on a WGT634U
@@ -115,6 +142,16 @@ static int __init wgt634u_init(void)
printk(KERN_INFO "WGT634U machine detected.\n");
+ if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
+ gpio_interrupt, IRQF_SHARED,
+ "WGT634U GPIO", &ssb_bcm47xx.chipco)) {
+ gpio_direction_input(WGT634U_GPIO_RESET);
+ gpio_intmask(WGT634U_GPIO_RESET, 1);
+ ssb_chipco_irq_mask(&ssb_bcm47xx.chipco,
+ SSB_CHIPCO_IRQ_GPIO,
+ SSB_CHIPCO_IRQ_GPIO);
+ }
+
wgt634u_flash_data.width = mcore->flash_buswidth;
wgt634u_flash_resource.start = mcore->flash_window;
wgt634u_flash_resource.end = mcore->flash_window
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
next prev parent reply other threads:[~2008-09-24 19:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
2008-09-24 19:19 ` [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code Aurelien Jarno
2008-09-24 21:17 ` Michael Buesch
2008-09-24 22:14 ` Sergei Shtylyov
2008-09-24 22:31 ` Michael Buesch
2008-09-25 0:14 ` John W. Linville
2008-09-25 9:54 ` Sergei Shtylyov
2008-09-25 0:18 ` John W. Linville
2008-09-25 0:18 ` John W. Linville
2008-09-25 10:05 ` Sergei Shtylyov
2008-09-25 12:32 ` Aurelien Jarno
2008-09-25 14:39 ` Sergei Shtylyov
2008-09-25 20:59 ` Michael Buesch
2008-09-25 17:24 ` John W. Linville
2008-09-25 21:00 ` Michael Buesch
2008-09-26 15:42 ` Ralf Baechle
2008-09-26 18:23 ` [PATCH 1/6 v2] " Aurelien Jarno
2008-09-27 14:06 ` [PATCH 1/6 v3] " Aurelien Jarno
2008-09-27 14:35 ` Ralf Baechle
2008-09-24 19:20 ` [PATCH 2/6] [MIPS] WGT634U: Add machine detection message Aurelien Jarno
2008-09-24 19:21 ` [PATCH 3/6] [MIPS] Remove references to BCM947XX Aurelien Jarno
2008-09-24 19:22 ` [PATCH 4/6] [MIPS] BCM47xx: Use the new SSB GPIO API Aurelien Jarno
2008-09-24 19:23 ` Aurelien Jarno [this message]
2008-09-24 19:23 ` [PATCH 6/6] [MIPS] Scan PCI busses when they are registered Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080924192319.GF18700@volta.aurel32.net \
--to=aurelien@aurel32.net \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.