linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/14] Add iMX PCIe EP mode support
@ 2022-09-23  6:06 Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 01/14] dt-bindings: imx6q-pcie: Add iMX8MM PCIe EP mode compatible string Richard Zhu
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

i.MX PCIe controller is one dual mode PCIe controller, and can work either
as RC or EP.
This series add the i.MX PCIe EP mode support. And had been verified on
i.MX8MQ EVK, i.MX8MM EVK and i.MX8MP EVK boards.
In the verification, one EVK board used as RC, the other one used as EP.
Use the cross TX/RX differential cable connect the two PCIe ports of these
two EVK boards.

+-----------+                +------------+
|   PCIe TX |<-------------->|PCIe RX     |
|           |                |            |
|EVK Board  |                |EVK Board   |
|           |                |            |
|   PCIe RX |<-------------->|PCIe TX     |
+-----------+                +------------+

Main changes from v2 -> v3:
- Add the i.MX8MP PCIe EP support, and verified on i.MX8MP EVK board.
- Rebase to latest pci/next branch(tag: v6.0-rc1 plus some PCIe changes).

Main changes from v1 -> v2:
- Add Rob's ACK into first two commits.
- Rebase to the tag: pci-v5.20-changes of the pci/next branch.

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml |   3 ++
arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi             |  14 ++++++
arch/arm64/boot/dts/freescale/imx8mm.dtsi                 |  20 +++++++++
arch/arm64/boot/dts/freescale/imx8mp-evk.dts              |  13 ++++++
arch/arm64/boot/dts/freescale/imx8mp.dtsi                 |  19 ++++++++
arch/arm64/boot/dts/freescale/imx8mq-evk.dts              |  12 ++++++
arch/arm64/boot/dts/freescale/imx8mq.dtsi                 |  27 ++++++++++++
drivers/misc/pci_endpoint_test.c                          |   2 +
drivers/pci/controller/dwc/Kconfig                        |  25 ++++++++++-
drivers/pci/controller/dwc/pci-imx6.c                     | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
10 files changed, 316 insertions(+), 19 deletions(-)

 [PATCH v3 01/14] dt-bindings: imx6q-pcie: Add iMX8MM PCIe EP mode
 [PATCH v3 02/14] dt-bindings: imx6q-pcie: Add iMX8MQ PCIe EP mode
 [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP PCIe EP mode
 [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support
 [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support
 [PATCH v3 06/14] arm64: dts: Add iMX8MM PCIe EP support on EVK board
 [PATCH v3 07/14] arm64: dts: Add iMX8MQ PCIe EP support
 [PATCH v3 08/14] arm64: dts: Add iMX8MQ PCIe EP support on EVK board
 [PATCH v3 09/14] arm64: dts: Add iMX8MP PCIe EP support
 [PATCH v3 10/14] arm64: dts: Add iMX8MP PCIe EP support on EVK board
 [PATCH v3 11/14] misc: pci_endpoint_test: Add iMX8 PCIe EP device
 [PATCH v3 12/14] PCI: imx6: Add iMX8MM PCIe EP mode
 [PATCH v3 13/14] PCI: imx6: Add iMX8MQ PCIe EP support
 [PATCH v3 14/14] PCI: imx6: Add iMX8MP PCIe EP support

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 01/14] dt-bindings: imx6q-pcie: Add iMX8MM PCIe EP mode compatible string
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 02/14] dt-bindings: imx6q-pcie: Add iMX8MQ " Richard Zhu
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add i.MX8MM PCIe endpoint mode compatible string.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
index 376e739bcad4..e4038e2b3de9 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
@@ -27,6 +27,7 @@ properties:
       - fsl,imx8mq-pcie
       - fsl,imx8mm-pcie
       - fsl,imx8mp-pcie
+      - fsl,imx8mm-pcie-ep
 
   reg:
     items:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 02/14] dt-bindings: imx6q-pcie: Add iMX8MQ PCIe EP mode compatible string
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 01/14] dt-bindings: imx6q-pcie: Add iMX8MM PCIe EP mode compatible string Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP " Richard Zhu
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add i.MX8MQ PCIe endpoint mode compatible string.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
index e4038e2b3de9..114e11b62195 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
@@ -28,6 +28,7 @@ properties:
       - fsl,imx8mm-pcie
       - fsl,imx8mp-pcie
       - fsl,imx8mm-pcie-ep
