Skip to contentSkip to conversation

ARM: dts: imx6: adjust the interrupt list in order to support MSI

PATCH New Lucas Stach 3 participants 6 messages Feb 26, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ARM: dts: imx6: adjust the interrupt list in order to support MSI

From: Juergen Beisert <[email protected]>

---
 arch/arm/boot/dts/imx6qdl.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl.dtsi +2 -1
index fb28b2ecb1db..aeccbb114fc5 100644
@@ -126,7 +126,8 @@
 				  0x81000000 0 0          0x01f80000 0 0x00010000 /* downstream I/O */
 				  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
 			num-lanes = <1>;
-			interrupts = <0 123 0x04>;
+			/*               inta          intb         intc         intd/msi */
+			interrupts = <0 123 0x04>, <0 122 0x04>, <0 121 0x04>, <0 120 0x04>;
 			clocks = <&clks 189>, <&clks 187>, <&clks 206>, <&clks 144>;
 			clock-names = "pcie_ref_125m", "sata_ref_100m", "lvds_gate", "pcie_axi";
 			status = "disabled";
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH v2 2/2 PCI: imx6: add support for MSI

From: Juergen Beisert <[email protected]>

This patch adds support for Message Signaled Interrupt in the imx6q-pcie driver. It is done in a similar way as for the Exynos PCIe driver (commit f342d940ee0e3a2b5197fd4fbade1cb6bbc960b7), which is also using the Synopsys designware PCIe IP core.

---
v2: fix typo MCI->MSI

---
 drivers/pci/host/pci-imx6.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/pci/host/pci-imx6.c +29 -0
index ee082509b0ba..344a72184307 100644
@@ -25,6 +25,7 @@
 #include <linux/resource.h>
 #include <linux/signal.h>
 #include <linux/types.h>
+#include <linux/interrupt.h>
 
 #include "pcie-designware.h"
 
@@ -329,6 +330,17 @@ static int imx6_pcie_wait_for_link(struct pcie_port *pp)
 	return 0;
 }
 
+/* legacy IRQD/MSI interrupt */
+static irqreturn_t imx6_pcie_irqd_msi_handler(int irq, void *arg)
+{
+	struct pcie_port *pp = arg;
+
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		dw_handle_msi_irq(pp);
+
+	return IRQ_HANDLED;
+}
+
 static int imx6_pcie_start_link(struct pcie_port *pp)
 {
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
@@ -403,6 +415,9 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
 	dw_pcie_setup_rc(pp);
 
 	imx6_pcie_start_link(pp);
+
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		dw_pcie_msi_init(pp);
 }
 
 static void imx6_pcie_reset_phy(struct pcie_port *pp)
@@ -498,6 +513,20 @@ static int imx6_add_pcie_port(struct pcie_port *pp,
 		return -ENODEV;
 	}
 
+	if (IS_ENABLED(CONFIG_PCI_MSI)) {
+		pp->msi_irq = platform_get_irq(pdev, 3);
+		if (!pp->msi_irq) {
+			dev_err(&pdev->dev, "failed to get INTD/MSI\n");
+			return -ENODEV;
+		}
+
+		ret = devm_request_irq(&pdev->dev, pp->msi_irq,
+					imx6_pcie_irqd_msi_handler,
+					IRQF_SHARED, "mx6-pcie-msi", pp);
+		if (ret)
+			dev_err(&pdev->dev, "failed to request INTD/MSI irq\n");
+	}
+
 	pp->root_bus_nr = -1;
 	pp->ops = &imx6_pcie_host_ops;
 
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH v2 2/2 PCI: imx6: add support for MSI

Quoted 57 lines · Lucas Stach

From: Juergen Beisert <[email protected]>

This patch adds support for Message Signaled Interrupt in the imx6q-pcie driver. It is done in a similar way as for the Exynos PCIe driver (commit f342d940ee0e3a2b5197fd4fbade1cb6bbc960b7), which is also using the Synopsys designware PCIe IP core.

---
v2: fix typo MCI->MSI

---
 drivers/pci/host/pci-imx6.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/pci/host/pci-imx6.c +15 -0
index ee082509b0ba..344a72184307 100644
@@ -25,6 +25,7 @@
 #include <linux/resource.h>
 #include <linux/signal.h>
 #include <linux/types.h>
+#include <linux/interrupt.h>
 
 #include "pcie-designware.h"
 
@@ -329,6 +330,17 @@ static int imx6_pcie_wait_for_link(struct pcie_port *pp)
 	return 0;
 }
 
+/* legacy IRQD/MSI interrupt */
+static irqreturn_t imx6_pcie_irqd_msi_handler(int irq, void *arg)
+{
+	struct pcie_port *pp = arg;
+
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		dw_handle_msi_irq(pp);
+
+	return IRQ_HANDLED;
+}
+
 static int imx6_pcie_start_link(struct pcie_port *pp)
 {
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
@@ -403,6 +415,9 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
 	dw_pcie_setup_rc(pp);
 
 	imx6_pcie_start_link(pp);
+
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		dw_pcie_msi_init(pp);
 }
 
 static void imx6_pcie_reset_phy(struct pcie_port *pp)

