aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/wgt634u.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/bcm47xx/wgt634u.c')
-rw-r--r--arch/mips/bcm47xx/wgt634u.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index d1d90c9ef2fa..ef00e7f58c24 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -11,6 +11,9 @@
11#include <linux/leds.h> 11#include <linux/leds.h>
12#include <linux/mtd/physmap.h> 12#include <linux/mtd/physmap.h>
13#include <linux/ssb/ssb.h> 13#include <linux/ssb/ssb.h>
14#include <linux/interrupt.h>
15#include <linux/reboot.h>
16#include <linux/gpio.h>
14#include <asm/mach-bcm47xx/bcm47xx.h> 17#include <asm/mach-bcm47xx/bcm47xx.h>
15 18
16/* GPIO definitions for the WGT634U */ 19/* GPIO definitions for the WGT634U */
@@ -99,6 +102,30 @@ static struct platform_device *wgt634u_devices[] __initdata = {
99 &wgt634u_gpio_leds, 102 &wgt634u_gpio_leds,
100}; 103};
101 104
105static irqreturn_t gpio_interrupt(int irq, void *ignored)
106{
107 int state;
108
109 /* Interrupts are shared, check if the current one is
110 a GPIO interrupt. */
111 if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco,
112 SSB_CHIPCO_IRQ_GPIO))
113 return IRQ_NONE;
114
115 state = gpio_get_value(WGT634U_GPIO_RESET);
116
117 /* Interrupt are level triggered, revert the interrupt polarity
118 to clear the interrupt. */
119 gpio_polarity(WGT634U_GPIO_RESET, state);
120
121 if (!state) {
122 printk(KERN_INFO "Reset button pressed");
123 ctrl_alt_del();
124 }
125
126 return IRQ_HANDLED;
127}
128
102static int __init wgt634u_init(void) 129static int __init wgt634u_init(void)
103{ 130{
104 /* There is no easy way to detect that we are running on a WGT634U 131 /* There is no easy way to detect that we are running on a WGT634U
@@ -112,6 +139,19 @@ static int __init wgt634u_init(void)
112 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 139 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
113 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) { 140 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
114 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 141 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
142
143 printk(KERN_INFO "WGT634U machine detected.\n");
144
145 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
146 gpio_interrupt, IRQF_SHARED,
147 "WGT634U GPIO", &ssb_bcm47xx.chipco)) {
148 gpio_direction_input(WGT634U_GPIO_RESET);
149 gpio_intmask(WGT634U_GPIO_RESET, 1);
150 ssb_chipco_irq_mask(&ssb_bcm47xx.chipco,
151 SSB_CHIPCO_IRQ_GPIO,
152 SSB_CHIPCO_IRQ_GPIO);
153 }
154
115 wgt634u_flash_data.width = mcore->flash_buswidth; 155 wgt634u_flash_data.width = mcore->flash_buswidth;
116 wgt634u_flash_resource.start = mcore->flash_window; 156 wgt634u_flash_resource.start = mcore->flash_window;
117 wgt634u_flash_resource.end = mcore->flash_window 157 wgt634u_flash_resource.end = mcore->flash_window