Linux-OMAP Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v4 0/4] AM64: Add PCIe bindings and driver support
@ 2021-03-08  6:35 Kishon Vijay Abraham I
  2021-03-08  6:35 ` [PATCH v4 1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector Kishon Vijay Abraham I
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-08  6:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Bjorn Helgaas, Rob Herring, Tom Joseph,
	Lorenzo Pieralisi, Nadeem Athani
  Cc: linux-pci, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, Lokesh Vutla

AM64 uses the same PCIe controller as in J7200, however AM642 EVM
doesn't have a clock generator (unlike J7200 base board). Here
the clock from the SERDES has to be routed to the PCIE connector.
This series provides an option for the pci-j721e.c driver to
drive reference clock output to the connector.

v1 of the patch series can be found @ [1]
v2 of the patch series can be found @ [2]
v3 of the patch series can be found @ [3]

Changes from v3:
*) Added Reviewed by from Rob
*) Incorporated Krzysztof Wilczyński comment on DT binding documentation
*) Fixed "warn: missing error code 'ret'"

Changes from v2:
*) Fix DT binding documentation suggested by Rob

Changes from v1:
*) Fixed missing initialization of "ret" variable in the error path.

[1] -> http://lore.kernel.org/r/20201224115658.2795-1-kishon@ti.com
[2] -> https://lore.kernel.org/r/20210104124103.30930-1-kishon@ti.com
[3] -> https://lore.kernel.org/r/20210222114030.26445-1-kishon@ti.com

Kishon Vijay Abraham I (4):
  dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the
    connector
  dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64
    SoC
  dt-bindings: PCI: ti,j721e: Add endpoint mode dt-bindings for TI's
    AM64 SoC
  PCI: j721e: Add support to provide refclk to PCIe connector

 .../bindings/pci/ti,j721e-pci-ep.yaml         |  9 ++++----
 .../bindings/pci/ti,j721e-pci-host.yaml       | 20 ++++++++++++-----
 drivers/pci/controller/cadence/pci-j721e.c    | 22 ++++++++++++++++++-
 3 files changed, 40 insertions(+), 11 deletions(-)

-- 
2.17.1


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

* [PATCH v4 1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector
  2021-03-08  6:35 [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
@ 2021-03-08  6:35 ` Kishon Vijay Abraham I
  2021-03-10  2:34   ` [PATCH v4 1/4] dt-bindings: PCI: ti, j721e: " Rob Herring
  2021-03-08  6:35 ` [PATCH v4 2/4] dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64 SoC Kishon Vijay Abraham I
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-08  6:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Bjorn Helgaas, Rob Herring, Tom Joseph,
	Lorenzo Pieralisi, Nadeem Athani
  Cc: linux-pci, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, Lokesh Vutla

Add binding to represent refclk to the PCIe connector.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 .../devicetree/bindings/pci/ti,j721e-pci-host.yaml       | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml b/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml
index 0880a613ece6..963f90816645 100644
--- a/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml
+++ b/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml
@@ -46,12 +46,17 @@ properties:
     maxItems: 1
 
   clocks:
-    maxItems: 1
-    description: clock-specifier to represent input to the PCIe
+    minItems: 1
+    maxItems: 2
+    description: |+
+      clock-specifier to represent input to the PCIe for 1 item.
+      2nd item if present represents reference clock to the connector.
 
   clock-names:
+    minItems: 1
     items:
       - const: fck
+      - const: pcie_refclk
 
   vendor-id:
     const: 0x104c
-- 
2.17.1


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

