Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1178768

[PATCH v3 08/15] platform: of: Assign MSI domain to platform device

From Marc Zyngier <marc.zyngier@arm.com>
Newsgroups linux.kernel
Subject [PATCH v3 08/15] platform: of: Assign MSI domain to platform device
Date 2015-07-07 19:20 +0200
Message-ID <pJEHi-8rS-27@gated-at.bofh.it> (permalink)
References <pJEHg-8rS-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


As for PCI, we're able to populate the msi_domain field at probe time,
provided that the device tree has an "msi-parent" property.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/of/irq.c          | 16 ++++++++++++++++
 drivers/of/platform.c     |  1 +
 include/linux/irqdomain.h |  1 +
 include/linux/of_irq.h    |  1 +
 4 files changed, 19 insertions(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 3cf7a01..64392a6 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -18,6 +18,7 @@
  * driver.
  */
 
+#include <linux/device.h>
 #include <linux/errno.h>
 #include <linux/list.h>
 #include <linux/module.h>
@@ -576,3 +577,18 @@ err:
 		kfree(desc);
 	}
 }
+
+void of_msi_configure(struct device *dev, struct device_node *np)
+{
+	struct device_node *msi_np;
+	struct irq_domain *d;
+
+	msi_np = of_parse_phandle(np, "msi-parent", 0);
+	if (!msi_np)
+		return;
+
+	d = irq_find_matching_host(msi_np, DOMAIN_BUS_PLATFORM_MSI);
+	if (!d)
+		d = irq_find_host(msi_np);
+	dev_set_msi_domain(dev, d);
+}
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index ddf8e42..8a002d6 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -184,6 +184,7 @@ static struct platform_device *of_platform_device_create_pdata(
 	dev->dev.bus = &platform_bus_type;
 	dev->dev.platform_data = platform_data;
 	of_dma_configure(&dev->dev, dev->dev.of_node);
+	of_msi_configure(&dev->dev, dev->dev.of_node);
 
 	if (of_device_add(dev) != 0) {
 		of_dma_deconfigure(&dev->dev);
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 25e9e66..b4a74f7 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -55,6 +55,7 @@ struct irq_data;
 enum irq_domain_bus_token {
 	DOMAIN_BUS_ANY		= 0,
 	DOMAIN_BUS_PCI_MSI,
+	DOMAIN_BUS_PLATFORM_MSI,
 };
 
 /**
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index d884929..4bcbd58 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -74,6 +74,7 @@ static inline int of_irq_to_resource_table(struct device_node *dev,
  */
 extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
 extern struct device_node *of_irq_find_parent(struct device_node *child);
+extern void of_msi_configure(struct device *dev, struct device_node *np);
 
 #else /* !CONFIG_OF */
 static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/15] Introducing per-device MSI domain Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 03/15] device core: Introduce per-device MSI domain pointer Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 02/15] PCI: MSI: Register irq domain with specific token Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 08/15] platform: of: Assign MSI domain to platform device Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 04/15] PCI/MSI: Add hooks to populate the msi_domain field Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 01/15] genirq: irqdomain: Allow irq domain aliasing Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 14/15] PCI/MSI: pci-xgene-msi: Get rid of struct msi_controller Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:20 +0200
  [PATCH v3 09/15] irqchip: gicv3-its: Split PCI/MSI code from the core ITS driver Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 11/15] irqchip: GICv2m: Get rid of struct msi_controller Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 13/15] irqchip: gicv3-its: Make the PCI/MSI code standalone Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 05/15] PCI/MSI: of: Add support for OF-provided msi_domain Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 07/15] PCI/MSI: Let pci_msi_get_domain use struct device's msi_domain Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 06/15] PCI/MSI: of: Allow msi_domain lookup using the host bridge node Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 10/15] irqchip: gicv3-its: Register irq domain with platform MSI token Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200
  [PATCH v3 12/15] irqchip: gicv3-its: Get rid of struct msi_controller Marc Zyngier <marc.zyngier@arm.com> - 2015-07-07 19:30 +0200

csiph-web