+      - fsl,imx8mq-pcie-ep
 
   reg:
     items:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP PCIe EP mode compatible string
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 01/14] dt-bindings: imx6q-pcie: Add iMX8MM PCIe EP mode compatible string Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 02/14] dt-bindings: imx6q-pcie: Add iMX8MQ " Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-26 22:53   ` Rob Herring
  2022-09-23  6:06 ` [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support Richard Zhu
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add i.MX8MP PCIe endpoint mode compatible string.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
index 114e11b62195..d79cbc55064a 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
@@ -29,6 +29,7 @@ properties:
       - fsl,imx8mp-pcie
       - fsl,imx8mm-pcie-ep
       - fsl,imx8mq-pcie-ep
+      - fsl,imx8mp-pcie-ep
 
   reg:
     items:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (2 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP " Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23 14:15   ` Bjorn Helgaas
  2022-09-23  6:06 ` [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support Richard Zhu
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Since i.MX PCIe is one dual mode PCIe controller.
Add i.MX PCIe EP mode support, and split the PCIe modes to the Root
Complex mode and Endpoint mode.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/pci/controller/dwc/Kconfig | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig
index 62ce3abf0f19..a24d8cacf1be 100644
--- a/drivers/pci/controller/dwc/Kconfig
+++ b/drivers/pci/controller/dwc/Kconfig
@@ -92,10 +92,33 @@ config PCI_EXYNOS
 	  functions to implement the driver.
 
 config PCI_IMX6
-	bool "Freescale i.MX6/7/8 PCIe controller"
+	bool
+
+config PCI_IMX6_HOST
+	bool "Freescale i.MX6/7/8 PCIe controller host mode"
 	depends on ARCH_MXC || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
+	select PCI_IMX6
+	help
+	  Enables support for the PCIe controller Root Complex mode in the
+	  iMX6/7/8 SoCs.
+	  This controller can work either as EP or RC. In order to enable
+	  host-specific features PCIE_DW_HOST must be selected and in order
+	  to enable device-specific features PCIE_DW_EP must be selected.
+
+config PCI_IMX6_EP
+	bool "Freescale i.MX6/7/8 PCIe controller endpoint mode"
+	depends on ARCH_MXC || COMPILE_TEST
+	depends on PCI_ENDPOINT
+	select PCIE_DW_EP
+	select PCI_IMX6
+	help
+	  Enables support for the PCIe controller endpoint mode in the
+	  iMX6/7/8 SoCs.
+	  This controller can work either as EP or RC. In order to enable
+	  host-specific features PCIE_DW_HOST must be selected and in order
+	  to enable device-specific features PCIE_DW_EP must be selected.
 
 config PCIE_SPEAR13XX
 	bool "STMicroelectronics SPEAr PCIe controller"
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (3 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23 14:02   ` Bjorn Helgaas
  2022-09-23  6:06 ` [PATCH v3 06/14] arm64: dts: Add iMX8MM PCIe EP support on EVK board Richard Zhu
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add iMX8MM PCIe EP support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mm.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
index afb90f59c83c..eca7a42ac52a 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
@@ -1291,6 +1291,26 @@ pcie0: pcie@33800000 {
 			status = "disabled";
 		};
 
+		pcie0_ep: pcie_ep@33800000 {
+			compatible = "fsl,imx8mm-pcie-ep";
+			reg = <0x33800000 0x400000>,
+			      <0x18000000 0x8000000>;
+			reg-names = "regs", "addr_space";
+			num-lanes = <1>;
+			interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "dma";
+			fsl,max-link-speed = <2>;
+			power-domains = <&pgc_pcie>;
+			resets = <&src IMX8MQ_RESET_PCIE_CTRL_APPS_EN>,
+				 <&src IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF>;
+			reset-names = "apps", "turnoff";
+			phys = <&pcie_phy>;
+			phy-names = "pcie-phy";
+			num-ib-windows = <4>;
+			num-ob-windows = <4>;
+			status = "disabled";
+		};
+
 		gpu_3d: gpu@38000000 {
 			compatible = "vivante,gc";
 			reg = <0x38000000 0x8000>;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 06/14] arm64: dts: Add iMX8MM PCIe EP support on EVK board
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (4 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 07/14] arm64: dts: Add iMX8MQ PCIe EP support Richard Zhu
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add iMX8MM PCIe EP support on EVK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
index 7d6317d95b13..d43eb2eb23bf 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
@@ -380,6 +380,20 @@ &sai2 {
 	status = "okay";
 };
 
+&pcie0_ep{
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_pcie0>;
+	clocks = <&clk IMX8MM_CLK_PCIE1_ROOT>, <&clk IMX8MM_CLK_PCIE1_AUX>,
+		 <&pcie0_refclk>;
+	clock-names = "pcie", "pcie_aux", "pcie_bus";
+	assigned-clocks = <&clk IMX8MM_CLK_PCIE1_AUX>,
+			  <&clk IMX8MM_CLK_PCIE1_CTRL>;
+	assigned-clock-rates = <10000000>, <250000000>;
+	assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_50M>,
+				 <&clk IMX8MM_SYS_PLL2_250M>;
+	status = "disabled";
+};
+
 &sai3 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_sai3>;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 07/14] arm64: dts: Add iMX8MQ PCIe EP support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (5 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 06/14] arm64: dts: Add iMX8MM PCIe EP support on EVK board Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 08/14] arm64: dts: Add iMX8MQ PCIe EP support on EVK board Richard Zhu
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add iMX8MQ PCIe EP support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mq.dtsi | 27 +++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
index e9f0cdd10ab6..1c94e798e02f 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
@@ -1581,6 +1581,33 @@ pcie1: pcie@33c00000 {
 			status = "disabled";
 		};
 
+		pcie1_ep: pcie_ep@33c00000 {
+			compatible = "fsl,imx8mq-pcie-ep";
+			reg = <0x33c00000 0x000400000>,
+			      <0x20000000 0x08000000>;
+			reg-names = "regs", "addr_space";
+			num-lanes = <1>;
+			interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "dma";
+			fsl,max-link-speed = <2>;
+			power-domains = <&pgc_pcie>;
+			resets = <&src IMX8MQ_RESET_PCIEPHY2>,
+				 <&src IMX8MQ_RESET_PCIE2_CTRL_APPS_EN>,
+				 <&src IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF>;
+			reset-names = "pciephy", "apps", "turnoff";
+			assigned-clocks = <&clk IMX8MQ_CLK_PCIE2_CTRL>,
+					  <&clk IMX8MQ_CLK_PCIE2_PHY>,
+					  <&clk IMX8MQ_CLK_PCIE2_AUX>;
+			assigned-clock-parents = <&clk IMX8MQ_SYS2_PLL_250M>,
+						 <&clk IMX8MQ_SYS2_PLL_100M>,
+						 <&clk IMX8MQ_SYS1_PLL_80M>;
+			assigned-clock-rates = <250000000>, <100000000>,
+					       <10000000>;
+			num-ib-windows = <4>;
+			num-ob-windows = <4>;
+			status = "disabled";
+		};
+
 		gic: interrupt-controller@38800000 {
 			compatible = "arm,gic-v3";
 			reg = <0x38800000 0x10000>,	/* GIC Dist */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 08/14] arm64: dts: Add iMX8MQ PCIe EP support on EVK board
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (6 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 07/14] arm64: dts: Add iMX8MQ PCIe EP support Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 09/14] arm64: dts: Add iMX8MP PCIe EP support Richard Zhu
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add iMX8MQ PCIe EP support on EVK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
index 82387b9cb800..9f3bad9b49a6 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
@@ -377,6 +377,18 @@ &pcie1 {
 	status = "okay";
 };
 
+&pcie1_ep {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_pcie1>;
+	clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>,
+		 <&clk IMX8MQ_CLK_PCIE2_AUX>,
+		 <&clk IMX8MQ_CLK_PCIE2_PHY>,
+		 <&pcie0_refclk>;
+	clock-names = "pcie", "pcie_aux", "pcie_phy", "pcie_bus";
+	vph-supply = <&vgen5_reg>;
+	status = "disabled";
+};
+
 &pgc_gpu {
 	power-supply = <&sw1a_reg>;
 };
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 09/14] arm64: dts: Add iMX8MP PCIe EP support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (7 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 08/14] arm64: dts: Add iMX8MQ PCIe EP support on EVK board Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 10/14] arm64: dts: Add iMX8MP PCIe EP support on EVK board Richard Zhu
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add i.MX8MP PCIe EP support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index 21a4cc417c81..104d61a64a00 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -1142,6 +1142,25 @@ pcie: pcie@33800000 {
 			status = "disabled";
 		};
 
+		pcie_ep: pcie_ep@33800000 {
+			compatible = "fsl,imx8mp-pcie-ep";
+			reg = <0x33800000 0x000400000>, <0x18000000 0x08000000>;
+			reg-names = "regs", "addr_space";
+			num-lanes = <1>;
+			interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>; /* eDMA */
+			interrupt-names = "dma";
+			fsl,max-link-speed = <3>;
+			power-domains = <&hsio_blk_ctrl IMX8MP_HSIOBLK_PD_PCIE>;
+			resets = <&src IMX8MP_RESET_PCIE_CTRL_APPS_EN>,
+				 <&src IMX8MP_RESET_PCIE_CTRL_APPS_TURNOFF>;
+			reset-names = "apps", "turnoff";
+			phys = <&pcie_phy>;
+			phy-names = "pcie-phy";
+			num-ib-windows = <4>;
+			num-ob-windows = <4>;
+			status = "disabled";
+		};
+
 		gpu3d: gpu@38000000 {
 			compatible = "vivante,gc";
 			reg = <0x38000000 0x8000>;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 10/14] arm64: dts: Add iMX8MP PCIe EP support on EVK board
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (8 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 09/14] arm64: dts: Add iMX8MP PCIe EP support Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 11/14] misc: pci_endpoint_test: Add iMX8 PCIe EP device support Richard Zhu
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add i.MX8MP PCIe EP support on EVK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
index 9f1469db554d..6daaa5ddc6b6 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
@@ -390,6 +390,19 @@ &pcie {
 	status = "okay";
 };
 
+&pcie_ep{
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_pcie0>;
+	clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+		 <&clk IMX8MP_CLK_PCIE_ROOT>,
+		 <&clk IMX8MP_CLK_HSIO_AXI>;
+	clock-names = "pcie", "pcie_aux", "pcie_bus";
+	assigned-clocks = <&clk IMX8MP_CLK_PCIE_AUX>;
+	assigned-clock-rates = <10000000>;
+	assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_50M>;
+	status = "disabled";
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 11/14] misc: pci_endpoint_test: Add iMX8 PCIe EP device support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (9 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 10/14] arm64: dts: Add iMX8MP PCIe EP support on EVK board Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 12/14] PCI: imx6: Add iMX8MM PCIe EP mode Richard Zhu
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Set the DEVICE_ID of i.MX8 PCIe and add iMX8 PCIE EP device support in
pci_endpoint_test driver.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/misc/pci_endpoint_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 8f786a225dcf..18cea40c697b 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -72,6 +72,7 @@
 #define PCI_DEVICE_ID_TI_J7200			0xb00f
 #define PCI_DEVICE_ID_TI_AM64			0xb010
 #define PCI_DEVICE_ID_LS1088A			0x80c0
+#define PCI_DEVICE_ID_IMX8			0x0808
 
 #define is_am654_pci_dev(pdev)		\
 		((pdev)->device == PCI_DEVICE_ID_TI_AM654)
@@ -958,6 +959,7 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, 0x81c0),
 	  .driver_data = (kernel_ulong_t)&default_data,
 	},
+	{ PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_IMX8),},
 	{ PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_LS1088A),
 	  .driver_data = (kernel_ulong_t)&default_data,
 	},
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 12/14] PCI: imx6: Add iMX8MM PCIe EP mode
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (10 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 11/14] misc: pci_endpoint_test: Add iMX8 PCIe EP device support Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:06 ` [PATCH v3 13/14] PCI: imx6: Add iMX8MQ PCIe EP support Richard Zhu
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Based on i.MX8MM platforms, add the i.MX8MM PCIe EP mode support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 147 +++++++++++++++++++++++---
 1 file changed, 134 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index facc8e7b01c2..1044b0726405 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -52,6 +52,7 @@ enum imx6_pcie_variants {
 	IMX8MQ,
 	IMX8MM,
 	IMX8MP,
+	IMX8MM_EP,
 };
 
 #define IMX6_PCIE_FLAG_IMX6_PHY			BIT(0)