drivers/pci/host/pci-imx6.c static int imx6_add_pcie_port(struct pcie_port *pp, · line 521

Quoted 9 lines
drivers/pci/host/pci-imx6.c +6 -0
@@ -498,6 +513,20 @@ static int imx6_add_pcie_port(struct pcie_port *pp,
 		return -ENODEV;
 	}
 
+	if (IS_ENABLED(CONFIG_PCI_MSI)) {
+		pp->msi_irq = platform_get_irq(pdev, 3);
+		if (!pp->msi_irq) {
+			dev_err(&pdev->dev, "failed to get INTD/MSI\n");
+			return -ENODEV;
+		}

Doesn't this break existing DTBs?

Cheers,
Mark.

#3 lore raw

PATCH v2 1/2 ARM: dts: imx6: adjust the interrupt list in order to support MSI

In reply to Lucas Stach
Quoted 13 lines · Lucas Stach

From: Juergen Beisert <[email protected]>

---
 arch/arm/boot/dts/imx6qdl.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl.dtsi +0 -0
index fb28b2ecb1db..aeccbb114fc5 100644

arch/arm/boot/dts/imx6qdl.dtsi line 129

Quoted 5 lines
arch/arm/boot/dts/imx6qdl.dtsi +1 -1
@@ -126,7 +126,8 @@
 				  0x81000000 0 0          0x01f80000 0 0x00010000 /* downstream I/O */
 				  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
 			num-lanes = <1>;
-			interrupts = <0 123 0x04>;
+			/*               inta          intb         intc         intd/msi */

What about replacing the comment with an 'interrupt-names' property?

Shawn

Quoted 7 lines
arch/arm/boot/dts/imx6qdl.dtsi +1 -0
+			interrupts = <0 123 0x04>, <0 122 0x04>, <0 121 0x04>, <0 120 0x04>;
 			clocks = <&clks 189>, <&clks 187>, <&clks 206>, <&clks 144>;
 			clock-names = "pcie_ref_125m", "sata_ref_100m", "lvds_gate", "pcie_axi";
 			status = "disabled";
Signature · 1 line
1.8.5.3
#4 lore raw

PATCH v2 1/2 ARM: dts: imx6: adjust the interrupt list in order to support MSI

In reply to Lucas Stach
Quoted 13 lines · Lucas Stach

From: Juergen Beisert <[email protected]>

---
 arch/arm/boot/dts/imx6qdl.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl.dtsi +0 -0
index fb28b2ecb1db..aeccbb114fc5 100644

arch/arm/boot/dts/imx6qdl.dtsi line 130

Quoted 6 lines
arch/arm/boot/dts/imx6qdl.dtsi +2 -1
@@ -126,7 +126,8 @@
 				  0x81000000 0 0          0x01f80000 0 0x00010000 /* downstream I/O */
 				  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
 			num-lanes = <1>;
-			interrupts = <0 123 0x04>;
+			/*               inta          intb         intc         intd/msi */
+			interrupts = <0 123 0x04>, <0 122 0x04>, <0 121 0x04>, <0 120 0x04>;

This seems to be a "fsl,imx6q-pcie", "snps,dw-pcie" device.

In Documentation/devicetree/bindings/pci/designware-pcie.txt I only see 3 interrupts listed.

The fourth interrupt must be documented.

Do the first three correspond to those in the documentation?

Cheers,
Mark.

#5 lore raw

PATCH v2 1/2 ARM: dts: imx6: adjust the interrupt list in order to support MSI

Am Mittwoch, den 26.02.2014, 16:34 +0000 schrieb Mark Rutland:

Quoted 23 lines · Lucas Stach
Quoted 13 lines

From: Juergen Beisert <[email protected]>

---
 arch/arm/boot/dts/imx6qdl.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl.dtsi +0 -0
index fb28b2ecb1db..aeccbb114fc5 100644

arch/arm/boot/dts/imx6qdl.dtsi line 130

Quoted 6 lines
arch/arm/boot/dts/imx6qdl.dtsi +2 -1
@@ -126,7 +126,8 @@
 				  0x81000000 0 0          0x01f80000 0 0x00010000 /* downstream I/O */
 				  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
 			num-lanes = <1>;
-			interrupts = <0 123 0x04>;
+			/*               inta          intb         intc         intd/msi */
+			interrupts = <0 123 0x04>, <0 122 0x04>, <0 121 0x04>, <0 120 0x04>;

This seems to be a "fsl,imx6q-pcie", "snps,dw-pcie" device.

Quoted 7 lines

In Documentation/devicetree/bindings/pci/designware-pcie.txt I only see 3 interrupts listed.

The fourth interrupt must be documented.

Do the first three correspond to those in the documentation?

Urgh, seems Samsung and FSL do all the glue a lot different. The IRQs seem to be different and the same holds true for the clocks.

I think we should split the Documentation here to avoid further confusion. Will send a patch.

Regards,
Lucas

Signature · 4 lines
Pengutronix e.K.                           | Lucas Stach                 |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |