aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Nowicki <tn@semihalf.com>2016-09-12 14:32:26 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2016-09-12 15:32:43 -0400
commitdb744aaa279fa1d2a06dd6b95f9599acf3557885 (patch)
tree57020b5b81a3e39a0edd48ae00915416aee36c68
parent3f010cf197324b6c1e87f472e64b87c5f909735e (diff)
irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI
Firmware agnostic code lands in common functions which do necessary domain initialization based on unique domain handler. DT specific code goes to DT specific init call. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--drivers/irqchip/irq-gic-v3-its-pci-msi.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index aee60ed025dc..d2c2496d61e9 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -106,34 +106,48 @@ static struct of_device_id its_device_id[] = {
106 {}, 106 {},
107}; 107};
108 108
109static int __init its_pci_msi_init(void) 109static int __init its_pci_msi_init_one(struct fwnode_handle *handle,
110 const char *name)
110{ 111{
111 struct device_node *np;
112 struct irq_domain *parent; 112 struct irq_domain *parent;
113 113
114 parent = irq_find_matching_fwnode(handle, DOMAIN_BUS_NEXUS);
115 if (!parent || !msi_get_domain_info(parent)) {
116 pr_err("%s: Unable to locate ITS domain\n", name);
117 return -ENXIO;
118 }
119
120 if (!pci_msi_create_irq_domain(handle, &its_pci_msi_domain_info,
121 parent)) {
122 pr_err("%s: Unable to create PCI domain\n", name);
123 return -ENOMEM;
124 }
125
126 return 0;
127}
128
129static int __init its_pci_of_msi_init(void)
130{
131 struct device_node *np;
132
114 for (np = of_find_matching_node(NULL, its_device_id); np; 133 for (np = of_find_matching_node(NULL, its_device_id); np;
115 np = of_find_matching_node(np, its_device_id)) { 134 np = of_find_matching_node(np, its_device_id)) {
116 if (!of_property_read_bool(np, "msi-controller")) 135 if (!of_property_read_bool(np, "msi-controller"))
117 continue; 136 continue;
118 137
119 parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS); 138 if (its_pci_msi_init_one(of_node_to_fwnode(np), np->full_name))
120 if (!parent || !msi_get_domain_info(parent)) {
121 pr_err("%s: unable to locate ITS domain\n",
122 np->full_name);
123 continue; 139 continue;
124 }
125
126 if (!pci_msi_create_irq_domain(of_node_to_fwnode(np),
127 &its_pci_msi_domain_info,
128 parent)) {
129 pr_err("%s: unable to create PCI domain\n",
130 np->full_name);
131 continue;
132 }
133 140
134 pr_info("PCI/MSI: %s domain created\n", np->full_name); 141 pr_info("PCI/MSI: %s domain created\n", np->full_name);
135 } 142 }
136 143
137 return 0; 144 return 0;
138} 145}
146
147static int __init its_pci_msi_init(void)
148{
149 its_pci_of_msi_init();
150
151 return 0;
152}
139early_initcall(its_pci_msi_init); 153early_initcall(its_pci_msi_init);