@@ -60,6 +61,7 @@ enum imx6_pcie_variants {
 
 struct imx6_pcie_drvdata {
 	enum imx6_pcie_variants variant;
+	enum dw_pcie_device_mode mode;
 	u32 flags;
 	int dbi_length;
 	const char *gpr;
@@ -153,23 +155,27 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie)
 {
 	WARN_ON(imx6_pcie->drvdata->variant != IMX8MQ &&
 		imx6_pcie->drvdata->variant != IMX8MM &&
+		imx6_pcie->drvdata->variant != IMX8MM_EP &&
 		imx6_pcie->drvdata->variant != IMX8MP);
 	return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14;
 }
 
 static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie)
 {
-	unsigned int mask, val;
+	unsigned int mask, val, mode;
+
+	if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE)
+		mode = PCI_EXP_TYPE_ENDPOINT;
+	else
+		mode = PCI_EXP_TYPE_ROOT_PORT;
 
 	if (imx6_pcie->drvdata->variant == IMX8MQ &&
 	    imx6_pcie->controller_id == 1) {
 		mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE;
-		val  = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE,
-				  PCI_EXP_TYPE_ROOT_PORT);
+		val  = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, mode);
 	} else {
 		mask = IMX6Q_GPR12_DEVICE_TYPE;
-		val  = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE,
-				  PCI_EXP_TYPE_ROOT_PORT);
+		val  = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode);
 	}
 
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, mask, val);
@@ -304,6 +310,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
 {
 	switch (imx6_pcie->drvdata->variant) {
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MP:
 		/*
 		 * The PHY initialization had been done in the PHY
@@ -561,6 +568,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 	case IMX7D:
 		break;
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MQ:
 	case IMX8MP:
 		ret = clk_prepare_enable(imx6_pcie->pcie_aux);
@@ -606,6 +614,7 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie)
 				   IMX7D_GPR12_PCIE_PHY_REFCLK_SEL);
 		break;
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MQ:
 	case IMX8MP:
 		clk_disable_unprepare(imx6_pcie->pcie_aux);
@@ -675,6 +684,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
 		reset_control_assert(imx6_pcie->pciephy_reset);
 		fallthrough;
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MP:
 		reset_control_assert(imx6_pcie->apps_reset);
 		break;
@@ -751,6 +761,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
 		break;
 	case IMX6Q:		/* Nothing to do */
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MP:
 		break;
 	}
@@ -801,6 +812,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev)
 	case IMX7D:
 	case IMX8MQ:
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MP:
 		reset_control_deassert(imx6_pcie->apps_reset);
 		break;
@@ -821,6 +833,7 @@ static void imx6_pcie_ltssm_disable(struct device *dev)
 	case IMX7D:
 	case IMX8MQ:
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MP:
 		reset_control_assert(imx6_pcie->apps_reset);
 		break;