* [PATCH v4 2/4] dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64 SoC
  2021-03-08  6:35 [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
  2021-03-08  6:35 ` [PATCH v4 1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector Kishon Vijay Abraham I
@ 2021-03-08  6:35 ` Kishon Vijay Abraham I
  2021-03-08  6:35 ` [PATCH v4 3/4] dt-bindings: PCI: ti,j721e: Add endpoint " Kishon Vijay Abraham I
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-08  6:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Bjorn Helgaas, Rob Herring, Tom Joseph,
	Lorenzo Pieralisi, Nadeem Athani
  Cc: linux-pci, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, Lokesh Vutla

Add host mode dt-bindings for TI's AM64 SoC. This is the same IP used in
J7200, however AM64 is a non-coherent architecture.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/pci/ti,j721e-pci-host.yaml    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml b/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml
index 963f90816645..cc900202df29 100644
--- a/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml
+++ b/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml
@@ -16,12 +16,14 @@ allOf:
 properties:
   compatible:
     oneOf:
-      - description: PCIe controller in J7200
+      - const: ti,j721e-pcie-host
+      - description: PCIe controller in AM64
         items:
-          - const: ti,j7200-pcie-host
+          - const: ti,am64-pcie-host
           - const: ti,j721e-pcie-host
-      - description: PCIe controller in J721E
+      - description: PCIe controller in J7200
         items:
+          - const: ti,j7200-pcie-host
           - const: ti,j721e-pcie-host
 
   reg:
@@ -67,6 +69,8 @@ properties:
           - const: 0xb00d
       - items:
           - const: 0xb00f
+      - items:
+          - const: 0xb010
 
   msi-map: true
 
@@ -83,7 +87,6 @@ required:
   - vendor-id
   - device-id
   - msi-map
-  - dma-coherent
   - dma-ranges
   - ranges
   - reset-gpios
-- 
2.17.1


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

* [PATCH v4 3/4] dt-bindings: PCI: ti,j721e: Add endpoint mode dt-bindings for TI's AM64 SoC
  2021-03-08  6:35 [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
  2021-03-08  6:35 ` [PATCH v4 1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector Kishon Vijay Abraham I
  2021-03-08  6:35 ` [PATCH v4 2/4] dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64 SoC Kishon Vijay Abraham I
@ 2021-03-08  6:35 ` Kishon Vijay Abraham I
  2021-03-08  6:35 ` [PATCH v4 4/4] PCI: j721e: Add support to provide refclk to PCIe connector Kishon Vijay Abraham I
  2021-03-23 10:35 ` [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Lorenzo Pieralisi
  4 siblings, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-08  6:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Bjorn Helgaas, Rob Herring, Tom Joseph,
	Lorenzo Pieralisi, Nadeem Athani
  Cc: linux-pci, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, Lokesh Vutla

Add endpoint mode dt-bindings for TI's AM64 SoC. This is the same IP
used in J7200, however AM64 is a non-coherent architecture.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/pci/ti,j721e-pci-ep.yaml         | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml b/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml
index d06f0c4464c6..aed437dac363 100644
--- a/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml
@@ -16,12 +16,14 @@ allOf:
 properties:
   compatible:
     oneOf:
-      - description: PCIe EP controller in J7200
+      - const: ti,j721e-pcie-ep
+      - description: PCIe EP controller in AM64
         items:
-          - const: ti,j7200-pcie-ep
+          - const: ti,am64-pcie-ep
           - const: ti,j721e-pcie-ep
-      - description: PCIe EP controller in J721E
+      - description: PCIe EP controller in J7200
         items:
+          - const: ti,j7200-pcie-ep
           - const: ti,j721e-pcie-ep
 
   reg:
@@ -66,7 +68,6 @@ required:
   - power-domains
   - clocks
   - clock-names
-  - dma-coherent
   - max-functions
   - phys
   - phy-names
-- 
2.17.1


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

* [PATCH v4 4/4] PCI: j721e: Add support to provide refclk to PCIe connector
  2021-03-08  6:35 [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
                   ` (2 preceding siblings ...)
  2021-03-08  6:35 ` [PATCH v4 3/4] dt-bindings: PCI: ti,j721e: Add endpoint " Kishon Vijay Abraham I
@ 2021-03-08  6:35 ` Kishon Vijay Abraham I
  2021-03-23 10:35 ` [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Lorenzo Pieralisi
  4 siblings, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-08  6:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Bjorn Helgaas, Rob Herring, Tom Joseph,
	Lorenzo Pieralisi, Nadeem Athani
  Cc: linux-pci, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, Lokesh Vutla

Add support to provide refclk to PCIe connector.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index dac1ac8a7615..7f9dd34b98a9 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -6,6 +6,7 @@
  * Author: Kishon Vijay Abraham I <kishon@ti.com>
  */
 
+#include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/io.h>
@@ -50,6 +51,7 @@ enum link_status {
 
 struct j721e_pcie {
 	struct device		*dev;
+	struct clk		*refclk;
 	u32			mode;
 	u32			num_lanes;
 	struct cdns_pcie	*cdns_pcie;
@@ -310,6 +312,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	struct cdns_pcie_ep *ep;
 	struct gpio_desc *gpiod;
 	void __iomem *base;
+	struct clk *clk;
 	u32 num_lanes;
 	u32 mode;
 	int ret;
@@ -408,6 +411,20 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 			goto err_get_sync;
 		}
 
+		clk = devm_clk_get_optional(dev, "pcie_refclk");
+		if (IS_ERR(clk)) {
+			ret = PTR_ERR(clk);
+			dev_err(dev, "failed to get pcie_refclk\n");
+			goto err_pcie_setup;
+		}
+
+		ret = clk_prepare_enable(clk);
+		if (ret) {
+			dev_err(dev, "failed to enable pcie_refclk\n");
+			goto err_get_sync;
+		}
+		pcie->refclk = clk;
+
 		/*
 		 * "Power Sequencing and Reset Signal Timings" table in
 		 * PCI EXPRESS CARD ELECTROMECHANICAL SPECIFICATION, REV. 3.0
@@ -422,8 +439,10 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 		}
 
 		ret = cdns_pcie_host_setup(rc);
-		if (ret < 0)
+		if (ret < 0) {
+			clk_disable_unprepare(pcie->refclk);
 			goto err_pcie_setup;
+		}
 
 		break;
 	case PCI_MODE_EP:
@@ -476,6 +495,7 @@ static int j721e_pcie_remove(struct platform_device *pdev)
 	struct cdns_pcie *cdns_pcie = pcie->cdns_pcie;
 	struct device *dev = &pdev->dev;
 
+	clk_disable_unprepare(pcie->refclk);
 	cdns_pcie_disable_phy(cdns_pcie);
 	pm_runtime_put(dev);
 	pm_runtime_disable(dev);
-- 
2.17.1


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

* Re: [PATCH v4 1/4] dt-bindings: PCI: ti, j721e: Add binding to represent refclk to the connector
  2021-03-08  6:35 ` [PATCH v4 1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector Kishon Vijay Abraham I
@ 2021-03-10  2:34   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2021-03-10  2:34 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Lorenzo Pieralisi, Rob Herring, linux-arm-kernel, Tom Joseph,
	Bjorn Helgaas, linux-pci, linux-kernel, devicetree, linux-omap,
	Lokesh Vutla, Nadeem Athani

On Mon, 08 Mar 2021 12:05:47 +0530, Kishon Vijay Abraham I wrote:
> Add binding to represent refclk to the PCIe connector.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  .../devicetree/bindings/pci/ti,j721e-pci-host.yaml       | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

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

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

* Re: [PATCH v4 0/4] AM64: Add PCIe bindings and driver support
  2021-03-08  6:35 [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
                   ` (3 preceding siblings ...)
  2021-03-08  6:35 ` [PATCH v4 4/4] PCI: j721e: Add support to provide refclk to PCIe connector Kishon Vijay Abraham I
@ 2021-03-23 10:35 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2021-03-23 10:35 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring, Tom Joseph, Kishon Vijay Abraham I,
	Nadeem Athani
  Cc: Lorenzo Pieralisi, linux-arm-kernel, linux-pci, linux-kernel,
	devicetree, Lokesh Vutla, linux-omap

On Mon, 8 Mar 2021 12:05:46 +0530, Kishon Vijay Abraham I wrote:
> AM64 uses the same PCIe controller as in J7200, however AM642 EVM
> doesn't have a clock generator (unlike J7200 base board). Here
> the clock from the SERDES has to be routed to the PCIE connector.
> This series provides an option for the pci-j721e.c driver to
> drive reference clock output to the connector.
> 
> v1 of the patch series can be found @ [1]
> v2 of the patch series can be found @ [2]
> v3 of the patch series can be found @ [3]
> 
> [...]

Applied to pci/cadence, thanks!

[1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector
      https://git.kernel.org/lpieralisi/pci/c/f9875d1a36
[2/4] dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64 SoC
      https://git.kernel.org/lpieralisi/pci/c/3201f355e9
[3/4] dt-bindings: PCI: ti,j721e: Add endpoint mode dt-bindings for TI's AM64 SoC
      https://git.kernel.org/lpieralisi/pci/c/6b7d5394c2
[4/4] PCI: j721e: Add support to provide refclk to PCIe connector
      https://git.kernel.org/lpieralisi/pci/c/49e0efdce7

Thanks,
Lorenzo

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  6:35 [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
2021-03-08  6:35 ` [PATCH v4 1/4] dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector Kishon Vijay Abraham I
2021-03-10  2:34   ` [PATCH v4 1/4] dt-bindings: PCI: ti, j721e: " Rob Herring
2021-03-08  6:35 ` [PATCH v4 2/4] dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64 SoC Kishon Vijay Abraham I
2021-03-08  6:35 ` [PATCH v4 3/4] dt-bindings: PCI: ti,j721e: Add endpoint " Kishon Vijay Abraham I
2021-03-08  6:35 ` [PATCH v4 4/4] PCI: j721e: Add support to provide refclk to PCIe connector Kishon Vijay Abraham I
2021-03-23 10:35 ` [PATCH v4 0/4] AM64: Add PCIe bindings and driver support Lorenzo Pieralisi

Linux-OMAP Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-omap/0 linux-omap/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-omap linux-omap/ https://lore.kernel.org/linux-omap \
		linux-omap@vger.kernel.org
	public-inbox-index linux-omap

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-omap


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git