devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 3/5] pcie-rcar: add R-Car gen3 PHY support
       [not found] <b98130a7-b128-9fc3-aee1-1a5a2590b320@cogentembedded.com>
@ 2018-05-03 19:40 ` Sergei Shtylyov
  2018-05-03 19:50   ` Sergei Shtylyov
  2018-05-03 19:44 ` [PATCH v3 5/5] DT: pci: rcar-pci: document R8A77980 bindings Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2018-05-03 19:40 UTC (permalink / raw)
  To: horms, bhelgaas, linux-pci, linux-renesas-soc, Lorenzo Pieralisi,
	Rob Herring, devicetree
  Cc: Mark Rutland

On R-Car gen3 SoCs the PCIe PHY has its own register region -- and I have
written a generic PHY driver for it, thus we need to add the corresponding
code in rcar_pcie_hw_init_gen3() and call devm_phy_optional_get() at the
driver's probing time, so that the existing R-Car gen3 device trees (not
having a PHY node) would still work (we only need to power up the PHY on
R-Car V3H).

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

---
Changes in version 3:
- removed double spaces in the patch description;
- added Simon's tag;
- refreshed atop of the recent driver/bindings patches.

Changes in version 2:
- updated the bindings.

 Documentation/devicetree/bindings/pci/rcar-pci.txt |    5 +++
 drivers/pci/host/pcie-rcar.c                       |   27 +++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

Index: pci/Documentation/devicetree/bindings/pci/rcar-pci.txt
===================================================================
--- pci.orig/Documentation/devicetree/bindings/pci/rcar-pci.txt
+++ pci/Documentation/devicetree/bindings/pci/rcar-pci.txt
@@ -32,6 +32,11 @@ compatible: "renesas,pcie-r8a7743" for t
 	and PCIe bus clocks.
 - clock-names: from common clock binding: should be "pcie" and "pcie_bus".
 
+Optional properties:
+- phys: from common PHY binding: PHY phandle and specifier (only make sense
+	for R-Car gen3 SoCs where the PCIe PHYs have their own register blocks).
+- phy-names: from common PHY binding: should be "pcie".
+
 Example:
 
 SoC-specific DT Entry:
Index: pci/drivers/pci/host/pcie-rcar.c
===================================================================
--- pci.orig/drivers/pci/host/pcie-rcar.c
+++ pci/drivers/pci/host/pcie-rcar.c
@@ -25,6 +25,7 @@
 #include <linux/of_pci.h>
 #include <linux/of_platform.h>
 #include <linux/pci.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
@@ -141,6 +142,7 @@ static inline struct rcar_msi *to_rcar_m
 /* Structure representing the PCIe interface */
 struct rcar_pcie {
 	struct device		*dev;
+	struct phy		*phy;
 	void __iomem		*base;
 	struct list_head	resources;
 	int			root_bus_nr;
@@ -667,6 +669,21 @@ static int rcar_pcie_hw_init_gen2(struct
 	return rcar_pcie_hw_init(pcie);
 }
 
+static int rcar_pcie_hw_init_gen3(struct rcar_pcie *pcie)
+{
+	int err;
+
+	err = phy_init(pcie->phy);
+	if (err)
+		return err;
+
+	err = phy_power_on(pcie->phy);
+	if (err)
+		return err;
+
+	return rcar_pcie_hw_init(pcie);
+}
+
 static int rcar_msi_alloc(struct rcar_msi *chip)
 {
 	int msi;
@@ -916,6 +933,10 @@ static int rcar_pcie_get_resources(struc
 	struct resource res;
 	int err, i;
 
+	pcie->phy = devm_phy_optional_get(dev, "pcie");
+	if (IS_ERR(pcie->phy))
+		return PTR_ERR(pcie->phy);
+
 	err = of_address_to_resource(dev->of_node, 0, &res);
 	if (err)
 		return err;
@@ -1056,8 +1077,10 @@ static const struct of_device_id rcar_pc
 	  .data = rcar_pcie_hw_init_gen2 },
 	{ .compatible = "renesas,pcie-rcar-gen2",
 	  .data = rcar_pcie_hw_init_gen2 },
-	{ .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
-	{ .compatible = "renesas,pcie-rcar-gen3", .data = rcar_pcie_hw_init },
+	{ .compatible = "renesas,pcie-r8a7795",
+	  .data = rcar_pcie_hw_init_gen3 },
+	{ .compatible = "renesas,pcie-rcar-gen3",
+	  .data = rcar_pcie_hw_init_gen3 },
 	{},
 };
 

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

* [PATCH v3 5/5] DT: pci: rcar-pci: document R8A77980 bindings
       [not found] <b98130a7-b128-9fc3-aee1-1a5a2590b320@cogentembedded.com>
  2018-05-03 19:40 ` [PATCH v3 3/5] pcie-rcar: add R-Car gen3 PHY support Sergei Shtylyov
