irqdomain: Initialize number of IRQs for simple domains
Subsystems (10)
PATCH v2 1/1 irqdomain: Initialize number of IRQs for simple domains
The irq_domain_add() function needs the number of interrupts in the domain to properly initialize them. In addition the allocated domain is now returned by the irq_domain_{add,generate}_simple() helpers.
---
Note: This patch should not be applied yet. There is a conflict with a
pending patch[0] by Benoit Cousson that will obsolete the OMAP2 hunk in this patch.
[0]: http://www.spinics.net/lists/linux-omap/msg62124.html
Changes in v2:
- Don't use ERR_PTR, keep the WARN_ON(1) and return NULL as requested by Grant Likely.
- Integrate i.MX cleanup patch by Shawn Guo.
arch/arm/mach-at91/board-dt.c | 2 +- arch/arm/mach-imx/imx51-dt.c | 13 +++++++++++-- arch/arm/mach-imx/imx53-dt.c | 13 +++++++++++-- arch/arm/mach-imx/mach-imx6q.c | 6 +++++- arch/arm/mach-msm/board-msm8x60.c | 2 +- arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-prima2/irq.c | 2 +- arch/arm/mach-versatile/core.c | 6 ++++-- arch/arm/plat-mxc/include/mach/irqs.h | 13 +++++++------ arch/arm/plat-mxc/tzic.c | 2 -- include/linux/irqdomain.h | 27 ++++++++++++++++++++++----- kernel/irq/irqdomain.c | 26 ++++++++++++++++++-------- 12 files changed, 82 insertions(+), 32 deletions(-)
arch/arm/mach-at91/board-dt.c +1 -1
@@ -95,7 +95,7 @@ static const struct of_device_id aic_of_match[] __initconst = {static void __init at91_dt_init_irq (void ) { -irq_domain_generate_simple (aic_of_match,0xfffff000 ,0 ); +irq_domain_generate_simple (aic_of_match,0xfffff000 ,0 ,NR_AIC_IRQS );at91_init_irq_default (); }
arch/arm/mach-imx/imx51-dt.c +11 -2
@@ -47,7 +47,12 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {static int __init imx51_tzic_add_irq_domain (struct device_node *np,struct device_node *interrupt_parent) { -irq_domain_add_simple (np,0 ); +struct irq_domain *domain; + + domain =irq_domain_add_simple (np,0 ,TZIC_NUM_IRQS ); +if (!domain) +return -ENOMEM ; +return 0 ; }
@@ -55,9 +60,13 @@ static int __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 ; +struct irq_domain *domain; gpio_irq_base -=32 ; -irq_domain_add_simple (np, gpio_irq_base); + + domain =irq_domain_add_simple (np, gpio_irq_base,32 ); +if (!domain) +return -ENOMEM ;return 0 ; }
arch/arm/mach-imx/imx53-dt.c +11 -2
@@ -51,7 +51,12 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = {static int __init imx53_tzic_add_irq_domain (struct device_node *np,struct device_node *interrupt_parent) { -irq_domain_add_simple (np,0 ); +struct irq_domain *domain; + + domain =irq_domain_add_simple (np,0 ,TZIC_NUM_IRQS ); +if (!domain) +return -ENOMEM ; +return 0 ; }
@@ -59,9 +64,13 @@ static int __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 ; +struct irq_domain *domain; gpio_irq_base -=32 ; -irq_domain_add_simple (np, gpio_irq_base); + + domain =irq_domain_add_simple (np, gpio_irq_base,32 ); +if (!domain) +return -ENOMEM ;return 0 ; }
arch/arm/mach-imx/mach-imx6q.c +5 -1
@@ -95,9 +95,13 @@ static int __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 ; +struct irq_domain *domain; gpio_irq_base -=32 ; -irq_domain_add_simple (np, gpio_irq_base); + + domain =irq_domain_add_simple (np, gpio_irq_base,32 ); +if (!domain) +return -ENOMEM ;return 0 ; }
arch/arm/mach-msm/board-msm8x60.c +1 -1
@@ -85,7 +85,7 @@ static void __init msm8x60_dt_init(void) node =of_find_matching_node_by_address (NULL , msm_dt_gic_match,MSM8X60_QGIC_DIST_PHYS );if (node) -irq_domain_add_simple (node,GIC_SPI_START ); +irq_domain_add_simple (node,GIC_SPI_START ,NR_MSM_IRQS );if (of_machine_is_compatible ("qcom,msm8660-surf" )) {printk (KERN_INFO "Init surf UART registers\n" );
arch/arm/mach-omap2/board-generic.c +1 -1
@@ -67,7 +67,7 @@ static void __init omap_generic_init(void) {struct device_node *node =of_find_matching_node (NULL , intc_match);if (node) -irq_domain_add_simple (node,0 ); +irq_domain_add_simple (node,0 ,INTCPS_NR_IRQS );omap_sdrc_init (NULL ,NULL );
arch/arm/mach-prima2/irq.c +1 -1
@@ -68,7 +68,7 @@ void __init sirfsoc_of_irq_init(void)if (!sirfsoc_intc_base)panic ("unable to map intc cpu registers\n" ); -irq_domain_add_simple (np,0 ); +irq_domain_add_simple (np,0 ,NR_IRQS );of_node_put (np);
arch/arm/mach-versatile/core.c +4 -2
@@ -99,12 +99,14 @@ static const struct of_device_id sic_of_match[] __initconst = {void __init versatile_init_irq (void ) {vic_init (VA_VIC_BASE ,IRQ_VIC_START , ~0 ,0 ); -irq_domain_generate_simple (vic_of_match,VERSATILE_VIC_BASE ,IRQ_VIC_START ); +irq_domain_generate_simple (vic_of_match,VERSATILE_VIC_BASE , +IRQ_VIC_START ,IRQ_VIC_END -IRQ_VIC_START +1 );writel (~0 ,VA_SIC_BASE +SIC_IRQ_ENABLE_CLEAR );fpga_irq_init (IRQ_VICSOURCE31 , ~PIC_MASK , &sic_irq); -irq_domain_generate_simple (sic_of_match,VERSATILE_SIC_BASE ,IRQ_SIC_START ); +irq_domain_generate_simple (sic_of_match,VERSATILE_SIC_BASE , +IRQ_SIC_START ,IRQ_SIC_END -IRQ_SIC_START +1 );/* * Interrupts on secondary controller from 0 to 8 are routed to
arch/arm/plat-mxc/include/mach/irqs.h +7 -6
@@ -13,19 +13,20 @@#include <asm-generic/gpio.h> +#define GIC_NUM_IRQS 160 +#define TZIC_NUM_IRQS 128 +#define AVIC_NUM_IRQS 64 +/* -* SoCs with GIC interrupt controller have 160 IRQs, those with TZIC -* have 128 IRQs, and those with AVIC have 64. -* * To support single image, the biggest number should be defined on * top of the list. */ #if definedCONFIG_ARM_GIC -#define MXC_INTERNAL_IRQS 160 +#define MXC_INTERNAL_IRQS GIC_NUM_IRQS#elif definedCONFIG_MXC_TZIC -#define MXC_INTERNAL_IRQS 128 +#define MXC_INTERNAL_IRQS TZIC_NUM_IRQS#else -#define MXC_INTERNAL_IRQS 64 +#define MXC_INTERNAL_IRQS AVIC_NUM_IRQS#endif #define MXC_GPIO_IRQ_START MXC_INTERNAL_IRQS
arch/arm/plat-mxc/tzic.c +0 -2
@@ -50,8 +50,6 @@void __iomem *tzic_base;/* Used as irq controller base in entry-macro.S */ -#define TZIC_NUM_IRQS 128 -#ifdef CONFIG_FIQ static int tzic_set_irq_fiq (unsigned int irq,unsigned int type) {
include/linux/irqdomain.h +22 -5
@@ -15,6 +15,7 @@#ifndef _LINUX_IRQDOMAIN_H#define _LINUX_IRQDOMAIN_H +#include <linux/err.h> #include <linux/irq.h> #include <linux/mod_devicetable.h>
@@ -96,12 +97,28 @@ extern struct irq_domain_ops irq_domain_simple_ops;#endif /* CONFIG_IRQ_DOMAIN */ #if defined(CONFIG_IRQ_DOMAIN ) && defined(CONFIG_OF_IRQ ) -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); +extern struct irq_domain *irq_domain_add_simple (struct device_node *controller, +unsigned int irq_base, +unsigned int nr_irq); +extern struct irq_domain *irq_domain_generate_simple (const struct of_device_id *match, +u64 phys_base, +unsigned int irq_start, +unsigned int nr_irq);#else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ -static inline void irq_domain_generate_simple (const struct of_device_id *match, -u64 phys_base,unsigned int irq_start) { } +static inline struct irq_domain *irq_domain_add_simple (struct device_node *controller, +int irq_base, +unsigned int nr_irq) +{ +return NULL ; +} + +static inline struct irq_domain *irq_domain_generate_simple (const struct of_device_id *match, +u64 phys_base, +unsigned int irq_start, +unsigned int nr_irq) +{ +return NULL ; +}#endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ #endif /* _LINUX_IRQDOMAIN_H */
kernel/irq/irqdomain.c +18 -8
@@ -147,36 +147,46 @@ int irq_domain_simple_dt_translate(struct irq_domain *d, }/** -* irq_domain_create_simple() - Set up a 'simple' translation range +* irq_domain_add_simple() - Set up a 'simple' translation range */ -void irq_domain_add_simple (struct device_node *controller,int irq_base) +struct irq_domain *irq_domain_add_simple (struct device_node *controller, +unsigned int irq_base, +unsigned int nr_irq) {struct irq_domain *domain; domain =kzalloc (sizeof (*domain),GFP_KERNEL );if (!domain) {WARN_ON (1 ); -return ; +return NULL ; } domain->irq_base = irq_base; + domain->nr_irq = nr_irq; domain->of_node =of_node_get (controller); domain->ops = &irq_domain_simple_ops;irq_domain_add (domain); + +return domain; }EXPORT_SYMBOL_GPL (irq_domain_add_simple); -void irq_domain_generate_simple (const struct of_device_id *match, -u64 phys_base,unsigned int irq_start) +struct irq_domain *irq_domain_generate_simple (const struct of_device_id *match, +u64 phys_base, +unsigned int irq_start, +unsigned int nr_irq) { +struct irq_domain *domain =NULL ;struct device_node *node; -pr_info ("looking for phys_base=%llx, irq_start=%i\n" , - (unsigned long long ) phys_base, (int ) irq_start); +pr_info ("looking for phys_base=%llx, irq_start=%u, nr_irq=%u\n" , + (unsigned long long ) phys_base, irq_start, nr_irq); node =of_find_matching_node_by_address (NULL , match, phys_base);if (node) -irq_domain_add_simple (node, irq_start); + domain =irq_domain_add_simple (node, irq_start, nr_irq);else pr_info ("no node found\n" ); + +return domain; }EXPORT_SYMBOL_GPL (irq_domain_generate_simple);#endif /* CONFIG_OF_IRQ */
Signature · 1 line
1.7.8.3
PATCH v2 1/1 irqdomain: Initialize number of IRQs for simple domains
Hi Thierry,
Quoted 7 lines · Thierry Reding
The
irq_domain_add()function needs the number of interrupts in the domain to properly initialize them. In addition the allocated domain is now returned by the irq_domain_{add,generate}_simple() helpers.Signed-off-by Thierry Reding <[email protected]>Acked-by Nicolas Ferre <[email protected]>Acked-by David Brown <[email protected]>
Quoted 6 lines
---
Note: This patch should not be applied yet. There is a conflict with a
pending patch[0] by Benoit Cousson that will obsolete the OMAP2 hunk in this patch.
I also have a patch in Russell's tracker to remove one of the calls for versatile (for the VIC) that is no longer needed.
Quoted 7 lines
arch/arm/mach-imx/imx51-dt.c +0
-0@@ -47,7 +47,12 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {static int __init imx51_tzic_add_irq_domain (struct device_node *np,struct device_node *interrupt_parent)
arch/arm/mach-imx/imx51-dt.c static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { · line 57
Quoted 10 lines
arch/arm/mach-imx/imx51-dt.c +6
-1{ -irq_domain_add_simple (np,0 ); +struct irq_domain *domain; + + domain =irq_domain_add_simple (np,0 ,TZIC_NUM_IRQS ); +if (!domain) +return -ENOMEM ; +return 0 ; }
A real nit, but could this be written as:
return irq_domain_add_simple(np, 0, TZIC_NUM_IRQS) ? 0 : -ENOMEM;
to make it a little more concise (and the same for the others)? Not a big deal though, so either way:
Jamie
Quoted 15 lines · Jamie Iles
Hi Thierry,
Quoted 12 lines · Thierry Reding
The
irq_domain_add()function needs the number of interrupts in the domain to properly initialize them. In addition the allocated domain is now returned by the irq_domain_{add,generate}_simple() helpers.Signed-off-by Thierry Reding <[email protected]>Acked-by Nicolas Ferre <[email protected]>Acked-by David Brown <[email protected]>---
Note: This patch should not be applied yet. There is a conflict with a
pending patch[0] by Benoit Cousson that will obsolete the OMAP2 hunk in this patch.
Quoted 4 lines
Quoted 1 line
[0]: http://www.spinics.net/lists/linux-omap/msg62124.htmlI also have a patch in Russell's tracker to remove one of the calls for versatile (for the VIC) that is no longer needed.
Okay, I'll take a note. I guess it is okay for this patch to go in only after the conflicting patches have all been applied. I'm assuming that sooner or later those patches will land in linux-next and I can rebase this patch on top, right?
Quoted 20 lines
Quoted 7 lines
arch/arm/mach-imx/imx51-dt.c +0
-0@@ -47,7 +47,12 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {static int __init imx51_tzic_add_irq_domain (struct device_node *np,struct device_node *interrupt_parent)arch/arm/mach-imx/imx51-dt.c static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { · line 57
Quoted 10 lines
arch/arm/mach-imx/imx51-dt.c +6
-1{ -irq_domain_add_simple (np,0 ); +struct irq_domain *domain; + + domain =irq_domain_add_simple (np,0 ,TZIC_NUM_IRQS ); +if (!domain) +return -ENOMEM ; +return 0 ; }A real nit, but could this be written as:
Quoted 6 lines
return irq_domain_add_simple(np, 0, TZIC_NUM_IRQS) ? 0 : -ENOMEM;to make it a little more concise (and the same for the others)? Not a big deal though, so either way:
Reviewed-by Jamie Iles <[email protected]>
Yes, I can do that.
Thanks,
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120110/0f052ec4/attachment.sig>
Quoted 19 lines · Thierry Reding
The
irq_domain_add()function needs the number of interrupts in the domain to properly initialize them. In addition the allocated domain is now returned by the irq_domain_{add,generate}_simple() helpers.Signed-off-by Thierry Reding <[email protected]>Acked-by Nicolas Ferre <[email protected]>Acked-by David Brown <[email protected]>---
Note: This patch should not be applied yet. There is a conflict with a
pending patch[0] by Benoit Cousson that will obsolete the OMAP2 hunk in this patch.[0]: http://www.spinics.net/lists/linux-omap/msg62124.html
Changes in v2:
- Don't useERR_PTR, keep theWARN_ON(1)and return NULL as requested by Grant Likely.
- Integrate i.MX cleanup patch by Shawn Guo.
...
Quoted 3 lines
arch/arm/mach-imx/imx51-dt.c | 13 +++++++++++-- arch/arm/mach-imx/imx53-dt.c | 13 +++++++++++-- arch/arm/mach-imx/mach-imx6q.c | 6 +++++-
...
Quoted 2 lines
arch/arm/plat-mxc/include/mach/irqs.h | 13 +++++++------ arch/arm/plat-mxc/tzic.c | 2 --
Regards,
Shawn