arm/imx: kill macro MXC_GPIO_IRQ_START
Subsystems (8)
cover arm/imx: kill macro MXC_GPIO_IRQ_START
Hi Arnd, Sascha,
The imx gpio interrupt controller is currently broken for DT users. I have sent the following two patches to fix them.
- arm/imx: fix return type of callback passed to of_irq_init()
http://www.spinics.net/lists/arm-kernel/msg149891.html
- arm/imx: fix irq_base for gpio
http://www.spinics.net/lists/arm-kernel/msg149892.html
Inspired by the patches/discussion from Stephen Warren and Rob Herring, I decided to send this series to fix the problem in a cleaner way, which will kill the macro MXC_GPIO_IRQ_START and let the gpio and irq numbers be dynamically allocated for both DT and non-DT users, rather than the statically defining currently used in non-DT case.
Please let me know if you would send the series through -rc. If you do, that's great. If you do not, that's fine, since it touches many files and looks more like a cleanup work, and I will send your the above quick/temporary fixing for -rc, and then rebase this series on top of it and send for v3.3.
Regards,
Shawn
Jamie Iles (1):
irqdomain: export irq_domain_simple_ops for !CONFIG_OF
Shawn Guo (5):
arm/imx: eliminate macro IMX_GPIO_TO_IRQ()
arm/imx: eliminate macro IOMUX_TO_IRQ()
arm/imx: eliminate macro IRQ_GPIOx()
gpio/mxc: adopt irq_domain in gpio driver
arm/imx: remove macro MXC_GPIO_IRQ_START
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 3 +- arch/arm/mach-imx/mach-apf9328.c | 6 ++- arch/arm/mach-imx/mach-armadillo5x0.c | 12 ++++-- arch/arm/mach-imx/mach-cpuimx27.c | 12 ++++-- arch/arm/mach-imx/mach-cpuimx35.c | 3 +- arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 8 ++-- arch/arm/mach-imx/mach-imx6q.c | 12 ----- arch/arm/mach-imx/mach-kzm_arm11_01.c | 20 +++++++-- arch/arm/mach-imx/mach-mx21ads.c | 5 +- arch/arm/mach-imx/mach-mx27_3ds.c | 3 +- arch/arm/mach-imx/mach-mx27ads.c | 12 +++--- arch/arm/mach-imx/mach-mx31_3ds.c | 13 +++--- arch/arm/mach-imx/mach-mx31ads.c | 14 ++++-- arch/arm/mach-imx/mach-mx31lilly.c | 10 +++- arch/arm/mach-imx/mach-mx31lite.c | 10 +++- arch/arm/mach-imx/mach-mx31moboard.c | 4 +- arch/arm/mach-imx/mach-mxt_td60.c | 6 +- arch/arm/mach-imx/mach-pca100.c | 4 +- arch/arm/mach-imx/mach-pcm037.c | 18 +++++--- arch/arm/mach-imx/mach-pcm038.c | 4 +- arch/arm/mach-imx/mach-qong.c | 9 ++-- arch/arm/mach-imx/mach-scb9328.c | 6 ++- arch/arm/mach-imx/mach-vpr200.c | 3 +- arch/arm/mach-imx/mx31lilly-db.c | 5 +- arch/arm/mach-imx/mx31lite-db.c | 5 +- arch/arm/mach-imx/pcm970-baseboard.c | 13 +++--- arch/arm/mach-mx5/board-cpuimx51.c | 12 ++++-- arch/arm/mach-mx5/board-cpuimx51sd.c | 6 ++- arch/arm/mach-mx5/board-mx53_ard.c | 5 +- arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | 3 +- arch/arm/mach-mx5/imx51-dt.c | 11 ----- arch/arm/mach-mx5/imx53-dt.c | 11 ----- arch/arm/mach-mx5/mx51_efika.c | 3 +- arch/arm/plat-mxc/include/mach/hardware.h | 2 - arch/arm/plat-mxc/include/mach/iomux-mx3.h | 3 - arch/arm/plat-mxc/include/mach/iomux-v1.h | 12 +++--- arch/arm/plat-mxc/include/mach/irqs.h | 2 - drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-mxc.c | 57 ++++++++++++++------------ include/linux/irqdomain.h | 3 +- kernel/irq/irqdomain.c | 12 +++-- 41 files changed, 195 insertions(+), 168 deletions(-)
PATCH 1/1 ARM: mx5: use generic irq chip pm interface for pm functions on
From: Hui Wang <[email protected]>
Two problems exist in the current i.MX5 pm suspend/resume and idle functions. The first is the current i.MX5 suspend routine will call tzic_enable_wake(1) to set wake source, this will set all enabled irq as wake source rather than those wake capable. The second is i.MX5 idle will call mx5_cpu_lp_set() to prepare enter low power mode, but it forgets to call wfi instruction to enter this mode.
To fix these two problems, using generic irq chip pm interface and modify function imx5_idle().
[Tested by Shawn Guo on imx51 babbage board.
Tested by Hui Wang on imx51 pdk board.]
---
Hi Sascha,
This is a repost of patch below.
http://comments.gmane.org/gmane.linux.ports.arm.kernel/136087
The patch looks pretty good to me, and I'm not sure why you did not apply it (missed?). Anyway, I repost it here after rebasing on v3.2-rc4.
Regards,
Shawn
arch/arm/mach-mx5/mm.c | 19 +++++++++++++++- arch/arm/mach-mx5/system.c | 3 -- arch/arm/plat-mxc/include/mach/mxc.h | 2 +- arch/arm/plat-mxc/tzic.c | 40 ++++++++++++++++++++++++--------- 4 files changed, 48 insertions(+), 16 deletions(-)
arch/arm/mach-mx5/mm.c +18 -1
@@ -13,6 +13,7 @@#include <linux/mm.h> #include <linux/init.h> +#include <linux/clk.h> #include <asm/mach/map.h>
@@ -21,10 +22,26 @@#include <mach/devices-common.h> #include <mach/iomux-v3.h> +static struct clk *gpc_dvfs_clk; +static void imx5_idle (void ) { -if (!need_resched ()) +if (!need_resched ()) { +/* gpc clock is needed for SRPG */ +if (gpc_dvfs_clk ==NULL ) { + gpc_dvfs_clk =clk_get (NULL ,"gpc_dvfs" ); +if (IS_ERR (gpc_dvfs_clk)) + goto err0; + } +clk_enable (gpc_dvfs_clk);mx5_cpu_lp_set (WAIT_UNCLOCKED_POWER_OFF ); +if (tzic_enable_wake ()) + goto err1; +cpu_do_idle (); +err1: +clk_disable (gpc_dvfs_clk); + } +err0:local_irq_enable (); }
arch/arm/mach-mx5/system.c +0 -3
@@ -55,9 +55,6 @@ void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode) stop_mode =1 ; } arm_srpgcr |=MXC_SRPGCR_PCR ; - -if (tzic_enable_wake (1 ) !=0 ) -return ;break ;case STOP_POWER_ON : ccm_clpcr |=0x2 <<MXC_CCM_CLPCR_LPM_OFFSET ;
arch/arm/plat-mxc/include/mach/mxc.h +1 -1
@@ -168,7 +168,7 @@ struct cpu_op { u32 cpu_rate; }; -int tzic_enable_wake (int is_idle); +int tzic_enable_wake (void );extern struct cpu_op *(*get_cpu_op)(int *op);#endif
arch/arm/plat-mxc/tzic.c +29 -11
@@ -73,7 +73,28 @@ static int tzic_set_irq_fiq(unsigned int irq, unsigned int type)#define tzic_set_irq_fiq NULL#endif -static unsigned int *wakeup_intr[4 ]; +#ifdef CONFIG_PM +static void tzic_irq_suspend (struct irq_data *d) +{ +struct irq_chip_generic *gc =irq_data_get_irq_chip_data (d); +int idx = gc->irq_base >>5 ; + +__raw_writel (gc->wake_active, tzic_base +TZIC_WAKEUP0 (idx)); +} + +static void tzic_irq_resume (struct irq_data *d) +{ +struct irq_chip_generic *gc =irq_data_get_irq_chip_data (d); +int idx = gc->irq_base >>5 ; + +__raw_writel (__raw_readl (tzic_base +TZIC_ENSET0 (idx)), + tzic_base +TZIC_WAKEUP0 (idx)); +} + +#else +#define tzic_irq_suspend NULL +#define tzic_irq_resume NULL +#endif static struct mxc_extra_irq tzic_extra_irq = {#ifdef CONFIG_FIQ
@@ -91,12 +112,13 @@ static __init void tzic_init_gc(unsigned int irq_start) handle_level_irq); gc->private = &tzic_extra_irq; gc->wake_enabled =IRQ_MSK (32 ); - wakeup_intr[idx] = &gc->wake_active; ct = gc->chip_types; ct->chip.irq_mask = irq_gc_mask_disable_reg; ct->chip.irq_unmask = irq_gc_unmask_enable_reg; ct->chip.irq_set_wake = irq_gc_set_wake; + ct->chip.irq_suspend = tzic_irq_suspend; + ct->chip.irq_resume = tzic_irq_resume; ct->regs.disable =TZIC_ENCLEAR0 (idx); ct->regs.enable =TZIC_ENSET0 (idx);
@@ -167,23 +189,19 @@ void __init tzic_init_irq(void __iomem *irqbase)/** * tzic_enable_wake() - enable wakeup interrupt * -* @param is_idle 1 if called in idle loop (ENSET0 register); -* 0 to be used when called from low power entry * @return 0 if successful; non-zero otherwise */ -int tzic_enable_wake (int is_idle) +int tzic_enable_wake (void ) { -unsigned int i, v; +unsigned int i;__raw_writel (1 , tzic_base +TZIC_DSMINT );if (unlikely (__raw_readl (tzic_base +TZIC_DSMINT ) ==0 ))return -EAGAIN ; -for (i =0 ; i <4 ; i++) { - v = is_idle ?__raw_readl (tzic_base +TZIC_ENSET0 (i)) : - *wakeup_intr[i]; -__raw_writel (v, tzic_base +TZIC_WAKEUP0 (i)); - } +for (i =0 ; i <4 ; i++) +__raw_writel (__raw_readl (tzic_base +TZIC_ENSET0 (i)), + tzic_base +TZIC_WAKEUP0 (i));return 0 ; }
Signature · 1 line
1.7.4.1
PATCH 1/1 ARM: mx5: use generic irq chip pm interface for pm functions on
Sorry, this one should not be in the series. Please ignore.
Regards,
Shawn
Quoted 31 lines · Shawn Guo
From: Hui Wang <[email protected]>
Two problems exist in the current i.MX5 pm suspend/resume and idle functions. The first is the current i.MX5 suspend routine will call
tzic_enable_wake(1)to set wake source, this will set all enabled irq as wake source rather than those wake capable. The second is i.MX5 idle will callmx5_cpu_lp_set()to prepare enter low power mode, but it forgets to call wfi instruction to enter this mode.To fix these two problems, using generic irq chip pm interface and modify function
imx5_idle().[Tested by Shawn Guo on imx51 babbage board.
Tested by Hui Wang on imx51 pdk board.]Signed-off-by Hui Wang <[email protected]>Signed-off-by Shawn Guo <[email protected]>---
Hi Sascha,This is a repost of patch below.
http://comments.gmane.org/gmane.linux.ports.arm.kernel/136087
The patch looks pretty good to me, and I'm not sure why you did not apply it (missed?). Anyway, I repost it here after rebasing on v3.2-rc4.
Regards,
Shawn
PATCH 1/6 irqdomain: export irq_domain_simple_ops for !CONFIG_OF
In reply to Shawn GuoFrom: Jamie Iles <[email protected]>
irqdomain support is used in interrupt controller drivers that may not have device tree support but only need the basic HW->Linux irq translation. Rather than having each of these implement their own IRQ domain, allow them to use the simple ops.
--- include/linux/irqdomain.h | 3 ++- kernel/irq/irqdomain.c | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
include/linux/irqdomain.h +2 -1
@@ -91,10 +91,11 @@ static inline unsigned int irq_domain_to_irq(struct irq_domain *d,extern void irq_domain_add (struct irq_domain *domain);extern void irq_domain_del (struct irq_domain *domain); + +extern struct irq_domain_ops irq_domain_simple_ops;#endif /* CONFIG_IRQ_DOMAIN */ #if defined(CONFIG_IRQ_DOMAIN ) && defined(CONFIG_OF_IRQ ) -extern struct irq_domain_ops irq_domain_simple_ops;extern void irq_domain_add_simple (struct device_node *controller,int irq_base);extern void irq_domain_generate_simple (const struct of_device_id *match,u64 phys_base,unsigned int irq_start);
kernel/irq/irqdomain.c +7 -5
@@ -143,11 +143,6 @@ int irq_domain_simple_dt_translate(struct irq_domain *d,return 0 ; } -struct irq_domain_ops irq_domain_simple_ops = { - .dt_translate = irq_domain_simple_dt_translate, -}; -EXPORT_SYMBOL_GPL (irq_domain_simple_ops); -/** * irq_domain_create_simple() - Set up a 'simple' translation range */
@@ -182,3 +177,10 @@ void irq_domain_generate_simple(const struct of_device_id *match, }EXPORT_SYMBOL_GPL (irq_domain_generate_simple);#endif /* CONFIG_OF_IRQ */ + +struct irq_domain_ops irq_domain_simple_ops = { +#ifdef CONFIG_OF_IRQ + .dt_translate = irq_domain_simple_dt_translate, +#endif /* CONFIG_OF_IRQ */ +}; +EXPORT_SYMBOL_GPL (irq_domain_simple_ops);
Signature · 1 line
1.7.4.1
PATCH 1/6 irqdomain: export irq_domain_simple_ops for !CONFIG_OF
Quoted 8 lines · Shawn Guo
From: Jamie Iles <[email protected]>
irqdomain support is used in interrupt controller drivers that may not have device tree support but only need the basic
HW->Linuxirq translation. Rather than having each of these implement their own IRQ domain, allow them to use the simple ops.
Quoted 5 lines
Cc Thomas Gleixner <[email protected]>Cc Rob Herring <[email protected]>Cc Grant Likely <[email protected]>Signed-off-by Jamie Iles <[email protected]>Acked-by Rob Herring <[email protected]>
I'm fine with taking this through arm-soc with an Ack from Thomas.
Arnd
PATCH 2/6 arm/imx: eliminate macro IMX_GPIO_TO_IRQ()
In reply to Shawn GuoThis patch changes all the static gpio irq number assigning with IMX_GPIO_TO_IRQ() to run-time assigning with gpio_to_irq call, and in turn eliminates the macro IMX_GPIO_TO_IRQ().
--- arch/arm/mach-imx/mach-cpuimx35.c | 3 ++- arch/arm/mach-imx/mach-mx27_3ds.c | 3 ++- arch/arm/mach-imx/mach-vpr200.c | 3 ++- arch/arm/mach-mx5/board-cpuimx51.c | 12 ++++++++---- arch/arm/mach-mx5/board-cpuimx51sd.c | 6 ++++-- arch/arm/mach-mx5/board-mx53_ard.c | 5 +++-- arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | 3 ++- arch/arm/mach-mx5/mx51_efika.c | 3 ++- arch/arm/plat-mxc/include/mach/hardware.h | 2 -- 9 files changed, 25 insertions(+), 15 deletions(-)
arch/arm/mach-imx/mach-cpuimx35.c +2 -1
@@ -66,7 +66,7 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = { I2C_BOARD_INFO("tsc2007", 0x48), .type = "tsc2007", .platform_data = &tsc2007_info, - .irq = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO), + /* irq number is run-time assigned */ }, };
@@ -167,6 +167,7 @@ static void __init eukrea_cpuimx35_init(void)imx35_add_imx_uart0 (&uart_pdata);imx35_add_mxc_nand (&eukrea_cpuimx35_nand_board_info); + eukrea_cpuimx35_i2c_devices[1 ].irq =gpio_to_irq (TSC2007_IRQGPIO );i2c_register_board_info (0 , eukrea_cpuimx35_i2c_devices,ARRAY_SIZE (eukrea_cpuimx35_i2c_devices));imx35_add_imx_i2c0 (&eukrea_cpuimx35_i2c0_data);
arch/arm/mach-imx/mach-mx27_3ds.c +2 -1
@@ -356,7 +356,7 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { .bus_num = 1, .chip_select = 0, /* SS0 */ .platform_data = &mc13783_pdata, - .irq = IMX_GPIO_TO_IRQ(PMIC_INT), + /* irq number is run-time assigned */ .mode = SPI_CS_HIGH, }, { .modalias = "l4f00242t03",
@@ -398,6 +398,7 @@ static void __init mx27pdk_init(void)imx27_add_spi_imx1 (&spi2_pdata);imx27_add_spi_imx0 (&spi1_pdata); + mx27_3ds_spi_devs[0 ].irq =gpio_to_irq (PMIC_INT );spi_register_board_info (mx27_3ds_spi_devs,ARRAY_SIZE (mx27_3ds_spi_devs));
arch/arm/mach-imx/mach-vpr200.c +2 -1
@@ -162,7 +162,7 @@ static struct i2c_board_info vpr200_i2c_devices[] = { }, { I2C_BOARD_INFO("mc13892", 0x08), .platform_data = &vpr200_pmic, - .irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT), +/* irq number is run-time assigned */ } };
@@ -299,6 +299,7 @@ static void __init vpr200_board_init(void)imx35_add_mxc_nand (&vpr200_nand_board_info);imx35_add_sdhci_esdhc_imx (0 ,NULL ); + vpr200_i2c_devices[1 ].irq =gpio_to_irq (GPIO_PMIC_INT );i2c_register_board_info (0 , vpr200_i2c_devices,ARRAY_SIZE (vpr200_i2c_devices));
arch/arm/mach-mx5/board-cpuimx51.c +8 -4
@@ -54,7 +54,7 @@static struct plat_serial8250_port serial_platform_data[] = { { .mapbase = (unsigned long )(MX51_CS1_BASE_ADDR +0x400000 ), - .irq =IMX_GPIO_TO_IRQ (CPUIMX51_QUARTA_GPIO ), +/* irq number is run-time assigned */ .irqflags =IRQF_TRIGGER_HIGH , .uartclk =CPUIMX51_QUART_XTAL , .regshift =CPUIMX51_QUART_REGSHIFT ,
@@ -62,7 +62,7 @@ static struct plat_serial8250_port serial_platform_data[] = { .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, }, { .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x800000), - .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTB_GPIO), +/* irq number is run-time assigned */ .irqflags = IRQF_TRIGGER_HIGH, .uartclk = CPUIMX51_QUART_XTAL, .regshift = CPUIMX51_QUART_REGSHIFT,
@@ -70,7 +70,7 @@ static struct plat_serial8250_port serial_platform_data[] = { .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, }, { .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x1000000), - .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTC_GPIO), +/* irq number is run-time assigned */ .irqflags = IRQF_TRIGGER_HIGH, .uartclk = CPUIMX51_QUART_XTAL, .regshift = CPUIMX51_QUART_REGSHIFT,
@@ -78,7 +78,7 @@ static struct plat_serial8250_port serial_platform_data[] = { .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, }, { .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000), - .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTD_GPIO), +/* irq number is run-time assigned */ .irqflags = IRQF_TRIGGER_HIGH, .uartclk = CPUIMX51_QUART_XTAL, .regshift = CPUIMX51_QUART_REGSHIFT,
@@ -260,6 +260,10 @@ static void __init eukrea_cpuimx51_init(void)gpio_free (CPUIMX51_QUARTD_GPIO );imx51_add_fec (NULL ); + serial_platform_data[0 ].irq =gpio_to_irq (CPUIMX51_QUARTA_GPIO ); + serial_platform_data[1 ].irq =gpio_to_irq (CPUIMX51_QUARTB_GPIO ); + serial_platform_data[2 ].irq =gpio_to_irq (CPUIMX51_QUARTC_GPIO ); + serial_platform_data[3 ].irq =gpio_to_irq (CPUIMX51_QUARTD_GPIO );platform_add_devices (devices,ARRAY_SIZE (devices));imx51_add_imx_i2c (1 , &eukrea_cpuimx51_i2c_data);
arch/arm/mach-mx5/board-cpuimx51sd.c +4 -2
@@ -126,7 +126,7 @@ static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = { I2C_BOARD_INFO("tsc2007", 0x49), .type = "tsc2007", .platform_data = &tsc2007_info, - .irq = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO), + /* irq number is run-time assigned */ }, };
@@ -242,7 +242,7 @@ static struct spi_board_info cpuimx51sd_spi_device[] = { .mode = SPI_MODE_0, .chip_select = 0, .platform_data = &mcp251x_info, - .irq =IMX_GPIO_TO_IRQ (CAN_IRQGPIO ) + /* irq number is run-time assigned */ }, };
@@ -288,6 +288,7 @@ static void __init eukrea_cpuimx51sd_init(void)msleep (20 );gpio_set_value (CAN_RST ,1 );imx51_add_ecspi (0 , &cpuimx51sd_ecspi1_pdata); + cpuimx51sd_spi_device[0 ].irq =gpio_to_irq (CAN_IRQGPIO );spi_register_board_info (cpuimx51sd_spi_device,ARRAY_SIZE (cpuimx51sd_spi_device));
@@ -295,6 +296,7 @@ static void __init eukrea_cpuimx51sd_init(void)gpio_direction_input (TSC2007_IRQGPIO );gpio_free (TSC2007_IRQGPIO ); + eukrea_cpuimx51sd_i2c_devices[1 ].irq =gpio_to_irq (TSC2007_IRQGPIO );i2c_register_board_info (0 , eukrea_cpuimx51sd_i2c_devices,ARRAY_SIZE (eukrea_cpuimx51sd_i2c_devices));platform_add_devices (platform_devices,ARRAY_SIZE (platform_devices));
arch/arm/mach-mx5/board-mx53_ard.c +3 -2
@@ -134,8 +134,7 @@ static struct resource ard_smsc911x_resources[] = { .flags = IORESOURCE_MEM, }, { - .start = IMX_GPIO_TO_IRQ(ARD_ETHERNET_INT_B), - .end = IMX_GPIO_TO_IRQ(ARD_ETHERNET_INT_B), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ, }, };
@@ -231,6 +230,8 @@ static void __init mx53_ard_board_init(void)imx53_ard_common_init ();mx53_ard_io_init (); + ard_smsc911x_resources[1 ].start =gpio_to_irq (ARD_ETHERNET_INT_B ); + ard_smsc911x_resources[1 ].end =gpio_to_irq (ARD_ETHERNET_INT_B );platform_add_devices (devices,ARRAY_SIZE (devices));imx53_add_sdhci_esdhc_imx (0 , &mx53_ard_sd1_data);
arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +2 -1
@@ -159,7 +159,7 @@ struct tsc2007_platform_data tsc2007_data = {static struct i2c_board_info mbimx51_i2c_devices[] = { {I2C_BOARD_INFO ("tsc2007" ,0x49 ), - .irq =IMX_GPIO_TO_IRQ (MBIMX51_TSC2007_GPIO ), +/* irq number is run-time assigned */ .platform_data = &tsc2007_data, }, {I2C_BOARD_INFO ("tlv320aic23" ,0x1a ),
@@ -198,6 +198,7 @@ void __init eukrea_mbimx51_baseboard_init(void)gpio_direction_input (MBIMX51_TSC2007_GPIO );irq_set_irq_type (gpio_to_irq (MBIMX51_TSC2007_GPIO ),IRQF_TRIGGER_FALLING ); + mbimx51_i2c_devices[0 ].irq =gpio_to_irq (MBIMX51_TSC2007_GPIO );i2c_register_board_info (1 , mbimx51_i2c_devices,ARRAY_SIZE (mbimx51_i2c_devices));
arch/arm/mach-mx5/mx51_efika.c +2 -1
@@ -587,7 +587,7 @@ static struct spi_board_info mx51_efika_spi_board_info[] __initdata = { .bus_num = 0, .chip_select = 0, .platform_data = &mx51_efika_mc13892_data, - .irq = IMX_GPIO_TO_IRQ(EFIKAMX_PMIC), + /* irq number is run-time assigned */ }, };
@@ -620,6 +620,7 @@ void __init efika_board_common_init(void)gpio_request (EFIKAMX_PMIC ,"pmic irq" );gpio_direction_input (EFIKAMX_PMIC ); + mx51_efika_spi_board_info[1 ].irq =gpio_to_irq (EFIKAMX_PMIC );spi_register_board_info (mx51_efika_spi_board_info,ARRAY_SIZE (mx51_efika_spi_board_info));imx51_add_ecspi (0 , &mx51_efika_spi_pdata);
arch/arm/plat-mxc/include/mach/hardware.h +0 -2
@@ -131,6 +131,4 @@/* range e.g. GPIO_1_5 is gpio 5 under linux */ #define IMX_GPIO_NR (bank, nr) (((bank) - 1) * 32 + (nr)) -#define IMX_GPIO_TO_IRQ (gpio) (MXC_GPIO_IRQ_START + (gpio)) -#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
Signature · 1 line
1.7.4.1
PATCH 3/6 arm/imx: eliminate macro IOMUX_TO_IRQ()
In reply to Shawn GuoThis patch changes all the static gpio irq number assigning with IOMUX_TO_IRQ() to run-time assigning with gpio_to_irq call, and in turn eliminates the macro IOMUX_TO_IRQ().
--- arch/arm/mach-imx/mach-armadillo5x0.c | 12 ++++++++---- arch/arm/mach-imx/mach-kzm_arm11_01.c | 20 +++++++++++++++----- arch/arm/mach-imx/mach-mx31_3ds.c | 13 ++++++------- arch/arm/mach-imx/mach-mx31ads.c | 14 +++++++++----- arch/arm/mach-imx/mach-mx31lilly.c | 10 +++++++--- arch/arm/mach-imx/mach-mx31lite.c | 10 +++++++--- arch/arm/mach-imx/mach-mx31moboard.c | 4 +++- arch/arm/mach-imx/mach-pcm037.c | 18 ++++++++++++------ arch/arm/mach-imx/mach-qong.c | 9 +++++---- arch/arm/mach-imx/mx31lilly-db.c | 5 +++-- arch/arm/mach-imx/mx31lite-db.c | 5 +++-- arch/arm/plat-mxc/include/mach/iomux-mx3.h | 3 --- 12 files changed, 78 insertions(+), 45 deletions(-)
arch/arm/mach-imx/mach-armadillo5x0.c +8 -4
@@ -406,7 +406,8 @@ static int armadillo5x0_sdhc1_init(struct device *dev,gpio_direction_input (gpio_wp);/* When supported the trigger type have to be BOTH */ - ret =request_irq (IOMUX_TO_IRQ (MX31_PIN_ATA_DMACK ), detect_irq, + ret =request_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_ATA_DMACK )), + detect_irq,IRQF_DISABLED |IRQF_TRIGGER_FALLING ,"sdhc-detect" , data);
@@ -427,7 +428,7 @@ err_gpio_free:static void armadillo5x0_sdhc1_exit (struct device *dev,void *data) { -free_irq (IOMUX_TO_IRQ (MX31_PIN_ATA_DMACK ), data); +free_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_ATA_DMACK )), data);gpio_free (IOMUX_TO_GPIO (MX31_PIN_ATA_DMACK ));gpio_free (IOMUX_TO_GPIO (MX31_PIN_ATA_RESET_B )); }
@@ -448,8 +449,7 @@ static struct resource armadillo5x0_smc911x_resources[] = { .end = MX31_CS3_BASE_ADDR + SZ_32M - 1, .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0), - .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, }, };
@@ -489,6 +489,10 @@ static void __init armadillo5x0_init(void)mxc_iomux_setup_multiple_pins (armadillo5x0_pins,ARRAY_SIZE (armadillo5x0_pins),"armadillo5x0" ); + armadillo5x0_smc911x_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_0 )); + armadillo5x0_smc911x_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_0 ));platform_add_devices (devices,ARRAY_SIZE (devices));imx_add_gpio_keys (&armadillo5x0_button_data);imx31_add_imx_i2c1 (NULL );
arch/arm/mach-imx/mach-kzm_arm11_01.c +15 -5
@@ -71,7 +71,7 @@ static struct plat_serial8250_port serial_platform_data[] = { { .membase = KZM_ARM11_IO_ADDRESS(KZM_ARM11_16550), .mapbase = KZM_ARM11_16550, - .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), +/* irq number is run-time assigned */ .irqflags = IRQ_TYPE_EDGE_RISING, .uartclk = 14745600, .regshift = 0,
@@ -89,8 +89,7 @@ static struct resource serial8250_resources[] = { .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), - .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ, }, };
@@ -123,6 +122,13 @@ static int __init kzm_init_ext_uart(void) tmp |=0x2 ;__raw_writeb (tmp,KZM_ARM11_IO_ADDRESS (KZM_ARM11_CTL1 )); + serial_platform_data[0 ].irq = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_1 )); + serial8250_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_1 )); + serial8250_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_1 )); + return platform_device_register(&serial_device); }#else
@@ -150,8 +156,7 @@ static struct resource kzm_smsc9118_resources[] = { .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_2), - .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_2), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, }, };
@@ -175,6 +180,11 @@ static int __init kzm_init_smsc9118(void)gpio_request (IOMUX_TO_GPIO (MX31_PIN_GPIO1_2 ),"smsc9118-int" );gpio_direction_input (IOMUX_TO_GPIO (MX31_PIN_GPIO1_2 )); + kzm_smsc9118_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_2 )); + kzm_smsc9118_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_2 )); + return platform_device_register(&kzm_smsc9118_device); }#else
arch/arm/mach-imx/mach-mx31_3ds.c +6 -7
@@ -43,9 +43,6 @@#include "devices-imx31.h" -/* CPLD IRQ line for external uart, external ethernet etc */ -#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) -static int mx31_3ds_pins[] = {/* UART1 */ MX31_PIN_CTS1__CTS1 ,
@@ -311,7 +308,7 @@ static int mx31_3ds_sdhc1_init(struct device *dev,return ret; } - ret =request_irq (IOMUX_TO_IRQ (MX31_PIN_GPIO3_1 ), + ret =request_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO3_1 )), detect_irq,IRQF_DISABLED |IRQF_TRIGGER_FALLING |IRQF_TRIGGER_RISING ,"sdhc1-detect" , data);
@@ -330,7 +327,7 @@ gpio_free:static void mx31_3ds_sdhc1_exit (struct device *dev,void *data) { -free_irq (IOMUX_TO_IRQ (MX31_PIN_GPIO3_1 ), data); +free_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO3_1 )), data);gpio_free_array (mx31_3ds_sdhc1_gpios,ARRAY_SIZE (mx31_3ds_sdhc1_gpios)); }
@@ -522,7 +519,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { .bus_num = 1, .chip_select = 1, /* SS2 */ .platform_data = &mc13783_pdata, - .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), + /* irq number is run-time assigned */ .mode = SPI_CS_HIGH, }, { .modalias = "l4f00242t03",
@@ -697,6 +694,7 @@ static void __init mx31_3ds_init(void)imx31_add_mxc_nand (&mx31_3ds_nand_board_info);imx31_add_spi_imx1 (&spi1_pdata); + mx31_3ds_spi_devs[0 ].irq =gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_3 ));spi_register_board_info (mx31_3ds_spi_devs,ARRAY_SIZE (mx31_3ds_spi_devs));
@@ -719,7 +717,8 @@ static void __init mx31_3ds_init(void)if (!otg_mode_host)imx31_add_fsl_usb2_udc (&usbotg_pdata); -if (mxc_expio_init (MX31_CS5_BASE_ADDR ,EXPIO_PARENT_INT )) +if (mxc_expio_init (MX31_CS5_BASE_ADDR , +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_1 ))))printk (KERN_WARNING "Init of the debug board failed, all " "devices on the debug board are unusable.\n" );imx31_add_imx2_wdt (NULL );
arch/arm/mach-imx/mach-mx31ads.c +9 -5
@@ -60,7 +60,6 @@#define PBC_INTSTATUS_REG (PBC_INTSTATUS + PBC_BASE_ADDRESS)#define PBC_INTMASK_SET_REG (PBC_INTMASK_SET + PBC_BASE_ADDRESS)#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) -#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)#define MXC_IRQ_TO_EXPIO (irq) ((irq) - MXC_EXP_IO_BASE)
@@ -184,7 +183,7 @@ static struct irq_chip expio_irq_chip = {static void __init mx31ads_init_expio (void ) { -int i; +int i, irq;printk (KERN_INFO "MX31ADS EXPIO(CPLD) hardware\n" );
@@ -201,8 +200,9 @@ static void __init mx31ads_init_expio(void)irq_set_chip_and_handler (i, &expio_irq_chip, handle_level_irq);set_irq_flags (i,IRQF_VALID ); } -irq_set_irq_type (EXPIO_PARENT_INT ,IRQ_TYPE_LEVEL_HIGH ); -irq_set_chained_handler (EXPIO_PARENT_INT , mx31ads_expio_irq_handler); + irq =gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_4 )); +irq_set_irq_type (irq,IRQ_TYPE_LEVEL_HIGH ); +irq_set_chained_handler (irq, mx31ads_expio_irq_handler); }#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
@@ -463,13 +463,17 @@ static struct i2c_board_info __initdata mx31ads_i2c1_devices[] = { { I2C_BOARD_INFO("wm8350", 0x1a), .platform_data = &mx31_wm8350_pdata, - .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), + /* irq number is run-time assigned */ }, #endif }; static void __init mxc_init_i2c(void) { +#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 + mx31ads_i2c1_devices[0].irq = + gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); +#endif i2c_register_board_info(1, mx31ads_i2c1_devices, ARRAY_SIZE(mx31ads_i2c1_devices));
arch/arm/mach-imx/mach-mx31lilly.c +7 -3
@@ -63,8 +63,7 @@ static struct resource smsc91x_resources[] = { .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0), - .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, } };
@@ -231,7 +230,7 @@ static struct spi_board_info mc13783_dev __initdata = { .bus_num = 1, .chip_select = 0, .platform_data = &mc13783_pdata, - .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), +/* irq number is run-time assigned */ };static struct platform_device *devices[]__initdata = {
@@ -278,8 +277,13 @@ static void __init mx31lilly_board_init(void)imx31_add_spi_imx0 (&spi0_pdata);imx31_add_spi_imx1 (&spi1_pdata); + mc13783_dev.irq =gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_3 ));spi_register_board_info (&mc13783_dev,1 ); + smsc91x_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_0 )); + smsc91x_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_0 ));platform_add_devices (devices,ARRAY_SIZE (devices));/* USB */
arch/arm/mach-imx/mach-mx31lite.c +7 -3
@@ -81,8 +81,7 @@ static struct resource smsc911x_resources[] = { .end = MX31_CS4_BASE_ADDR + 0x100, .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(MX31_PIN_SFS6), - .end = IOMUX_TO_IRQ(MX31_PIN_SFS6), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ, }, };
@@ -122,7 +121,7 @@ static struct spi_board_info mc13783_spi_dev __initdata = { .bus_num = 1, .chip_select = 0, .platform_data = &mc13783_pdata, - .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), +/* irq number is run-time assigned */ };/*
@@ -251,6 +250,7 @@ static void __init mx31lite_init(void)imx31_add_mxc_nand (&mx31lite_nand_board_info);imx31_add_spi_imx1 (&spi1_pdata); + mc13783_spi_dev.irq =gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_3 ));spi_register_board_info (&mc13783_spi_dev,1 );/* USB */
@@ -265,6 +265,10 @@ static void __init mx31lite_init(void)pr_warning ("could not get LAN irq gpio\n" ); else {gpio_direction_input (IOMUX_TO_GPIO (MX31_PIN_SFS6 )); + smsc911x_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_SFS6 )); + smsc911x_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_SFS6 ));platform_device_register (&smsc911x_device); } }
arch/arm/mach-imx/mach-mx31moboard.c +3 -1
@@ -288,7 +288,7 @@ static struct mc13xxx_platform_data moboard_pmic = {static struct spi_board_info moboard_spi_board_info[]__initdata = { { .modalias ="mc13783" , - .irq =IOMUX_TO_IRQ (MX31_PIN_GPIO1_3 ), +/* irq number is run-time assigned */ .max_speed_hz =300000 , .bus_num =1 , .chip_select =0 ,
@@ -540,6 +540,8 @@ static void __init mx31moboard_init(void)gpio_request (IOMUX_TO_GPIO (MX31_PIN_GPIO1_3 ),"pmic-irq" );gpio_direction_input (IOMUX_TO_GPIO (MX31_PIN_GPIO1_3 )); + moboard_spi_board_info[0 ].irq = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_3 ));spi_register_board_info (moboard_spi_board_info,ARRAY_SIZE (moboard_spi_board_info));
arch/arm/mach-imx/mach-pcm037.c +12 -6
@@ -222,8 +222,7 @@ static struct resource smsc911x_resources[] = { .end = MX31_CS1_BASE_ADDR + 0x300 + SZ_64K - 1, .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), - .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, }, };
@@ -368,7 +367,7 @@ static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,gpio_direction_input (SDHC1_GPIO_WP );#endif - ret =request_irq (IOMUX_TO_IRQ (MX31_PIN_SCK6 ), detect_irq, + ret =request_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_SCK6 )), detect_irq,IRQF_DISABLED |IRQF_TRIGGER_FALLING ,"sdhc-detect" , data);if (ret)
@@ -388,7 +387,7 @@ err_gpio_free:static void pcm970_sdhc1_exit (struct device *dev,void *data) { -free_irq (IOMUX_TO_IRQ (MX31_PIN_SCK6 ), data); +free_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_SCK6 )), data);gpio_free (SDHC1_GPIO_DET );gpio_free (SDHC1_GPIO_WP ); }
@@ -508,8 +507,7 @@ static struct resource pcm970_sja1000_resources[] = { .end = MX31_CS5_BASE_ADDR + 0x100 - 1, .flags = IORESOURCE_MEM, }, { - .start = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)), - .end = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, }, };
@@ -623,6 +621,10 @@ static void __init pcm037_init(void)pr_warning ("could not get LAN irq gpio\n" ); else {gpio_direction_input (IOMUX_TO_GPIO (MX31_PIN_GPIO3_1 )); + smsc911x_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO3_1 )); + smsc911x_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO3_1 ));platform_device_register (&pcm037_eth); }
@@ -649,6 +651,10 @@ static void __init pcm037_init(void)pcm037_init_camera (); + pcm970_sja1000_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (IOMUX_PIN (48 ,105 ))); + pcm970_sja1000_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (IOMUX_PIN (48 ,105 )));platform_device_register (&pcm970_sja1000);if (otg_mode_host) {
arch/arm/mach-imx/mach-qong.c +5 -4
@@ -51,8 +51,6 @@ (QONG_FPGA_BASEADDR + QONG_DNET_ID * QONG_FPGA_PERIPH_SIZE)#define QONG_DNET_SIZE 0x00001000 -#define QONG_FPGA_IRQ IOMUX_TO_IRQ(MX31_PIN_DTR_DCE1) -static const struct imxuart_platform_data uart_pdata__initconst = { .flags =IMXUART_HAVE_RTSCTS , };
@@ -78,8 +76,7 @@ static struct resource dnet_resources[] = { .end = QONG_DNET_BASEADDR + QONG_DNET_SIZE - 1, .flags = IORESOURCE_MEM, }, { - .start = QONG_FPGA_IRQ, - .end = QONG_FPGA_IRQ, +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ, }, };
@@ -95,6 +92,10 @@ static int __init qong_init_dnet(void) {int ret; + dnet_resources[1 ].start = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_DTR_DCE1 )); + dnet_resources[1 ].end = +gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_DTR_DCE1 )); ret =platform_device_register (&dnet_device);return ret; }
arch/arm/mach-imx/mx31lilly-db.c +3 -2
@@ -130,7 +130,8 @@ static int mxc_mmc1_init(struct device *dev,gpio_direction_input (gpio_det);gpio_direction_input (gpio_wp); - ret =request_irq (IOMUX_TO_IRQ (MX31_PIN_GPIO1_1 ), detect_irq, + ret =request_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_1 )), + detect_irq,IRQF_DISABLED |IRQF_TRIGGER_FALLING ,"MMC detect" , data);if (ret)
@@ -151,7 +152,7 @@ static void mxc_mmc1_exit(struct device *dev, void *data) {gpio_free (gpio_det);gpio_free (gpio_wp); -free_irq (IOMUX_TO_IRQ (MX31_PIN_GPIO1_1 ), data); +free_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_GPIO1_1 )), data); }static const struct imxmmc_platform_data mmc_pdata__initconst = {
arch/arm/mach-imx/mx31lite-db.c +3 -2
@@ -116,7 +116,8 @@ static int mxc_mmc1_init(struct device *dev,gpio_direction_input (gpio_det);gpio_direction_input (gpio_wp); - ret =request_irq (IOMUX_TO_IRQ (MX31_PIN_DCD_DCE1 ), detect_irq, + ret =request_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_DCD_DCE1 )), + detect_irq,IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING ,"MMC detect" , data);if (ret)
@@ -137,7 +138,7 @@ static void mxc_mmc1_exit(struct device *dev, void *data) {gpio_free (gpio_det);gpio_free (gpio_wp); -free_irq (IOMUX_TO_IRQ (MX31_PIN_DCD_DCE1 ), data); +free_irq (gpio_to_irq (IOMUX_TO_GPIO (MX31_PIN_DCD_DCE1 )), data); }static const struct imxmmc_platform_data mmc_pdata__initconst = {
arch/arm/plat-mxc/include/mach/iomux-mx3.h +0 -3
@@ -160,9 +160,6 @@ int mxc_iomux_mode(unsigned int pin_mode);#define IOMUX_TO_GPIO (iomux_pin) \ ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) -#define IOMUX_TO_IRQ (iomux_pin) \ - (((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) + \ - MXC_GPIO_IRQ_START)/* * This enumeration is constructed based on the Section
Signature · 1 line
1.7.4.1
PATCH 4/6 arm/imx: eliminate macro IRQ_GPIOx()
In reply to Shawn GuoThis patch changes all the static gpio irq number assigning with IRQ_GPIOA() ... IRQ_GPIOF() to run-time assigning with gpio_to_irq call, and in turn eliminates these macros.
--- arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 3 ++- arch/arm/mach-imx/mach-apf9328.c | 6 ++++-- arch/arm/mach-imx/mach-cpuimx27.c | 12 ++++++++---- arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 8 ++++---- arch/arm/mach-imx/mach-mx21ads.c | 5 ++--- arch/arm/mach-imx/mach-mx27ads.c | 12 ++++++------ arch/arm/mach-imx/mach-mxt_td60.c | 6 +++--- arch/arm/mach-imx/mach-pca100.c | 4 ++-- arch/arm/mach-imx/mach-pcm038.c | 4 +++- arch/arm/mach-imx/mach-scb9328.c | 6 ++++-- arch/arm/mach-imx/pcm970-baseboard.c | 13 +++++++------ arch/arm/plat-mxc/include/mach/iomux-v1.h | 12 ++++++------ 12 files changed, 51 insertions(+), 40 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +2 -1
@@ -267,7 +267,7 @@ static struct spi_board_info __maybe_unused .bus_num = 0, .chip_select = 0, .max_speed_hz = 1500000, - .irq = IRQ_GPIOD(25), +/* irq number is run-time assigned */ .platform_data = &ads7846_config, .mode = SPI_MODE_2, },
@@ -349,6 +349,7 @@ void __init eukrea_mbimx27_baseboard_init(void)/* SPI_CS0 init */ mxc_gpio_mode (GPIO_PORTD |28 |GPIO_GPIO |GPIO_OUT );imx27_add_spi_imx0 (&eukrea_mbimx27_spi0_data); + eukrea_mbimx27_spi_board_info[0 ].irq =gpio_to_irq (IMX_GPIOD (25 ));spi_register_board_info (eukrea_mbimx27_spi_board_info,ARRAY_SIZE (eukrea_mbimx27_spi_board_info));
arch/arm/mach-imx/mach-apf9328.c +4 -2
@@ -18,6 +18,7 @@#include <linux/platform_device.h> #include <linux/mtd/physmap.h> #include <linux/dm9000.h> +#include <linux/gpio.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -83,8 +84,7 @@ static struct resource dm9000_resources[] = { .end = MX1_CS4_PHYS + 0x00C00003, .flags = IORESOURCE_MEM, }, { - .start = IRQ_GPIOB(14), - .end = IRQ_GPIOB(14), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, }, };
@@ -119,6 +119,8 @@ static void __init apf9328_init(void)imx1_add_imx_uart0 (NULL );imx1_add_imx_uart1 (&uart1_pdata); + dm9000_resources[2 ].start =gpio_to_irq (IMX_GPIOB (14 )); + dm9000_resources[2 ].end =gpio_to_irq (IMX_GPIOB (14 ));platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-imx/mach-cpuimx27.c +8 -4
@@ -169,28 +169,28 @@ static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {static struct plat_serial8250_port serial_platform_data[] = { { .mapbase = (unsigned long )(MX27_CS3_BASE_ADDR +0x200000 ), - .irq =IRQ_GPIOB (23 ), +/* irq number is run-time assigned */ .uartclk =14745600 , .regshift =1 , .iotype =UPIO_MEM , .flags =UPF_BOOT_AUTOCONF |UPF_SKIP_TEST |UPF_IOREMAP , }, { .mapbase = (unsigned long )(MX27_CS3_BASE_ADDR +0x400000 ), - .irq =IRQ_GPIOB (22 ), +/* irq number is run-time assigned */ .uartclk =14745600 , .regshift =1 , .iotype =UPIO_MEM , .flags =UPF_BOOT_AUTOCONF |UPF_SKIP_TEST |UPF_IOREMAP , }, { .mapbase = (unsigned long )(MX27_CS3_BASE_ADDR +0x800000 ), - .irq =IRQ_GPIOB (27 ), +/* irq number is run-time assigned */ .uartclk =14745600 , .regshift =1 , .iotype =UPIO_MEM , .flags =UPF_BOOT_AUTOCONF |UPF_SKIP_TEST |UPF_IOREMAP , }, { .mapbase = (unsigned long )(MX27_CS3_BASE_ADDR +0x1000000 ), - .irq =IRQ_GPIOB (30 ), +/* irq number is run-time assigned */ .uartclk =14745600 , .regshift =1 , .iotype =UPIO_MEM ,
@@ -279,6 +279,10 @@ static void __init eukrea_cpuimx27_init(void)#endif #if defined(CONFIG_SERIAL_8250 ) || defined(CONFIG_SERIAL_8250_MODULE ) + serial_platform_data[0 ].irq =IMX_GPIOB (23 ); + serial_platform_data[1 ].irq =IMX_GPIOB (22 ); + serial_platform_data[2 ].irq =IMX_GPIOB (27 ); + serial_platform_data[3 ].irq =IMX_GPIOB (30 );platform_device_register (&serial_device);#endif
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +4 -4
@@ -40,7 +40,7 @@#include "devices-imx27.h" #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) -#define SDHC1_IRQ IRQ_GPIOB(25) +#define SDHC1_IRQ_GPIO IMX_GPIOB(25)static const int visstrim_m10_pins[]__initconst = {/* UART1 (console) */
@@ -142,14 +142,14 @@ static int visstrim_m10_sdhc1_init(struct device *dev, {int ret; - ret =request_irq (SDHC1_IRQ , detect_irq,IRQF_TRIGGER_FALLING , -"mmc-detect" , data); + ret =request_irq (gpio_to_irq (SDHC1_IRQ_GPIO ), detect_irq, +IRQF_TRIGGER_FALLING ,"mmc-detect" , data);return ret; }static void visstrim_m10_sdhc1_exit (struct device *dev,void *data) { -free_irq (SDHC1_IRQ , data); +free_irq (gpio_to_irq (SDHC1_IRQ_GPIO ), data); }static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata__initconst = {
arch/arm/mach-imx/mach-mx21ads.c +2 -3
@@ -37,7 +37,6 @@#define MX21ADS_REG_ADDR (offset) (void __force __iomem *) \ (MX21ADS_MMIO_BASE_ADDR + (offset)) -#define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11)#define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000)#define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000)#define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000)
@@ -229,13 +228,13 @@ static int mx21ads_sdhc_get_ro(struct device *dev)static int mx21ads_sdhc_init (struct device *dev,irq_handler_t detect_irq,void *data) { -return request_irq (IRQ_GPIOD (25 ), detect_irq, +return request_irq (gpio_to_irq (IMX_GPIOD (25 )), detect_irq,IRQF_TRIGGER_FALLING ,"mmc-detect" , data); }static void mx21ads_sdhc_exit (struct device *dev,void *data) { -free_irq (IRQ_GPIOD (25 ), data); +free_irq (gpio_to_irq (IMX_GPIOD (25 )), data); }static const struct imxmmc_platform_data mx21ads_sdhc_pdata__initconst = {
arch/arm/mach-imx/mach-mx27ads.c +6 -6
@@ -246,25 +246,25 @@ static const struct imx_fb_platform_data mx27ads_fb_data __initconst = {static int mx27ads_sdhc1_init (struct device *dev,irq_handler_t detect_irq,void *data) { -return request_irq (IRQ_GPIOE (21 ), detect_irq,IRQF_TRIGGER_RISING , -"sdhc1-card-detect" , data); +return request_irq (gpio_to_irq (IMX_GPIOE (21 )), detect_irq, +IRQF_TRIGGER_RISING ,"sdhc1-card-detect" , data); }static int mx27ads_sdhc2_init (struct device *dev,irq_handler_t detect_irq,void *data) { -return request_irq (IRQ_GPIOB (7 ), detect_irq,IRQF_TRIGGER_RISING , -"sdhc2-card-detect" , data); +return request_irq (gpio_to_irq (IMX_GPIOB (7 )), detect_irq, +IRQF_TRIGGER_RISING ,"sdhc2-card-detect" , data); }static void mx27ads_sdhc1_exit (struct device *dev,void *data) { -free_irq (IRQ_GPIOE (21 ), data); +free_irq (gpio_to_irq (IMX_GPIOE (21 )), data); }static void mx27ads_sdhc2_exit (struct device *dev,void *data) { -free_irq (IRQ_GPIOB (7 ), data); +free_irq (gpio_to_irq (IMX_GPIOB (7 )), data); }static const struct imxmmc_platform_data sdhc1_pdata__initconst = {
arch/arm/mach-imx/mach-mxt_td60.c +3 -3
@@ -213,13 +213,13 @@ static const struct imx_fb_platform_data mxt_td60_fb_data __initconst = {static int mxt_td60_sdhc1_init (struct device *dev,irq_handler_t detect_irq,void *data) { -return request_irq (IRQ_GPIOF (8 ), detect_irq,IRQF_TRIGGER_FALLING , -"sdhc1-card-detect" , data); +return request_irq (gpio_to_irq (IMX_GPIOF (8 )), detect_irq, +IRQF_TRIGGER_FALLING ,"sdhc1-card-detect" , data); }static void mxt_td60_sdhc1_exit (struct device *dev,void *data) { -free_irq (IRQ_GPIOF (8 ), data); +free_irq (gpio_to_irq (IMX_GPIOF (8 )), data); }static const struct imxmmc_platform_data sdhc1_pdata__initconst = {
arch/arm/mach-imx/mach-pca100.c +2 -2
@@ -246,7 +246,7 @@ static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq, {int ret; - ret =request_irq (IRQ_GPIOC (29 ), detect_irq, + ret =request_irq (gpio_to_irq (IMX_GPIOC (29 )), detect_irq,IRQF_DISABLED |IRQF_TRIGGER_FALLING ,"imx-mmc-detect" , data);if (ret)
@@ -258,7 +258,7 @@ static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq,static void pca100_sdhc2_exit (struct device *dev,void *data) { -free_irq (IRQ_GPIOC (29 ), data); +free_irq (gpio_to_irq (IMX_GPIOC (29 )), data); }static const struct imxmmc_platform_data sdhc_pdata__initconst = {
arch/arm/mach-imx/mach-pcm038.c +3 -1
@@ -27,6 +27,7 @@#include <linux/mfd/mc13783.h> #include <linux/spi/spi.h> #include <linux/irq.h> +#include <linux/gpio.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -274,7 +275,7 @@ static struct mc13xxx_platform_data pcm038_pmic = {static struct spi_board_info pcm038_spi_board_info[]__initdata = { { .modalias ="mc13783" , - .irq =IRQ_GPIOB (23 ), +/* irq number is run-time assigned */ .max_speed_hz =300000 , .bus_num =0 , .chip_select =0 ,
@@ -325,6 +326,7 @@ static void __init pcm038_init(void)mxc_gpio_mode (GPIO_PORTB |23 |GPIO_GPIO |GPIO_IN );imx27_add_spi_imx0 (&pcm038_spi0_data); + pcm038_spi_board_info[0 ].irq =gpio_to_irq (IMX_GPIOB (23 ));spi_register_board_info (pcm038_spi_board_info,ARRAY_SIZE (pcm038_spi_board_info));
arch/arm/mach-imx/mach-scb9328.c +4 -2
@@ -14,6 +14,7 @@#include <linux/mtd/physmap.h> #include <linux/interrupt.h> #include <linux/dm9000.h> +#include <linux/gpio.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -78,8 +79,7 @@ static struct resource dm9000x_resources[] = { .end = MX1_CS5_PHYS + 5, .flags = IORESOURCE_MEM, /* data access */ }, { - .start = IRQ_GPIOC(3), - .end = IRQ_GPIOC(3), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, }, };
@@ -123,6 +123,8 @@ static void __init scb9328_init(void)imx1_add_imx_uart0 (&uart_pdata);printk (KERN_INFO "Scb9328: Adding devices\n" ); + dm9000x_resources[2 ].start =gpio_to_irq (IMX_GPIOC (3 )); + dm9000x_resources[2 ].end =gpio_to_irq (IMX_GPIOC (3 ));platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-imx/pcm970-baseboard.c +7 -6
@@ -95,14 +95,14 @@ static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void {int ret; - ret =request_irq (IRQ_GPIOC (29 ), detect_irq,IRQF_TRIGGER_FALLING , -"imx-mmc-detect" , data); + ret =request_irq (gpio_to_irq (IMX_GPIOC (29 )), detect_irq, +IRQF_TRIGGER_FALLING ,"imx-mmc-detect" , data);if (ret)return ret; ret =gpio_request (GPIO_PORTC +28 ,"imx-mmc-ro" );if (ret) { -free_irq (IRQ_GPIOC (29 ), data); +free_irq (gpio_to_irq (IMX_GPIOC (29 )), data);return ret; }
@@ -113,7 +113,7 @@ static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, voidstatic void pcm970_sdhc2_exit (struct device *dev,void *data) { -free_irq (IRQ_GPIOC (29 ), data); +free_irq (gpio_to_irq (IMX_GPIOC (29 )), data);gpio_free (GPIO_PORTC +28 ); }
@@ -192,8 +192,7 @@ static struct resource pcm970_sja1000_resources[] = { .end = MX27_CS4_BASE_ADDR + 0x100 - 1, .flags = IORESOURCE_MEM, }, { - .start = IRQ_GPIOE(19), - .end = IRQ_GPIOE(19), +/* irq number is run-time assigned */ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, }, };
@@ -227,5 +226,7 @@ void __init pcm970_baseboard_init(void)imx27_add_imx_fb (&pcm038_fb_data);mxc_gpio_mode (GPIO_PORTC |28 |GPIO_GPIO |GPIO_IN );imx27_add_mxc_mmc (1 , &sdhc_pdata); + pcm970_sja1000_resources[1 ].start =gpio_to_irq (IMX_GPIOE (19 )); + pcm970_sja1000_resources[1 ].end =gpio_to_irq (IMX_GPIOE (19 ));platform_device_register (&pcm970_sja1000); }
arch/arm/plat-mxc/include/mach/iomux-v1.h +6 -6
@@ -85,12 +85,12 @@#define GPIO_BOUT_0 (2 << GPIO_BOUT_SHIFT)#define GPIO_BOUT_1 (3 << GPIO_BOUT_SHIFT) -#define IRQ_GPIOA (x) (MXC_GPIO_IRQ_START + x) -#define IRQ_GPIOB (x) (IRQ_GPIOA(32) + x) -#define IRQ_GPIOC (x) (IRQ_GPIOB(32) + x) -#define IRQ_GPIOD (x) (IRQ_GPIOC(32) + x) -#define IRQ_GPIOE (x) (IRQ_GPIOD(32) + x) -#define IRQ_GPIOF (x) (IRQ_GPIOE(32) + x) +#define IMX_GPIOA (x) (GPIO_PORTA + x) +#define IMX_GPIOB (x) (GPIO_PORTB + x) +#define IMX_GPIOC (x) (GPIO_PORTC + x) +#define IMX_GPIOD (x) (GPIO_PORTD + x) +#define IMX_GPIOE (x) (GPIO_PORTE + x) +#define IMX_GPIOF (x) (GPIO_PORTF + x)extern int mxc_gpio_mode (int gpio_mode); extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
Signature · 1 line
1.7.4.1
PATCH 5/6 gpio/mxc: adopt irq_domain in gpio driver
In reply to Shawn GuoIt adopts irq_domain for gpio interrupt controller in gpio-mxc driver, and fixes the translation between irq and gpio number for DT users.
As the results, macro MXC_GPIO_IRQ_START is not referenced any more by gpio-mxc driver, and the irq_domain initilization for gpio ports in platform code is removed.
--- arch/arm/mach-imx/mach-imx6q.c | 12 -------- arch/arm/mach-mx5/imx51-dt.c | 11 ------- arch/arm/mach-mx5/imx53-dt.c | 11 ------- drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-mxc.c | 57 +++++++++++++++++++++------------------ 5 files changed, 32 insertions(+), 60 deletions(-)
arch/arm/mach-imx/mach-imx6q.c +0 -12
@@ -12,7 +12,6 @@#include <linux/init.h> #include <linux/irq.h> -#include <linux/irqdomain.h> #include <linux/of.h> #include <linux/of_irq.h> #include <linux/of_platform.h>
@@ -37,19 +36,8 @@ static void __init imx6q_map_io(void)imx6q_clock_map_io (); } -static void __init imx6q_gpio_add_irq_domain (struct device_node *np, -struct device_node *interrupt_parent) -{ -static int gpio_irq_base =MXC_GPIO_IRQ_START +ARCH_NR_GPIOS - -32 *7 ;/* imx6q gets 7 gpio ports */ - -irq_domain_add_simple (np, gpio_irq_base); - gpio_irq_base +=32 ; -} -static const struct of_device_id imx6q_irq_match[]__initconst = { { .compatible ="arm,cortex-a9-gic" , .data = gic_of_init, }, - { .compatible ="fsl,imx6q-gpio" , .data = imx6q_gpio_add_irq_domain, }, {/* sentinel */ } };
arch/arm/mach-mx5/imx51-dt.c +0 -11
@@ -50,19 +50,8 @@ static void __init imx51_tzic_add_irq_domain(struct device_node *np,irq_domain_add_simple (np,0 ); } -static void __init imx51_gpio_add_irq_domain (struct device_node *np, -struct device_node *interrupt_parent) -{ -static int gpio_irq_base =MXC_GPIO_IRQ_START +ARCH_NR_GPIOS - -32 *4 ;/* imx51 gets 4 gpio ports */ - -irq_domain_add_simple (np, gpio_irq_base); - gpio_irq_base +=32 ; -} -static const struct of_device_id imx51_irq_match[]__initconst = { { .compatible ="fsl,imx51-tzic" , .data = imx51_tzic_add_irq_domain, }, - { .compatible ="fsl,imx51-gpio" , .data = imx51_gpio_add_irq_domain, }, {/* sentinel */ } };
arch/arm/mach-mx5/imx53-dt.c +0 -11
@@ -54,19 +54,8 @@ static void __init imx53_tzic_add_irq_domain(struct device_node *np,irq_domain_add_simple (np,0 ); } -static void __init imx53_gpio_add_irq_domain (struct device_node *np, -struct device_node *interrupt_parent) -{ -static int gpio_irq_base =MXC_GPIO_IRQ_START +ARCH_NR_GPIOS - -32 *7 ;/* imx53 gets 7 gpio ports */ - -irq_domain_add_simple (np, gpio_irq_base); - gpio_irq_base +=32 ; -} -static const struct of_device_id imx53_irq_match[]__initconst = { { .compatible ="fsl,imx53-tzic" , .data = imx53_tzic_add_irq_domain, }, - { .compatible ="fsl,imx53-gpio" , .data = imx53_gpio_add_irq_domain, }, {/* sentinel */ } };
drivers/gpio/Kconfig +1 -0
@@ -128,6 +128,7 @@ config GPIO_MXC depends on ARCH_MXC select GPIO_GENERIC select GENERIC_IRQ_CHIP + select IRQ_DOMAIN config GPIO_MXS def_bool y
drivers/gpio/gpio-mxc.c +31 -26
149 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 6/6 arm/imx: remove macro MXC_GPIO_IRQ_START
In reply to Shawn GuoNow, macro MXC_GPIO_IRQ_START is referenced nowhere, so remove it.
--- arch/arm/plat-mxc/include/mach/irqs.h | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/include/mach/irqs.h +0 -2
@@ -28,8 +28,6 @@#define MXC_INTERNAL_IRQS 64#endif -#define MXC_GPIO_IRQ_START MXC_INTERNAL_IRQS -/* * The next 16 interrupts are for board specific purposes. Since * the kernel can only run on one machine at a time, we can re-use
Signature · 1 line
1.7.4.1
PATCH 2/2 gpio/tegra: Dynamically allocate IRQ base, and support DT
In reply to Shawn GuoEnhance the driver to dynamically allocate the base IRQ number, and create an IRQ domain for itself. The use of an IRQ domain ensures that any device tree node interrupts properties are correctly parsed.
Fix the DT binding documentation to describe interrupt-related properties, and the contents of "child" node interrupts property.
Update tegra20.dtsi to specify the required interrupt-related properties.
Finally, remove the definition of TEGRA_GPIO_TO_IRQ; this macro no longer gives correct results since the IRQ numbers for GPIOs are dynamically allocated.
--- .../devicetree/bindings/gpio/gpio_nvidia.txt | 10 ++++++ arch/arm/boot/dts/tegra20.dtsi | 2 + arch/arm/mach-tegra/include/mach/gpio-tegra.h | 2 - drivers/gpio/gpio-tegra.c | 32 +++++++++++++++---- 4 files changed, 37 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/gpio/gpio_nvidia.txt +10 -0
@@ -6,3 +6,13 @@ Required properties: second cell is used to specify optional parameters: - bit 0 specifies polarity (0 for normal, 1 for inverted) - gpio-controller : Marks the device node as a GPIO controller. +- #interrupt-cells : Should be 2. + The first cell is the GPIO number. + The second cell is used to specify flags: + bits[3:0] trigger type and level flags: + 1 = low-to-high edge triggered. + 2 = high-to-low edge triggered. + 4 = active high level-sensitive. + 8 = active low level-sensitive. + Valid combinations are 1, 2, 3, 4, 8. +- interrupt-controller : Marks the device node as an interrupt controller.
arch/arm/boot/dts/tegra20.dtsi +2 -0
@@ -79,6 +79,8 @@ 0 55 0x04 0 87 0x04 0 89 0x04 >; + interrupt-controller; + #interrupt-cells = <2>; #gpio-cells = <2>; gpio-controller; };
arch/arm/mach-tegra/include/mach/gpio-tegra.h +0 -2
@@ -25,8 +25,6 @@#define TEGRA_NR_GPIOS INT_GPIO_NR -#define TEGRA_GPIO_TO_IRQ (gpio) (INT_GPIO_BASE + (gpio)) -struct tegra_gpio_table {int gpio;/* GPIO number */ bool enable;/* Enable for GPIO at init? */
drivers/gpio/gpio-tegra.c +25 -7
@@ -25,6 +25,7 @@#include <linux/of.h> #include <linux/platform_device.h> #include <linux/module.h> +#include <linux/irqdomain.h> #include <asm/mach/irq.h>
@@ -74,7 +75,8 @@ struct tegra_gpio_bank {#endif }; - +static struct irq_domain irq_domain; +static struct irq_domain_ops irq_domain_ops;static void __iomem *regs;static struct tegra_gpio_bank tegra_gpio_banks[7 ];
@@ -139,7 +141,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,static int tegra_gpio_to_irq (struct gpio_chip *chip,unsigned offset) { -return TEGRA_GPIO_TO_IRQ (offset); +return irq_domain_to_irq (&irq_domain, offset); }static struct gpio_chip tegra_gpio_chip = {
@@ -155,28 +157,28 @@ static struct gpio_chip tegra_gpio_chip = {static void tegra_gpio_irq_ack (struct irq_data *d) { -int gpio = d->irq -INT_GPIO_BASE ; +int gpio = d->hwirq;tegra_gpio_writel (1 <<GPIO_BIT (gpio),GPIO_INT_CLR (gpio)); }static void tegra_gpio_irq_mask (struct irq_data *d) { -int gpio = d->irq -INT_GPIO_BASE ; +int gpio = d->hwirq;tegra_gpio_mask_write (GPIO_MSK_INT_ENB (gpio), gpio,0 ); }static void tegra_gpio_irq_unmask (struct irq_data *d) { -int gpio = d->irq -INT_GPIO_BASE ; +int gpio = d->hwirq;tegra_gpio_mask_write (GPIO_MSK_INT_ENB (gpio), gpio,1 ); }static int tegra_gpio_irq_set_type (struct irq_data *d,unsigned int type) { -int gpio = d->irq -INT_GPIO_BASE ; +int gpio = d->hwirq;struct tegra_gpio_bank *bank =irq_data_get_irq_chip_data (d);int port =GPIO_PORT (gpio);int lvl_type;
@@ -343,6 +345,22 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)int i;int j; + irq_domain.irq_base =irq_alloc_descs (-1 ,0 ,TEGRA_NR_GPIOS ,0 ); +if (irq_domain.irq_base <0 ) { +dev_err (&pdev->dev,"Couldn't allocate IRQ numbers\n" ); +return -ENODEV ; + } + irq_domain.nr_irq =TEGRA_NR_GPIOS ; + irq_domain.ops = &irq_domain_ops; +#ifdef CONFIG_OF +if (pdev->dev.of_node) { + irq_domain.of_node = pdev->dev.of_node; + irq_domain_ops.dt_translate = + irq_domain_simple_ops.dt_translate; + } +#endif +irq_domain_add (&irq_domain); +for (i =0 ; i <ARRAY_SIZE (tegra_gpio_banks); i++) { res =platform_get_resource (pdev,IORESOURCE_IRQ , i);if (!res) {
@@ -388,7 +406,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)gpiochip_add (&tegra_gpio_chip);for (gpio =0 ; gpio <TEGRA_NR_GPIOS ; gpio++) { -int irq =TEGRA_GPIO_TO_IRQ (gpio); +int irq =irq_domain_to_irq (&irq_domain, gpio);/* No validity check; all Tegra GPIOs are valid IRQs */ bank = &tegra_gpio_banks[GPIO_BANK (gpio)];
Signature · 1 line
1.7.0.4
PATCH 2/2 gpio/tegra: Dynamically allocate IRQ base, and support DT
Sorry, this one should not be in the series. Please ignore.
Regards,
Shawn
Quoted 20 lines · Shawn Guo
Enhance the driver to dynamically allocate the base IRQ number, and create an IRQ domain for itself. The use of an IRQ domain ensures that any device tree node interrupts properties are correctly parsed.
Fix the DT binding documentation to describe interrupt-related properties, and the contents of "child" node interrupts property.
Update
tegra20.dtsito specify the required interrupt-related properties.Finally, remove the definition of
TEGRA_GPIO_TO_IRQ; this macro no longer gives correct results since the IRQ numbers for GPIOs are dynamically allocated.Signed-off-by Stephen Warren <[email protected]>--- .../devicetree/bindings/gpio/gpio_nvidia.txt | 10 ++++++ arch/arm/boot/dts/tegra20.dtsi | 2 + arch/arm/mach-tegra/include/mach/gpio-tegra.h | 2 - drivers/gpio/gpio-tegra.c | 32 +++++++++++++++---- 4 files changed, 37 insertions(+), 9 deletions(-)
Sascha Hauer
maintainercover arm/imx: kill macro MXC_GPIO_IRQ_START
In reply to Shawn GuoQuoted 17 lines · Shawn Guo
Hi Arnd, Sascha,
The imx gpio interrupt controller is currently broken for DT users. I have sent the following two patches to fix them.
- arm/imx: fix return type of callback passed to
of_irq_init()
http://www.spinics.net/lists/arm-kernel/msg149891.html- arm/imx: fix
irq_basefor gpio
http://www.spinics.net/lists/arm-kernel/msg149892.htmlInspired by the patches/discussion from Stephen Warren and Rob Herring, I decided to send this series to fix the problem in a cleaner way, which will kill the macro
MXC_GPIO_IRQ_STARTand let the gpio and irq numbers be dynamically allocated for both DT and non-DT users, rather than the statically defining currently used in non-DT case.
Quoted 5 lines
Please let me know if you would send the series through -rc. If you do, that's great. If you do not, that's fine, since it touches many files and looks more like a cleanup work, and I will send your the above quick/temporary fixing for -rc, and then rebase this series on top of it and send for v3.3.
As you touch many boards which you can't test I don't think this stuff is suitable for -rc. Otherwise I'm fine with this series.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
cover arm/imx: kill macro MXC_GPIO_IRQ_START
Quoted 10 lines · Sascha Hauer
Quoted 6 lines
Please let me know if you would send the series through -rc. If you do, that's great. If you do not, that's fine, since it touches many files and looks more like a cleanup work, and I will send your the above quick/temporary fixing for -rc, and then rebase this series on top of it and send for v3.3.
As you touch many boards which you can't test I don't think this stuff is suitable for -rc. Otherwise I'm fine with this series.
Agreed. It seems fine to go into next but I wouldn't send this as bug fixes for 3.2.
Arnd