@ 2018-05-03 19:44 ` Sergei Shtylyov
  2018-05-03 19:51   ` Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2018-05-03 19:44 UTC (permalink / raw)
  To: horms, bhelgaas, linux-pci, linux-renesas-soc, Lorenzo Pieralisi,
	Rob Herring, devicetree
  Cc: Mark Rutland

Document the R-Car V3H (R8A77980) SoC in the R-Car PCIe bindings.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
Changes in version 2:
- new patch.

 Documentation/devicetree/bindings/pci/rcar-pci.txt |    1 +
 1 file changed, 1 insertion(+)

Index: pci/Documentation/devicetree/bindings/pci/rcar-pci.txt
===================================================================
--- pci.orig/Documentation/devicetree/bindings/pci/rcar-pci.txt
+++ pci/Documentation/devicetree/bindings/pci/rcar-pci.txt
@@ -8,6 +8,7 @@ compatible: "renesas,pcie-r8a7743" for t
 	    "renesas,pcie-r8a7793" for the R8A7793 SoC;
 	    "renesas,pcie-r8a7795" for the R8A7795 SoC;
 	    "renesas,pcie-r8a7796" for the R8A7796 SoC;
+	    "renesas,pcie-r8a77980" for the R8A77980 SoC;
 	    "renesas,pcie-rcar-gen2" for a generic R-Car Gen2 or
 				     RZ/G1 compatible device.
 	    "renesas,pcie-rcar-gen3" for a generic R-Car Gen3 compatible device.

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

* Re: [PATCH v3 3/5] pcie-rcar: add R-Car gen3 PHY support
  2018-05-03 19:40 ` [PATCH v3 3/5] pcie-rcar: add R-Car gen3 PHY support Sergei Shtylyov
@ 2018-05-03 19:50   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2018-05-03 19:50 UTC (permalink / raw)
  To: horms, bhelgaas, linux-pci, linux-renesas-soc, Lorenzo Pieralisi,
	Rob Herring, devicetree
  Cc: Mark Rutland

On 05/03/2018 10:40 PM, Sergei Shtylyov wrote:

> On R-Car gen3 SoCs the PCIe PHY has its own register region -- and I have
> written a generic PHY driver for it, thus we need to add the corresponding
> code in rcar_pcie_hw_init_gen3() and call devm_phy_optional_get() at the
> driver's probing time, so that the existing R-Car gen3 device trees (not
> having a PHY node) would still work (we only need to power up the PHY on
> R-Car V3H).
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

   Oops, forgot to add Rob's tag:

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

MBR, Sergei

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

* Re: [PATCH v3 5/5] DT: pci: rcar-pci: document R8A77980 bindings
  2018-05-03 19:44 ` [PATCH v3 5/5] DT: pci: rcar-pci: document R8A77980 bindings Sergei Shtylyov
@ 2018-05-03 19:51   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2018-05-03 19:51 UTC (permalink / raw)
  To: horms, bhelgaas, linux-pci, linux-renesas-soc, Lorenzo Pieralisi,
	Rob Herring, devicetree
  Cc: Mark Rutland

On 05/03/2018 10:44 PM, Sergei Shtylyov wrote:
> Document the R-Car V3H (R8A77980) SoC in the R-Car PCIe bindings.
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

   Oops, forgot to add Simon's and Rob's tags:

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Rob Herring <robh@kernel.org>

MBR, Sergei

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

end of thread, other threads:[~2018-05-03 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <b98130a7-b128-9fc3-aee1-1a5a2590b320@cogentembedded.com>
2018-05-03 19:40 ` [PATCH v3 3/5] pcie-rcar: add R-Car gen3 PHY support Sergei Shtylyov
2018-05-03 19:50   ` Sergei Shtylyov
2018-05-03 19:44 ` [PATCH v3 5/5] DT: pci: rcar-pci: document R8A77980 bindings Sergei Shtylyov
2018-05-03 19:51   ` Sergei Shtylyov

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).