From: David Brownell Date: Wed, 25 May 2005 20:15:43 +0000 (-0700) Subject: [PATCH] ARM: OMAP: omap edge trigger call updates X-Git-Tag: v2.6.13-omap1~135 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=34993dabcbc28edf127763887f53e972a77953ea;p=linux-2.6-omap-h63xx.git [PATCH] ARM: OMAP: omap edge trigger call updates This switches over to using the standard ARM-Linux set_irq_type() call instead of its OMAP-specific variant, and removes the OMAP variant. It also tweaks the SMC driver to include a change requested by the maintainer of that driver. Signed-off-by: David Brownell Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap/gpio-switch.c b/arch/arm/mach-omap/gpio-switch.c index ca47111d55e..1577699f922 100644 --- a/arch/arm/mach-omap/gpio-switch.c +++ b/arch/arm/mach-omap/gpio-switch.c @@ -132,9 +132,9 @@ static void gpio_sw_handler(void *data) &dev_attr_cover_switch.attr); sw->state = state; if (omap_get_gpio_datain(sw->gpio)) - omap_set_gpio_edge_ctrl(sw->gpio, OMAP_GPIO_FALLING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_FALLING); else - omap_set_gpio_edge_ctrl(sw->gpio, OMAP_GPIO_RISING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_RISING); print_sw_state(sw, state); } @@ -165,9 +165,9 @@ static int __init new_switch(struct gpio_switch *sw) omap_set_gpio_direction(sw->gpio, direction); if (omap_get_gpio_datain(sw->gpio)) - omap_set_gpio_edge_ctrl(sw->gpio, OMAP_GPIO_FALLING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_FALLING); else - omap_set_gpio_edge_ctrl(sw->gpio, OMAP_GPIO_RISING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_RISING); switch (sw->type) { case OMAP_GPIO_SWITCH_TYPE_COVER: diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c index e5dcd35f3e8..5436481b676 100644 --- a/arch/arm/mach-omap/gpio.c +++ b/arch/arm/mach-omap/gpio.c @@ -335,9 +335,9 @@ static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) case METHOD_MPUIO: reg += OMAP_MPUIO_GPIO_INT_EDGE; l = __raw_readl((void __iomem *)reg); - if (edge == OMAP_GPIO_RISING_EDGE) + if (edge == IRQT_RISING) l |= 1 << gpio; - else if (edge == OMAP_GPIO_FALLING_EDGE) + else if (edge == IRQT_FALLING) l &= ~(1 << gpio); else goto bad; @@ -345,14 +345,15 @@ static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) case METHOD_GPIO_1510: reg += OMAP1510_GPIO_INT_CONTROL; l = __raw_readl((void __iomem *)reg); - if (edge == OMAP_GPIO_RISING_EDGE) + if (edge == IRQT_RISING) l |= 1 << gpio; - else if (edge == OMAP_GPIO_FALLING_EDGE) + else if (edge == IRQT_FALLING) l &= ~(1 << gpio); else goto bad; break; case METHOD_GPIO_1610: + /* NOTE: knows __IRQT_{FAL,RIS}EDGE match OMAP hardware */ edge &= 0x03; if (gpio & 0x08) reg += OMAP1610_GPIO_EDGE_CTRL2; @@ -366,9 +367,9 @@ static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) case METHOD_GPIO_730: reg += OMAP730_GPIO_INT_CONTROL; l = __raw_readl((void __iomem *)reg); - if (edge == OMAP_GPIO_RISING_EDGE) + if (edge == IRQT_RISING) l |= 1 << gpio; - else if (edge == OMAP_GPIO_FALLING_EDGE) + else if (edge == IRQT_FALLING) l &= ~(1 << gpio); else goto bad; @@ -397,9 +398,6 @@ static int gpio_irq_type(unsigned irq, unsigned type) if (check_gpio(gpio) < 0) return -EINVAL; - /* NOTE: __IRQT_FALEDGE == OMAP_GPIO_FALLING_EDGE, - * and __IRQT_RISEDGE == OMAP_GPIO_RISING_EDGE - */ if (type & (__IRQT_LOWLVL|__IRQT_HIGHLVL|IRQT_PROBE)) return -EINVAL; @@ -410,18 +408,6 @@ static int gpio_irq_type(unsigned irq, unsigned type) return retval; } -void omap_set_gpio_edge_ctrl(int gpio, int edge) -{ - struct gpio_bank *bank; - - if (check_gpio(gpio) < 0) - return; - bank = get_gpio_bank(gpio); - spin_lock(&bank->lock); - _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), edge); - spin_unlock(&bank->lock); -} - static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio) { @@ -431,21 +417,22 @@ static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio) case METHOD_MPUIO: l = __raw_readl(reg + OMAP_MPUIO_GPIO_INT_EDGE); return (l & (1 << gpio)) ? - OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE; + IRQT_RISING : IRQT_FALLING; case METHOD_GPIO_1510: l = __raw_readl(reg + OMAP1510_GPIO_INT_CONTROL); return (l & (1 << gpio)) ? - OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE; + IRQT_RISING : IRQT_FALLING; case METHOD_GPIO_1610: if (gpio & 0x08) reg += OMAP1610_GPIO_EDGE_CTRL2; else reg += OMAP1610_GPIO_EDGE_CTRL1; + /* NOTE: knows __IRQT_{FAL,RIS}EDGE match OMAP hardware */ return (__raw_readl(reg) >> ((gpio & 0x07) << 1)) & 0x03; case METHOD_GPIO_730: l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL); return (l & (1 << gpio)) ? - OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE; + IRQT_RISING : IRQT_FALLING; default: BUG(); return -1; @@ -714,10 +701,10 @@ static void gpio_unmask_irq(unsigned int irq) unsigned int gpio = irq - IH_GPIO_BASE; struct gpio_bank *bank = get_gpio_bank(gpio); - if (_get_gpio_edge_ctrl(bank, get_gpio_index(gpio)) == OMAP_GPIO_NO_EDGE) { + if (_get_gpio_edge_ctrl(bank, get_gpio_index(gpio)) == IRQT_NOEDGE) { printk(KERN_ERR "OMAP GPIO %d: trying to enable GPIO IRQ while no edge is set\n", gpio); - _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), OMAP_GPIO_RISING_EDGE); + _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), IRQT_RISING); } _set_gpio_irqenable(bank, gpio, 1); } @@ -951,6 +938,5 @@ EXPORT_SYMBOL(omap_free_gpio); EXPORT_SYMBOL(omap_set_gpio_direction); EXPORT_SYMBOL(omap_set_gpio_dataout); EXPORT_SYMBOL(omap_get_gpio_datain); -EXPORT_SYMBOL(omap_set_gpio_edge_ctrl); arch_initcall(omap_gpio_sysinit); diff --git a/arch/arm/mach-omap/omap1/board-h2.c b/arch/arm/mach-omap/omap1/board-h2.c index a327211dcfc..c695af8aec0 100644 --- a/arch/arm/mach-omap/omap1/board-h2.c +++ b/arch/arm/mach-omap/omap1/board-h2.c @@ -126,7 +126,6 @@ static void __init h2_init_smc91x(void) printk("Error requesting gpio 0 for smc91x irq\n"); return; } - omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE); } static void __init h2_init_irq(void) diff --git a/arch/arm/mach-omap/omap1/board-h3.c b/arch/arm/mach-omap/omap1/board-h3.c index 1aeee6d1082..533bb4470d8 100644 --- a/arch/arm/mach-omap/omap1/board-h3.c +++ b/arch/arm/mach-omap/omap1/board-h3.c @@ -188,7 +188,6 @@ static void __init h3_init_smc91x(void) printk("Error requesting gpio 40 for smc91x irq\n"); return; } - omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE); } void h3_init_irq(void) diff --git a/arch/arm/mach-omap/omap1/board-innovator.c b/arch/arm/mach-omap/omap1/board-innovator.c index b9ed9b6df7e..a77bcc1c84e 100644 --- a/arch/arm/mach-omap/omap1/board-innovator.c +++ b/arch/arm/mach-omap/omap1/board-innovator.c @@ -174,7 +174,6 @@ static void __init innovator_init_smc91x(void) printk("Error requesting gpio 0 for smc91x irq\n"); return; } - omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE); } } diff --git a/arch/arm/mach-omap/omap1/board-netstar.c b/arch/arm/mach-omap/omap1/board-netstar.c index e1048be509e..f315ef6ef36 100644 --- a/arch/arm/mach-omap/omap1/board-netstar.c +++ b/arch/arm/mach-omap/omap1/board-netstar.c @@ -76,16 +76,15 @@ static void __init netstar_init(void) mdelay(50); /* 50ms until PHY ready */ /* smc91x interrupt pin */ omap_request_gpio(8); - omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE); omap_request_gpio(12); omap_request_gpio(13); omap_request_gpio(14); omap_request_gpio(15); - omap_set_gpio_edge_ctrl(12, OMAP_GPIO_FALLING_EDGE); - omap_set_gpio_edge_ctrl(13, OMAP_GPIO_FALLING_EDGE); - omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE); - omap_set_gpio_edge_ctrl(15, OMAP_GPIO_FALLING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(12), IRQT_FALLING); + set_irq_type(OMAP_GPIO_IRQ(13), IRQT_FALLING); + set_irq_type(OMAP_GPIO_IRQ(14), IRQT_FALLING); + set_irq_type(OMAP_GPIO_IRQ(15), IRQT_FALLING); platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices)); diff --git a/arch/arm/mach-omap/omap1/board-osk.c b/arch/arm/mach-omap/omap1/board-osk.c index ae6dce5cc6c..7186cb11965 100644 --- a/arch/arm/mach-omap/omap1/board-osk.c +++ b/arch/arm/mach-omap/omap1/board-osk.c @@ -147,7 +147,6 @@ static void __init osk_init_smc91x(void) printk("Error requesting gpio 0 for smc91x irq\n"); return; } - omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE); /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ EMIFS_CCS(1) |= 0x2; @@ -160,8 +159,8 @@ static void __init osk_init_cf(void) printk("Error requesting gpio 62 for CF irq\n"); return; } - /* it's really active-low */ - omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE); + /* the CF I/O IRQ is really active-low */ + set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING); } static void __init osk_init_irq(void) diff --git a/arch/arm/mach-omap/omap1/board-voiceblue.c b/arch/arm/mach-omap/omap1/board-voiceblue.c index 4759eb9290e..73a0d5db7de 100644 --- a/arch/arm/mach-omap/omap1/board-voiceblue.c +++ b/arch/arm/mach-omap/omap1/board-voiceblue.c @@ -178,7 +178,6 @@ static void __init voiceblue_init(void) mdelay(50); /* 50ms until PHY ready */ /* smc91x interrupt pin */ omap_request_gpio(8); - omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE); /* 16C554 reset*/ omap_request_gpio(6); omap_set_gpio_direction(6, 0); @@ -188,10 +187,10 @@ static void __init voiceblue_init(void) omap_request_gpio(13); omap_request_gpio(14); omap_request_gpio(15); - omap_set_gpio_edge_ctrl(12, OMAP_GPIO_RISING_EDGE); - omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); - omap_set_gpio_edge_ctrl(14, OMAP_GPIO_RISING_EDGE); - omap_set_gpio_edge_ctrl(15, OMAP_GPIO_RISING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(12), IRQT_RISING); + set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING); + set_irq_type(OMAP_GPIO_IRQ(14), IRQT_RISING); + set_irq_type(OMAP_GPIO_IRQ(15), IRQT_RISING); platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); omap_board_config = voiceblue_config; diff --git a/arch/arm/mach-omap/omap1/fpga.c b/arch/arm/mach-omap/omap1/fpga.c index 7c08f6c2e1d..48d51a58910 100644 --- a/arch/arm/mach-omap/omap1/fpga.c +++ b/arch/arm/mach-omap/omap1/fpga.c @@ -181,7 +181,7 @@ void omap1510_fpga_init_irq(void) */ omap_request_gpio(13); omap_set_gpio_direction(13, 1); - omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING); set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux); } diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index 554701eaf63..68399233135 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c @@ -1601,7 +1601,7 @@ fail1: isp->irq = OMAP_GPIO_IRQ(2); omap_request_gpio(2); omap_set_gpio_direction(2, 1); - omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); + set_irq_type(isp->irq, IRQT_FALLING); } if (machine_is_omap_h3()) { @@ -1610,7 +1610,7 @@ fail1: isp->irq = OMAP_GPIO_IRQ(14); omap_request_gpio(14); omap_set_gpio_direction(14, 1); - omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE); + set_irq_type(isp->irq, IRQT_FALLING); } status = request_irq(isp->irq, isp1301_irq, diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index d2eceaae1eb..984835a1b7b 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c @@ -535,7 +535,7 @@ fail1: tps->irq = OMAP_GPIO_IRQ(58); omap_request_gpio(58); omap_set_gpio_direction(58, 1); - omap_set_gpio_edge_ctrl(58, OMAP_GPIO_FALLING_EDGE); + set_irq_type(tps->irq, IRQT_FALLING); } if (machine_is_omap_osk()) { tps->model = TPS65010; @@ -543,7 +543,7 @@ fail1: tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)); omap_request_gpio(OMAP_MPUIO(1)); omap_set_gpio_direction(OMAP_MPUIO(1), 1); - omap_set_gpio_edge_ctrl(OMAP_MPUIO(1), OMAP_GPIO_FALLING_EDGE); + set_irq_type(tps->irq, IRQT_FALLING); } if (machine_is_omap_h3()) { tps->model = TPS65013; diff --git a/drivers/input/touchscreen/omap/ts_hx.c b/drivers/input/touchscreen/omap/ts_hx.c index 813aef0b521..fac78daaa90 100644 --- a/drivers/input/touchscreen/omap/ts_hx.c +++ b/drivers/input/touchscreen/omap/ts_hx.c @@ -98,7 +98,7 @@ static int __init hx_ts_probe(struct omap_ts_t *ts) }; omap_set_gpio_direction(gpio, 1); - omap_set_gpio_edge_ctrl(gpio, OMAP_GPIO_FALLING_EDGE); + set_irq_type(ts->irq, IRQT_FALLING); return 0; } diff --git a/drivers/input/touchscreen/omap/ts_osk.c b/drivers/input/touchscreen/omap/ts_osk.c index d05afc63557..ab4b1c71368 100644 --- a/drivers/input/touchscreen/omap/ts_osk.c +++ b/drivers/input/touchscreen/omap/ts_osk.c @@ -90,7 +90,7 @@ static int __init osk_ts_probe(struct omap_ts_t *ts) omap_cfg_reg(P20_1610_GPIO4); omap_request_gpio(4); omap_set_gpio_direction(4, 1); - omap_set_gpio_edge_ctrl(4, OMAP_GPIO_FALLING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); ts->irq = PEN_IRQ; diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index 5905f261089..6ada6c98bcf 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c @@ -973,7 +973,7 @@ static int mmc_omap_probe(struct device *dev) } omap_set_gpio_direction(host->switch_pin, 1); - omap_set_gpio_edge_ctrl(host->switch_pin, OMAP_GPIO_RISING_EDGE); + set_irq_type(OMAP_GPIO_IRQ(host->switch_pin), IRQT_RISING); ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin), mmc_omap_switch_irq, 0, DRIVER_NAME, host); if (ret) { diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index a23fdb6bf66..20fb4273247 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c @@ -1990,7 +1990,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr) if (retval) goto err_out; - set_irq_type(dev->irq, IRQ_TRIGGER_TYPE); + set_irq_type(dev->irq, SMC_IRQ_TRIGGER_TYPE); #ifdef SMC_USE_PXA_DMA { diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 8f85dd19875..3a81957a41b 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h @@ -185,7 +185,7 @@ SMC_outw(u16 val, unsigned long ioaddr, int reg) #include #include -#define IRQ_TRIGGER_TYPE (( \ +#define SMC_IRQ_TRIGGER_TYPE (( \ machine_is_omap_h2() \ || machine_is_omap_h3() \ || (machine_is_omap_innovator() && !cpu_is_omap1510()) \ @@ -310,8 +310,8 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) #endif -#ifndef IRQ_TRIGGER_TYPE -#define IRQ_TRIGGER_TYPE IRQT_RISING +#ifndef SMC_IRQ_TRIGGER_TYPE +#define SMC_IRQ_TRIGGER_TYPE IRQT_RISING #endif #ifdef SMC_USE_PXA_DMA diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h index e49ff06f60c..b017122e97c 100644 --- a/include/asm-arm/arch-omap/gpio.h +++ b/include/asm-arm/arch-omap/gpio.h @@ -52,12 +52,6 @@ IH_MPUIO_BASE + ((nr) & 0x0f) : \ IH_GPIO_BASE + ((nr) & 0x3f)) -/* For EDGECTRL */ -#define OMAP_GPIO_NO_EDGE 0x00 -#define OMAP_GPIO_FALLING_EDGE 0x01 -#define OMAP_GPIO_RISING_EDGE 0x02 -#define OMAP_GPIO_BOTH_EDGES 0x03 - extern int omap_gpio_init(void); /* Call from board init only */ extern int omap_request_gpio(int gpio); extern void omap_free_gpio(int gpio); @@ -65,7 +59,4 @@ extern void omap_set_gpio_direction(int gpio, int is_input); extern void omap_set_gpio_dataout(int gpio, int enable); extern int omap_get_gpio_datain(int gpio); -/* use ARM-standard set_irq_type() instead */ -extern void __deprecated omap_set_gpio_edge_ctrl(int gpio, int edge); - #endif