@@ -1002,8 +1015,102 @@ static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
 
 static const struct dw_pcie_ops dw_pcie_ops = {
 	.start_link = imx6_pcie_start_link,
+	.stop_link = imx6_pcie_stop_link,
+};
+
+static void imx6_pcie_ep_init(struct dw_pcie_ep *ep)
+{
+	enum pci_barno bar;
+	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
+
+	for (bar = BAR_0; bar <= BAR_5; bar++)
+		dw_pcie_ep_reset_bar(pci, bar);
+}
+
+static int imx6_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
+				  enum pci_epc_irq_type type,
+				  u16 interrupt_num)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
+
+	switch (type) {
+	case PCI_EPC_IRQ_LEGACY:
+		return dw_pcie_ep_raise_legacy_irq(ep, func_no);
+	case PCI_EPC_IRQ_MSI:
+		return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
+	case PCI_EPC_IRQ_MSIX:
+		return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
+	default:
+		dev_err(pci->dev, "UNKNOWN IRQ type\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static const struct pci_epc_features imx8m_pcie_epc_features = {
+	.linkup_notifier = false,
+	.msi_capable = true,
+	.msix_capable = false,
+	.reserved_bar = 1 << BAR_1 | 1 << BAR_3,
+	.align = SZ_64K,
+};
+
+static const struct pci_epc_features*
+imx6_pcie_ep_get_features(struct dw_pcie_ep *ep)
+{
+	return &imx8m_pcie_epc_features;
+}
+
+static const struct dw_pcie_ep_ops pcie_ep_ops = {
+	.ep_init = imx6_pcie_ep_init,
+	.raise_irq = imx6_pcie_ep_raise_irq,
+	.get_features = imx6_pcie_ep_get_features,
 };
 
+static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie,
+			   struct platform_device *pdev)
+{
+	int ret;
+	unsigned int pcie_dbi2_offset;
+	struct dw_pcie_ep *ep;
+	struct resource *res;
+	struct dw_pcie *pci = imx6_pcie->pci;
+	struct dw_pcie_rp *pp = &pci->pp;
+	struct device *dev = pci->dev;
+
+	imx6_pcie_host_init(pp);
+	ep = &pci->ep;
+	ep->ops = &pcie_ep_ops;
+
+	switch (imx6_pcie->drvdata->variant) {
+	case IMX8MM_EP:
+		pcie_dbi2_offset = SZ_1M;
+		break;
+	default:
+		pcie_dbi2_offset = SZ_4K;
+		break;
+	}
+	pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset;
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space");
+	if (!res)
+		return -EINVAL;
+
+	ep->phys_base = res->start;
+	ep->addr_size = resource_size(res);
+	ep->page_size = SZ_64K;
+
+	ret = dw_pcie_ep_init(ep);
+	if (ret) {
+		dev_err(dev, "failed to initialize endpoint\n");
+		return ret;
+	}
+	/* Start LTSSM. */
+	imx6_pcie_ltssm_enable(dev);
+
+	return 0;
+}
+
 static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie)
 {
 	struct device *dev = imx6_pcie->pci->dev;
@@ -1189,6 +1296,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 		}
 		break;
 	case IMX8MM:
+	case IMX8MM_EP:
 	case IMX8MP:
 		imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
 		if (IS_ERR(imx6_pcie->pcie_aux))
@@ -1278,15 +1386,22 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = dw_pcie_host_init(&pci->pp);
-	if (ret < 0)
-		return ret;
+	if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) {
+		ret = imx6_add_pcie_ep(imx6_pcie, pdev);
+		if (ret < 0)
+			return ret;
+	} else {
+		ret = dw_pcie_host_init(&pci->pp);
+		if (ret < 0)
+			return ret;
+
+		if (pci_msi_enabled()) {
+			u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI);
 
-	if (pci_msi_enabled()) {
-		u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI);
-		val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS);
-		val |= PCI_MSI_FLAGS_ENABLE;
-		dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val);
+			val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS);
+			val |= PCI_MSI_FLAGS_ENABLE;
+			dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val);
+		}
 	}
 
 	return 0;
@@ -1342,6 +1457,11 @@ static const struct imx6_pcie_drvdata drvdata[] = {
 		.flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND,
 		.gpr = "fsl,imx8mp-iomuxc-gpr",
 	},
