create release branch for 8.09
[openwrt/svn-archive/archive.git] / target / linux / ifxmips / files / arch / mips / ifxmips / gpio.c
index 931d3ac1d25eda0ce94d5c4405ac6bdd38302318..eef514669837c9bf400e20d07a279be5c8481f84 100644 (file)
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <asm/ifxmips/ifxmips.h>
-#include <asm/ifxmips/ifxmips_ioctl.h>
 
 #define MAX_PORTS                      2
 #define PINS_PER_PORT          16
 
 #ifdef CONFIG_IFXMIPS_GPIO_RST_BTN
-#define IFXMIPS_RST_PIN 15
-#define IFXMIPS_RST_PORT 1
 
+unsigned int rst_port = 1;
+unsigned int rst_pin = 15;
 static struct timer_list rst_button_timer;
 
 extern struct sock *uevent_sock;
@@ -303,16 +302,15 @@ reset_button_poll(unsigned long unused)
 {
        struct event_t *event;
 
-       rst_button_timer.expires = jiffies + HZ;
+       rst_button_timer.expires = jiffies + (HZ / 4);
        add_timer(&rst_button_timer);
 
-       if (pressed != ifxmips_port_get_input(IFXMIPS_RST_PORT, IFXMIPS_RST_PIN))
+       if (pressed != ifxmips_port_get_input(rst_port, rst_pin))
        {
                if(pressed)
                        pressed = 0;
                else
                        pressed = 1;
-               printk("reset button was %s\n", (pressed ? "pressed" : "released"));
                event = (struct event_t *) kzalloc(sizeof(struct event_t), GFP_ATOMIC);
                if (!event)
                {
@@ -334,10 +332,12 @@ ifxmips_gpio_probe(struct platform_device *dev)
        int retval = 0;
 
 #ifdef CONFIG_IFXMIPS_GPIO_RST_BTN
-       ifxmips_port_set_open_drain(IFXMIPS_RST_PORT, IFXMIPS_RST_PIN);
-       ifxmips_port_clear_altsel0(IFXMIPS_RST_PORT, IFXMIPS_RST_PIN);
-       ifxmips_port_clear_altsel1(IFXMIPS_RST_PORT, IFXMIPS_RST_PIN);
-       ifxmips_port_set_dir_in(IFXMIPS_RST_PORT, IFXMIPS_RST_PIN);
+       rst_port = dev->resource[0].start;
+       rst_pin = dev->resource[0].end;
+       ifxmips_port_set_open_drain(rst_port, rst_pin);
+       ifxmips_port_clear_altsel0(rst_port, rst_pin);
+       ifxmips_port_clear_altsel1(rst_port, rst_pin);
+       ifxmips_port_set_dir_in(rst_port, rst_pin);
        seen = jiffies;
        init_timer(&rst_button_timer);
        rst_button_timer.function = reset_button_poll;