aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/irq-gic.c
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2015-10-13 07:51:33 -0400
committerThomas Gleixner <tglx@linutronix.de>2015-10-13 13:01:23 -0400
commitf833f57ff25450b7161798dceaf8575a48d80249 (patch)
treed1d8af957f01065cbfbf76c5f4975a0e90d013fb /drivers/irqchip/irq-gic.c
parent11e4438ee330fab0f216ee7cc1b651cb2ddceb5d (diff)
irqchip: Convert all alloc/xlate users from of_node to fwnode
Since we now have a generic data structure to express an interrupt specifier, convert all hierarchical irqchips that are OF based to use a fwnode_handle as part of their alloc and xlate (which becomes translate) callbacks. As most of these drivers have dependencies (they exchange IRQ specifiers), change them all in a single, massive patch... Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-and-tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: <linux-arm-kernel@lists.infradead.org> Cc: Tomasz Nowicki <tomasz.nowicki@linaro.org> Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Cc: Graeme Gregory <graeme@xora.org.uk> Cc: Jake Oshins <jakeo@microsoft.com> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Link: http://lkml.kernel.org/r/1444737105-31573-6-git-send-email-marc.zyngier@arm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/irqchip/irq-gic.c')
-rw-r--r--drivers/irqchip/irq-gic.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index abdccfb9ad22..9262bb9b442b 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -940,6 +940,32 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
940 return ret; 940 return ret;
941} 941}
942 942
943static int gic_irq_domain_translate(struct irq_domain *d,
944 struct irq_fwspec *fwspec,
945 unsigned long *hwirq,
946 unsigned int *type)
947{
948 if (is_of_node(fwspec->fwnode)) {
949 if (fwspec->param_count < 3)
950 return -EINVAL;
951
952 /* Get the interrupt number and add 16 to skip over SGIs */
953 *hwirq = fwspec->param[1] + 16;
954
955 /*
956 * For SPIs, we need to add 16 more to get the GIC irq
957 * ID number
958 */
959 if (!fwspec->param[0])
960 *hwirq += 16;
961
962 *type = fwspec->param[2] & IRQ_TYPE_SENSE_MASK;
963 return 0;
964 }
965
966 return -EINVAL;
967}
968
943#ifdef CONFIG_SMP 969#ifdef CONFIG_SMP
944static int gic_secondary_init(struct notifier_block *nfb, unsigned long action, 970static int gic_secondary_init(struct notifier_block *nfb, unsigned long action,
945 void *hcpu) 971 void *hcpu)
@@ -965,10 +991,9 @@ static int gic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
965 int i, ret; 991 int i, ret;
966 irq_hw_number_t hwirq; 992 irq_hw_number_t hwirq;
967 unsigned int type = IRQ_TYPE_NONE; 993 unsigned int type = IRQ_TYPE_NONE;
968 struct of_phandle_args *irq_data = arg; 994 struct irq_fwspec *fwspec = arg;
969 995
970 ret = gic_irq_domain_xlate(domain, irq_data->np, irq_data->args, 996 ret = gic_irq_domain_translate(domain, fwspec, &hwirq, &type);
971 irq_data->args_count, &hwirq, &type);
972 if (ret) 997 if (ret)
973 return ret; 998 return ret;
974 999
@@ -979,7 +1004,7 @@ static int gic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
979} 1004}
980 1005
981static const struct irq_domain_ops gic_irq_domain_hierarchy_ops = { 1006static const struct irq_domain_ops gic_irq_domain_hierarchy_ops = {
982 .xlate = gic_irq_domain_xlate, 1007 .translate = gic_irq_domain_translate,
983 .alloc = gic_irq_domain_alloc, 1008 .alloc = gic_irq_domain_alloc,
984 .free = irq_domain_free_irqs_top, 1009 .free = irq_domain_free_irqs_top,
985}; 1010};