+	[IMX8MM_EP] = {
+		.variant = IMX8MM_EP,
+		.mode = DW_PCIE_EP_TYPE,
+		.gpr = "fsl,imx8mm-iomuxc-gpr",
+	},
 };
 
 static const struct of_device_id imx6_pcie_of_match[] = {
@@ -1352,6 +1472,7 @@ static const struct of_device_id imx6_pcie_of_match[] = {
 	{ .compatible = "fsl,imx8mq-pcie", .data = &drvdata[IMX8MQ], },
 	{ .compatible = "fsl,imx8mm-pcie", .data = &drvdata[IMX8MM], },
 	{ .compatible = "fsl,imx8mp-pcie", .data = &drvdata[IMX8MP], },
+	{ .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], },
 	{},
 };
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 13/14] PCI: imx6: Add iMX8MQ PCIe EP support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (11 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 12/14] PCI: imx6: Add iMX8MM PCIe EP mode Richard Zhu
@ 2022-09-23  6:06 ` Richard Zhu
  2022-09-23  6:07 ` [PATCH v3 14/14] PCI: imx6: Add iMX8MP " Richard Zhu
  2022-09-23 13:53 ` [PATCH v3 0/14] Add iMX PCIe EP mode support Bjorn Helgaas
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:06 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add the iMX8MQ PCIe EP support

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 36 +++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 1044b0726405..931243e36252 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -53,6 +53,7 @@ enum imx6_pcie_variants {
 	IMX8MM,
 	IMX8MP,
 	IMX8MM_EP,
+	IMX8MQ_EP,
 };
 
 #define IMX6_PCIE_FLAG_IMX6_PHY			BIT(0)
@@ -154,6 +155,7 @@ struct imx6_pcie {
 static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie)
 {
 	WARN_ON(imx6_pcie->drvdata->variant != IMX8MQ &&
+		imx6_pcie->drvdata->variant != IMX8MQ_EP &&
 		imx6_pcie->drvdata->variant != IMX8MM &&
 		imx6_pcie->drvdata->variant != IMX8MM_EP &&
 		imx6_pcie->drvdata->variant != IMX8MP);
@@ -169,13 +171,22 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie)
 	else
 		mode = PCI_EXP_TYPE_ROOT_PORT;
 
-	if (imx6_pcie->drvdata->variant == IMX8MQ &&
-	    imx6_pcie->controller_id == 1) {
-		mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE;
-		val  = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, mode);
-	} else {
+	switch (imx6_pcie->drvdata->variant) {
+	case IMX8MQ:
+	case IMX8MQ_EP:
+		if (imx6_pcie->controller_id == 1) {
+			mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE;
+			val  = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE,
+					  mode);
+		} else {
+			mask = IMX6Q_GPR12_DEVICE_TYPE;
+			val  = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode);
+		}
+		break;
+	default:
 		mask = IMX6Q_GPR12_DEVICE_TYPE;
 		val  = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode);
+		break;
 	}
 
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, mask, val);
@@ -318,6 +329,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
 		 */
 		break;
 	case IMX8MQ:
+	case IMX8MQ_EP:
 		/*
 		 * TODO: Currently this code assumes external
 		 * oscillator is being used
@@ -570,6 +582,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MQ:
+	case IMX8MQ_EP:
 	case IMX8MP:
 		ret = clk_prepare_enable(imx6_pcie->pcie_aux);
 		if (ret) {
@@ -616,6 +629,7 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MQ:
+	case IMX8MQ_EP:
 	case IMX8MP:
 		clk_disable_unprepare(imx6_pcie->pcie_aux);
 		break;
@@ -681,6 +695,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
 	switch (imx6_pcie->drvdata->variant) {
 	case IMX7D:
 	case IMX8MQ:
+	case IMX8MQ_EP:
 		reset_control_assert(imx6_pcie->pciephy_reset);
 		fallthrough;
 	case IMX8MM:
@@ -723,6 +738,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
 
 	switch (imx6_pcie->drvdata->variant) {
 	case IMX8MQ:
+	case IMX8MQ_EP:
 		reset_control_deassert(imx6_pcie->pciephy_reset);
 		break;
 	case IMX7D:
@@ -811,6 +827,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev)
 		break;
 	case IMX7D:
 	case IMX8MQ:
+	case IMX8MQ_EP:
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
@@ -832,6 +849,7 @@ static void imx6_pcie_ltssm_disable(struct device *dev)
 		break;
 	case IMX7D:
 	case IMX8MQ:
+	case IMX8MQ_EP:
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
@@ -1085,6 +1103,7 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie,
 
 	switch (imx6_pcie->drvdata->variant) {
 	case IMX8MM_EP:
+	case IMX8MQ_EP:
 		pcie_dbi2_offset = SZ_1M;
 		break;
 	default:
@@ -1272,6 +1291,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 					     "pcie_inbound_axi clock missing or invalid\n");
 		break;
 	case IMX8MQ:
+	case IMX8MQ_EP:
 		imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
 		if (IS_ERR(imx6_pcie->pcie_aux))
 			return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux),
@@ -1462,6 +1482,11 @@ static const struct imx6_pcie_drvdata drvdata[] = {
 		.mode = DW_PCIE_EP_TYPE,
 		.gpr = "fsl,imx8mm-iomuxc-gpr",
 	},
+	[IMX8MQ_EP] = {
+		.variant = IMX8MQ_EP,
+		.mode = DW_PCIE_EP_TYPE,
+		.gpr = "fsl,imx8mq-iomuxc-gpr",
+	},
 };
 
 static const struct of_device_id imx6_pcie_of_match[] = {
@@ -1473,6 +1498,7 @@ static const struct of_device_id imx6_pcie_of_match[] = {
 	{ .compatible = "fsl,imx8mm-pcie", .data = &drvdata[IMX8MM], },
 	{ .compatible = "fsl,imx8mp-pcie", .data = &drvdata[IMX8MP], },
 	{ .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], },
+	{ .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], },
 	{},
 };
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v3 14/14] PCI: imx6: Add iMX8MP PCIe EP support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (12 preceding siblings ...)
  2022-09-23  6:06 ` [PATCH v3 13/14] PCI: imx6: Add iMX8MQ PCIe EP support Richard Zhu
@ 2022-09-23  6:07 ` Richard Zhu
  2022-09-23 13:53 ` [PATCH v3 0/14] Add iMX PCIe EP mode support Bjorn Helgaas
  14 siblings, 0 replies; 22+ messages in thread
From: Richard Zhu @ 2022-09-23  6:07 UTC (permalink / raw)
  To: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li
  Cc: hongxing.zhu, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

Add the iMX8MP PCIe EP support

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 931243e36252..e339e32d97f8 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -54,6 +54,7 @@ enum imx6_pcie_variants {
 	IMX8MP,
 	IMX8MM_EP,
 	IMX8MQ_EP,
+	IMX8MP_EP,
 };
 
 #define IMX6_PCIE_FLAG_IMX6_PHY			BIT(0)
@@ -158,7 +159,8 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie)
 		imx6_pcie->drvdata->variant != IMX8MQ_EP &&
 		imx6_pcie->drvdata->variant != IMX8MM &&
 		imx6_pcie->drvdata->variant != IMX8MM_EP &&
-		imx6_pcie->drvdata->variant != IMX8MP);
+		imx6_pcie->drvdata->variant != IMX8MP &&
+		imx6_pcie->drvdata->variant != IMX8MP_EP);
 	return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14;
 }
 
