Implement GPIO interrupt debouncing. Index: linux-2.6.17-git10/arch/arm/mach-ep93xx/core.c =================================================================== --- linux-2.6.17-git10.orig/arch/arm/mach-ep93xx/core.c +++ linux-2.6.17-git10/arch/arm/mach-ep93xx/core.c @@ -154,6 +154,7 @@ struct sys_timer ep93xx_timer = { * GPIO handling for EP93xx *************************************************************************/ static unsigned char gpio_int_enable[2]; +static unsigned char gpio_int_debounce[2]; static unsigned char gpio_int_type1[2]; static unsigned char gpio_int_type2[2]; @@ -161,11 +162,13 @@ static void update_gpio_ab_int_params(in { if (port == 0) { __raw_writeb(0, EP93XX_GPIO_A_INT_ENABLE); + __raw_writeb(gpio_int_debounce[0], EP93XX_GPIO_A_INT_DEBOUNCE); __raw_writeb(gpio_int_type2[0], EP93XX_GPIO_A_INT_TYPE2); __raw_writeb(gpio_int_type1[0], EP93XX_GPIO_A_INT_TYPE1); __raw_writeb(gpio_int_enable[0], EP93XX_GPIO_A_INT_ENABLE); } else if (port == 1) { __raw_writeb(0, EP93XX_GPIO_B_INT_ENABLE); + __raw_writeb(gpio_int_debounce[1], EP93XX_GPIO_B_INT_DEBOUNCE); __raw_writeb(gpio_int_type2[1], EP93XX_GPIO_B_INT_TYPE2); __raw_writeb(gpio_int_type1[1], EP93XX_GPIO_B_INT_TYPE1); __raw_writeb(gpio_int_enable[1], EP93XX_GPIO_B_INT_ENABLE); @@ -331,6 +334,13 @@ static int ep93xx_gpio_ab_irq_type(unsig gpio_int_type1[port] &= ~(1 << line); gpio_int_type2[port] &= ~(1 << line); } + + if (type & IRQT_DEBOUNCE) { + gpio_int_debounce[port] |= 1 << line; + } else { + gpio_int_debounce[port] &= ~(1 << line); + } + update_gpio_ab_int_params(port); return 0; Index: linux-2.6.17-git10/include/asm-arm/arch-ep93xx/ep93xx-regs.h =================================================================== --- linux-2.6.17-git10.orig/include/asm-arm/arch-ep93xx/ep93xx-regs.h +++ linux-2.6.17-git10/include/asm-arm/arch-ep93xx/ep93xx-regs.h @@ -77,11 +77,13 @@ #define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98) #define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c) #define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) +#define EP93XX_GPIO_A_INT_DEBOUNCE EP93XX_GPIO_REG(0xa8) #define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac) #define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0) #define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4) #define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8) #define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) +#define EP93XX_GPIO_B_INT_DEBOUNCE EP93XX_GPIO_REG(0xc4) #define EP93XX_AAC_BASE (EP93XX_APB_VIRT_BASE + 0x00080000) Index: linux-2.6.17-git10/include/asm-arm/irq.h =================================================================== --- linux-2.6.17-git10.orig/include/asm-arm/irq.h +++ linux-2.6.17-git10/include/asm-arm/irq.h @@ -41,6 +41,7 @@ extern void enable_irq(unsigned int); #define IRQT_LOW (__IRQT_LOWLVL) #define IRQT_HIGH (__IRQT_HIGHLVL) #define IRQT_PROBE (1 << 4) +#define IRQT_DEBOUNCE (1 << 5) int set_irq_type(unsigned int irq, unsigned int type); void disable_irq_wake(unsigned int irq);