@@ -323,6 +325,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		/*
 		 * The PHY initialization had been done in the PHY
 		 * driver, break here directly.
@@ -584,6 +587,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 	case IMX8MQ:
 	case IMX8MQ_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		ret = clk_prepare_enable(imx6_pcie->pcie_aux);
 		if (ret) {
 			dev_err(dev, "unable to enable pcie_aux clock\n");
@@ -631,6 +635,7 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie)
 	case IMX8MQ:
 	case IMX8MQ_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		clk_disable_unprepare(imx6_pcie->pcie_aux);
 		break;
 	default:
@@ -701,6 +706,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		reset_control_assert(imx6_pcie->apps_reset);
 		break;
 	case IMX6SX:
@@ -779,6 +785,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		break;
 	}
 
@@ -831,6 +838,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		reset_control_deassert(imx6_pcie->apps_reset);
 		break;
 	}
@@ -853,6 +861,7 @@ static void imx6_pcie_ltssm_disable(struct device *dev)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		reset_control_assert(imx6_pcie->apps_reset);
 		break;
 	}
@@ -1104,6 +1113,7 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie,
 	switch (imx6_pcie->drvdata->variant) {
 	case IMX8MM_EP:
 	case IMX8MQ_EP:
+	case IMX8MP_EP:
 		pcie_dbi2_offset = SZ_1M;
 		break;
 	default:
@@ -1318,6 +1328,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 	case IMX8MM:
 	case IMX8MM_EP:
 	case IMX8MP:
+	case IMX8MP_EP:
 		imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
 		if (IS_ERR(imx6_pcie->pcie_aux))
 			return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux),
@@ -1487,6 +1498,11 @@ static const struct imx6_pcie_drvdata drvdata[] = {
 		.mode = DW_PCIE_EP_TYPE,
 		.gpr = "fsl,imx8mq-iomuxc-gpr",
 	},
+	[IMX8MP_EP] = {
+		.variant = IMX8MP_EP,
+		.mode = DW_PCIE_EP_TYPE,
+		.gpr = "fsl,imx8mp-iomuxc-gpr",
+	},
 };
 
 static const struct of_device_id imx6_pcie_of_match[] = {
@@ -1499,6 +1515,7 @@ static const struct of_device_id imx6_pcie_of_match[] = {
 	{ .compatible = "fsl,imx8mp-pcie", .data = &drvdata[IMX8MP], },
 	{ .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], },
 	{ .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], },
+	{ .compatible = "fsl,imx8mp-pcie-ep", .data = &drvdata[IMX8MP_EP], },
 	{},
 };
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 0/14] Add iMX PCIe EP mode support
  2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
                   ` (13 preceding siblings ...)
  2022-09-23  6:07 ` [PATCH v3 14/14] PCI: imx6: Add iMX8MP " Richard Zhu
@ 2022-09-23 13:53 ` Bjorn Helgaas
  2022-09-26  5:17   ` Hongxing Zhu
  14 siblings, 1 reply; 22+ messages in thread
From: Bjorn Helgaas @ 2022-09-23 13:53 UTC (permalink / raw)
  To: Richard Zhu
  Cc: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

On Fri, Sep 23, 2022 at 02:06:46PM +0800, Richard Zhu wrote:
> i.MX PCIe controller is one dual mode PCIe controller, and can work either
> as RC or EP.
> This series add the i.MX PCIe EP mode support. And had been verified on
> i.MX8MQ EVK, i.MX8MM EVK and i.MX8MP EVK boards.
> In the verification, one EVK board used as RC, the other one used as EP.
> Use the cross TX/RX differential cable connect the two PCIe ports of these
> two EVK boards.
> 
> +-----------+                +------------+
> |   PCIe TX |<-------------->|PCIe RX     |
> |           |                |            |
> |EVK Board  |                |EVK Board   |
> |           |                |            |
> |   PCIe RX |<-------------->|PCIe TX     |
> +-----------+                +------------+
> 
> Main changes from v2 -> v3:
> - Add the i.MX8MP PCIe EP support, and verified on i.MX8MP EVK board.
> - Rebase to latest pci/next branch(tag: v6.0-rc1 plus some PCIe changes).

This doesn't apply cleanly on either v6.0-rc1 or my "next" branch.
It's best to base your branch on my "main" branch (currently v6.0-rc1)
because that's an unambiguous base that remains stable for the entire
cycle.

If your series actually *depends* on something that's already been
merged, specify that and include the SHA1 (not just something vague
like "latest pci/next" or "v6.0-rc1 plus some PCIe changes") so we can
figure out how to handle it.

Bjorn

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support
  2022-09-23  6:06 ` [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support Richard Zhu
@ 2022-09-23 14:02   ` Bjorn Helgaas
  2022-09-26  5:16     ` Hongxing Zhu
  0 siblings, 1 reply; 22+ messages in thread
From: Bjorn Helgaas @ 2022-09-23 14:02 UTC (permalink / raw)
  To: Richard Zhu
  Cc: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

On Fri, Sep 23, 2022 at 02:06:51PM +0800, Richard Zhu wrote:
> Add iMX8MM PCIe EP support.

Half the time this is spelled "i.MX..." and half the time it's
"iMX..."  Pick one and use it consistently.  I think "i.MX..." is
right because that's what I see on nxp.com, e.g.,
https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i-mx-applications-processors/i-mx-8-processors/i-mx-8-family-arm-cortex-a53-cortex-a72-virtualization-vision-3d-graphics-4k-video:i.MX8

Also applies to several subsequent patches.

Bjorn

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support
  2022-09-23  6:06 ` [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support Richard Zhu
@ 2022-09-23 14:15   ` Bjorn Helgaas
  2022-09-26  5:24     ` Hongxing Zhu
  0 siblings, 1 reply; 22+ messages in thread
From: Bjorn Helgaas @ 2022-09-23 14:15 UTC (permalink / raw)
  To: Richard Zhu
  Cc: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, frank.li, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, linux-imx

On Fri, Sep 23, 2022 at 02:06:50PM +0800, Richard Zhu wrote:
> Since i.MX PCIe is one dual mode PCIe controller.

This is not a sentence.

> Add i.MX PCIe EP mode support, and split the PCIe modes to the Root
> Complex mode and Endpoint mode.

Add blank lines between paragraphs or rewrap into a single paragraph
that fills 75 columns.

I think you should split "[12/14] PCI: imx6: Add iMX8MM PCIe EP mode"
into:

  - A patch that adds the generic endpoint infrastructure, e.g.,
    imx6_pcie_ep_init(), imx6_pcie_ep_raise_irq(), imx6_add_pcie_ep().

  - A second patch that adds the i.MX8MM identifiers.

That way the i.MX8MM patch will be analogous to the i.MX8MQ and
i.MX8MP patches.

Then you could squash this Kconfig patch into the generic endpoint
infrastructure patch because this patch is what selects PCIE_DW_EP,
which is what ensures that dw_pcie_ep_reset_bar(),
dw_pcie_ep_raise_legacy_irq(), etc., are available.

> --- a/drivers/pci/controller/dwc/Kconfig
> +++ b/drivers/pci/controller/dwc/Kconfig
> @@ -92,10 +92,33 @@ config PCI_EXYNOS
>  	  functions to implement the driver.
>  
>  config PCI_IMX6
> -	bool "Freescale i.MX6/7/8 PCIe controller"
> +	bool
> +
> +config PCI_IMX6_HOST
> +	bool "Freescale i.MX6/7/8 PCIe controller host mode"
>  	depends on ARCH_MXC || COMPILE_TEST
>  	depends on PCI_MSI_IRQ_DOMAIN
>  	select PCIE_DW_HOST
> +	select PCI_IMX6
> +	help
> +	  Enables support for the PCIe controller Root Complex mode in the
> +	  iMX6/7/8 SoCs.

> +	  This controller can work either as EP or RC. In order to enable
> +	  host-specific features PCIE_DW_HOST must be selected and in order
> +	  to enable device-specific features PCIE_DW_EP must be selected.

I don't think these three lines are useful to the user.  They only
describe what Kconfig does when PCI_IMX6_HOST is enabled, which is
really an internal implementation detail.

> +config PCI_IMX6_EP
> +	bool "Freescale i.MX6/7/8 PCIe controller endpoint mode"
> +	depends on ARCH_MXC || COMPILE_TEST
> +	depends on PCI_ENDPOINT
> +	select PCIE_DW_EP
> +	select PCI_IMX6
> +	help
> +	  Enables support for the PCIe controller endpoint mode in the
> +	  iMX6/7/8 SoCs.
> +	  This controller can work either as EP or RC. In order to enable
> +	  host-specific features PCIE_DW_HOST must be selected and in order
> +	  to enable device-specific features PCIE_DW_EP must be selected.

Ditto.

>  config PCIE_SPEAR13XX
>  	bool "STMicroelectronics SPEAr PCIe controller"
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* RE: [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support
  2022-09-23 14:02   ` Bjorn Helgaas
@ 2022-09-26  5:16     ` Hongxing Zhu
  0 siblings, 0 replies; 22+ messages in thread
From: Hongxing Zhu @ 2022-09-26  5:16 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, Frank Li, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, dl-linux-imx

> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2022年9月23日 22:03
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: l.stach@pengutronix.de; bhelgaas@google.com; robh+dt@kernel.org;
> lorenzo.pieralisi@arm.com; shawnguo@kernel.org; kishon@ti.com;
> kw@linux.com; Frank Li <frank.li@nxp.com>; linux-pci@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; kernel@pengutronix.de; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support
> 
> On Fri, Sep 23, 2022 at 02:06:51PM +0800, Richard Zhu wrote:
> > Add iMX8MM PCIe EP support.
> 
> Half the time this is spelled "i.MX..." and half the time it's "iMX..."  Pick one
> and use it consistently.  I think "i.MX..." is right because that's what I see on
> nxp.com, e.g.,
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.n
> xp.com%2Fproducts%2Fprocessors-and-microcontrollers%2Farm-processors%
> 2Fi-mx-applications-processors%2Fi-mx-8-processors%2Fi-mx-8-family-arm-cor
> tex-a53-cortex-a72-virtualization-vision-3d-graphics-4k-video%3Ai.MX8&amp;
> data=05%7C01%7Chongxing.zhu%40nxp.com%7C5b63f4398e2745eb1f6008d
> a9d6c5282%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637995
> 385828470777%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp
> ;sdata=ge2kbuqT1wVObayyGEBl5RQg2apn8fKEsXzZR66jz6Y%3D&amp;reserve
> d=0
> 
> Also applies to several subsequent patches.
Okay, would be changed later.
Thanks.

Best Regards
Richard Zhu

> 
> Bjorn
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* RE: [PATCH v3 0/14] Add iMX PCIe EP mode support
  2022-09-23 13:53 ` [PATCH v3 0/14] Add iMX PCIe EP mode support Bjorn Helgaas
@ 2022-09-26  5:17   ` Hongxing Zhu
  0 siblings, 0 replies; 22+ messages in thread
From: Hongxing Zhu @ 2022-09-26  5:17 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, Frank Li, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, dl-linux-imx

> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2022年9月23日 21:54
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: l.stach@pengutronix.de; bhelgaas@google.com; robh+dt@kernel.org;
> lorenzo.pieralisi@arm.com; shawnguo@kernel.org; kishon@ti.com;
> kw@linux.com; Frank Li <frank.li@nxp.com>; linux-pci@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; kernel@pengutronix.de; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [PATCH v3 0/14] Add iMX PCIe EP mode support
> 
> On Fri, Sep 23, 2022 at 02:06:46PM +0800, Richard Zhu wrote:
> > i.MX PCIe controller is one dual mode PCIe controller, and can work
> > either as RC or EP.
> > This series add the i.MX PCIe EP mode support. And had been verified
> > on i.MX8MQ EVK, i.MX8MM EVK and i.MX8MP EVK boards.
> > In the verification, one EVK board used as RC, the other one used as EP.
> > Use the cross TX/RX differential cable connect the two PCIe ports of
> > these two EVK boards.
> >
> > +-----------+                +------------+
> > |   PCIe TX |<-------------->|PCIe RX     |
> > |           |                |            |
> > |EVK Board  |                |EVK Board   |
> > |           |                |            |
> > |   PCIe RX |<-------------->|PCIe TX     |
> > +-----------+                +------------+
> >
> > Main changes from v2 -> v3:
> > - Add the i.MX8MP PCIe EP support, and verified on i.MX8MP EVK board.
> > - Rebase to latest pci/next branch(tag: v6.0-rc1 plus some PCIe changes).
> 
> This doesn't apply cleanly on either v6.0-rc1 or my "next" branch.
> It's best to base your branch on my "main" branch (currently v6.0-rc1) because
> that's an unambiguous base that remains stable for the entire cycle.
> 
> If your series actually *depends* on something that's already been merged,
> specify that and include the SHA1 (not just something vague like "latest
> pci/next" or "v6.0-rc1 plus some PCIe changes") so we can figure out how to
> handle it.
Thanks for your review.
Yes, some i.MX8MP PCIe support patches are required, since the i.MX8MP
PCIe EP is new added in the v3 series.
Would post them later.

Best Regards
Richard Zhu

> 
> Bjorn
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* RE: [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support
  2022-09-23 14:15   ` Bjorn Helgaas
@ 2022-09-26  5:24     ` Hongxing Zhu
  0 siblings, 0 replies; 22+ messages in thread
From: Hongxing Zhu @ 2022-09-26  5:24 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: l.stach, bhelgaas, robh+dt, lorenzo.pieralisi, shawnguo, kishon,
	kw, Frank Li, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, kernel, dl-linux-imx

> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2022年9月23日 22:15
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: l.stach@pengutronix.de; bhelgaas@google.com; robh+dt@kernel.org;
> lorenzo.pieralisi@arm.com; shawnguo@kernel.org; kishon@ti.com;
> kw@linux.com; Frank Li <frank.li@nxp.com>; linux-pci@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; kernel@pengutronix.de; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode
> support
> 
> On Fri, Sep 23, 2022 at 02:06:50PM +0800, Richard Zhu wrote:
> > Since i.MX PCIe is one dual mode PCIe controller.
> 
> This is not a sentence.
Okay, would be changed.

> 
> > Add i.MX PCIe EP mode support, and split the PCIe modes to the Root
> > Complex mode and Endpoint mode.
> 
> Add blank lines between paragraphs or rewrap into a single paragraph that fills
> 75 columns.
Okay, would refine the commit log later.

> 
> I think you should split "[12/14] PCI: imx6: Add iMX8MM PCIe EP mode"
> into:
> 
>   - A patch that adds the generic endpoint infrastructure, e.g.,
>     imx6_pcie_ep_init(), imx6_pcie_ep_raise_irq(), imx6_add_pcie_ep().
> 
>   - A second patch that adds the i.MX8MM identifiers.
> 
> That way the i.MX8MM patch will be analogous to the i.MX8MQ and i.MX8MP
> patches.
> 
> Then you could squash this Kconfig patch into the generic endpoint
> infrastructure patch because this patch is what selects PCIE_DW_EP, which is
> what ensures that dw_pcie_ep_reset_bar(), dw_pcie_ep_raise_legacy_irq(), etc.,
> are available.
Good suggestion. Thanks a lot.
Would change it following this way.

> 
> > --- a/drivers/pci/controller/dwc/Kconfig
> > +++ b/drivers/pci/controller/dwc/Kconfig
> > @@ -92,10 +92,33 @@ config PCI_EXYNOS
> >  	  functions to implement the driver.
> >
> >  config PCI_IMX6
> > -	bool "Freescale i.MX6/7/8 PCIe controller"
> > +	bool
> > +
> > +config PCI_IMX6_HOST
> > +	bool "Freescale i.MX6/7/8 PCIe controller host mode"
> >  	depends on ARCH_MXC || COMPILE_TEST
> >  	depends on PCI_MSI_IRQ_DOMAIN
> >  	select PCIE_DW_HOST
> > +	select PCI_IMX6
> > +	help
> > +	  Enables support for the PCIe controller Root Complex mode in the
> > +	  iMX6/7/8 SoCs.
> 
> > +	  This controller can work either as EP or RC. In order to enable
> > +	  host-specific features PCIE_DW_HOST must be selected and in order
> > +	  to enable device-specific features PCIE_DW_EP must be selected.
> 
> I don't think these three lines are useful to the user.  They only describe what
> Kconfig does when PCI_IMX6_HOST is enabled, which is really an internal
> implementation detail.
Okay, would refine them later.

> 
> > +config PCI_IMX6_EP
> > +	bool "Freescale i.MX6/7/8 PCIe controller endpoint mode"
> > +	depends on ARCH_MXC || COMPILE_TEST
> > +	depends on PCI_ENDPOINT
> > +	select PCIE_DW_EP
> > +	select PCI_IMX6
> > +	help
> > +	  Enables support for the PCIe controller endpoint mode in the
> > +	  iMX6/7/8 SoCs.
> > +	  This controller can work either as EP or RC. In order to enable
> > +	  host-specific features PCIE_DW_HOST must be selected and in order
> > +	  to enable device-specific features PCIE_DW_EP must be selected.
> 
> Ditto.
Okay, would refine them later.

Best Regards
Richard Zhu

> 
> >  config PCIE_SPEAR13XX
> >  	bool "STMicroelectronics SPEAr PCIe controller"
> > --
> > 2.25.1
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists
> > .infradead.org%2Fmailman%2Flistinfo%2Flinux-arm-kernel&amp;data=05%7
> C0
> >
> 1%7Chongxing.zhu%40nxp.com%7Cc9b4cdb1fe6048bcbf2808da9d6e1245%7
> C686ea1
> >
> d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637995393327822891%7CUnk
> nown%7CTW
> >
> FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV
> CI6
> >
> Mn0%3D%7C3000%7C%7C%7C&amp;sdata=mtOA1T3wSvr4IRfbF8WpMlu%2B
> pMh6vQDPKab
> > 17Y4zdeE%3D&amp;reserved=0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP PCIe EP mode compatible string
  2022-09-23  6:06 ` [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP " Richard Zhu
@ 2022-09-26 22:53   ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2022-09-26 22:53 UTC (permalink / raw)
  To: Richard Zhu
  Cc: linux-arm-kernel, robh+dt, linux-imx, kernel, kw, devicetree,
	lorenzo.pieralisi, bhelgaas, linux-pci, linux-kernel, frank.li,
	l.stach, shawnguo, kishon

On Fri, 23 Sep 2022 14:06:49 +0800, Richard Zhu wrote:
> Add i.MX8MP PCIe endpoint mode compatible string.
> 
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> ---
>  Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-09-26 22:54 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23  6:06 [PATCH v3 0/14] Add iMX PCIe EP mode support Richard Zhu
2022-09-23  6:06 ` [PATCH v3 01/14] dt-bindings: imx6q-pcie: Add iMX8MM PCIe EP mode compatible string Richard Zhu
2022-09-23  6:06 ` [PATCH v3 02/14] dt-bindings: imx6q-pcie: Add iMX8MQ " Richard Zhu
2022-09-23  6:06 ` [PATCH v3 03/14] dt-bindings: imx6q-pcie: Add iMX8MP " Richard Zhu
2022-09-26 22:53   ` Rob Herring
2022-09-23  6:06 ` [PATCH v3 04/14] PCI: dwc: Kconfig: Add iMX PCIe EP mode support Richard Zhu
2022-09-23 14:15   ` Bjorn Helgaas
2022-09-26  5:24     ` Hongxing Zhu
2022-09-23  6:06 ` [PATCH v3 05/14] arm64: dts: Add iMX8MM PCIe EP support Richard Zhu
2022-09-23 14:02   ` Bjorn Helgaas
2022-09-26  5:16     ` Hongxing Zhu
2022-09-23  6:06 ` [PATCH v3 06/14] arm64: dts: Add iMX8MM PCIe EP support on EVK board Richard Zhu
2022-09-23  6:06 ` [PATCH v3 07/14] arm64: dts: Add iMX8MQ PCIe EP support Richard Zhu
2022-09-23  6:06 ` [PATCH v3 08/14] arm64: dts: Add iMX8MQ PCIe EP support on EVK board Richard Zhu
2022-09-23  6:06 ` [PATCH v3 09/14] arm64: dts: Add iMX8MP PCIe EP support Richard Zhu
2022-09-23  6:06 ` [PATCH v3 10/14] arm64: dts: Add iMX8MP PCIe EP support on EVK board Richard Zhu
2022-09-23  6:06 ` [PATCH v3 11/14] misc: pci_endpoint_test: Add iMX8 PCIe EP device support Richard Zhu
2022-09-23  6:06 ` [PATCH v3 12/14] PCI: imx6: Add iMX8MM PCIe EP mode Richard Zhu
2022-09-23  6:06 ` [PATCH v3 13/14] PCI: imx6: Add iMX8MQ PCIe EP support Richard Zhu
2022-09-23  6:07 ` [PATCH v3 14/14] PCI: imx6: Add iMX8MP " Richard Zhu
2022-09-23 13:53 ` [PATCH v3 0/14] Add iMX PCIe EP mode support Bjorn Helgaas
2022-09-26  5:17   ` Hongxing Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).