All of lore.kernel.org
 help / color / mirror / Atom feed
* [cip-dev]  [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E
@ 2019-04-24 17:20 Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 01/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support Fabrizio Castro
                   ` (18 more replies)
  0 siblings, 19 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

Dear All,

this series backports SoC specific USB Host 2.0/HSUSB/USB 3.0 DRD
support for the RZ/G2E (a.k.a. R8A774C0).
While at it, this series also cherry-picks some patches useful for
the RZ/G2M (a.k.a. R8A774A1).

Thanks,
Fab

Fabrizio Castro (11):
  dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support
  dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support
  arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes
  usb: renesas_usbhs: add support for RZ/G2E
  dt-bindings: usb: renesas_usbhs: Add r8a774c0 support
  dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0
  arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes
  usb: gadget: udc: renesas_usb3: add support for r8a774c0
  usb: gadget: udc: renesas_usb3: Add r8a774a1 support
  usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0
  arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes

Yoshihiro Shimoda (6):
  usb: renesas_usbhs: Add reset_control
  usb: renesas_usbhs: Add multiple clocks management
  Revert "usb: renesas_usbhs: add extcon notifier to set mode for
    non-otg channel"
  dt-bindings: usb: renesas_usbhs: add clock-names property
  usb: gadget: udc: renesas_usb3: add support for r8a77990
  usb: gadget: udc: renesas_usb3: add a safety connection way for
    forced_b_device

 .../devicetree/bindings/dma/renesas,usb-dmac.txt   |   1 +
 .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt |  11 +-
 .../devicetree/bindings/usb/renesas_usb3.txt       |   6 +-
 .../devicetree/bindings/usb/renesas_usbhs.txt      |   7 +-
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi          | 104 +++++++++++++++++++
 drivers/usb/gadget/udc/renesas_usb3.c              |  30 +++++-
 drivers/usb/renesas_usbhs/common.c                 | 113 +++++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h                 |   5 +-
 drivers/usb/renesas_usbhs/rcar3.c                  |  11 --
 9 files changed, 256 insertions(+), 32 deletions(-)

-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 01/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 02/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support Fabrizio Castro
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit ad05573080997aab7b5d0ea6187d88ef996ae3e5 upstream.

Document RZ/G2M (R8A774A1) SoC bindings.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
index fb4a204..6a4b5b6 100644
--- a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
+++ b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
@@ -1,10 +1,12 @@
 * Renesas R-Car generation 3 USB 2.0 PHY
 
 This file provides information on what the device node for the R-Car generation
-3 USB 2.0 PHY contains.
+3 and RZ/G2 USB 2.0 PHY contain.
 
 Required properties:
-- compatible: "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795
+- compatible: "renesas,usb2-phy-r8a774a1" if the device is a part of an R8A774A1
+	      SoC.
+	      "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795
 	      SoC.
 	      "renesas,usb2-phy-r8a7796" if the device is a part of an R8A7796
 	      SoC.
@@ -14,7 +16,8 @@ Required properties:
 	      R8A77990 SoC.
 	      "renesas,usb2-phy-r8a77995" if the device is a part of an
 	      R8A77995 SoC.
-	      "renesas,rcar-gen3-usb2-phy" for a generic R-Car Gen3 compatible device.
+	      "renesas,rcar-gen3-usb2-phy" for a generic R-Car Gen3 or RZ/G2
+	      compatible device.
 
 	      When compatible with the generic version, nodes must list the
 	      SoC-specific version corresponding to the platform first
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 02/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 01/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 03/17] arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes Fabrizio Castro
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 4f0960ba7a6aedee18d5749e13ac74afe939bf2e upstream.

Document RZ/G2E (R8A774C0) SoC bindings.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
index 6a4b5b6..6f73293 100644
--- a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
+++ b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
@@ -6,6 +6,8 @@ This file provides information on what the device node for the R-Car generation
 Required properties:
 - compatible: "renesas,usb2-phy-r8a774a1" if the device is a part of an R8A774A1
 	      SoC.
+	      "renesas,usb2-phy-r8a774c0" if the device is a part of an R8A774C0
+	      SoC.
 	      "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795
 	      SoC.
 	      "renesas,usb2-phy-r8a7796" if the device is a part of an R8A7796
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 03/17] arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 01/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 02/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 04/17] usb: renesas_usbhs: add support for RZ/G2E Fabrizio Castro
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 89893580cf561fd67a3f70ee812e02eac9966096 upstream.

Add USB2.0 phy and host (EHCI/OHCI) device tree nodes to the RZ/G2E
SoC dtsi.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 37 +++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
index e4c2454..aa77094 100644
--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
@@ -943,6 +943,43 @@
 			status = "disabled";
 		};
 
+		ohci0: usb at ee080000 {
+			compatible = "generic-ohci";
+			reg = <0 0xee080000 0 0x100>;
+			interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
+			phys = <&usb2_phy0>;
+			phy-names = "usb";
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 703>, <&cpg 704>;
+			status = "disabled";
+		};
+
+		ehci0: usb at ee080100 {
+			compatible = "generic-ehci";
+			reg = <0 0xee080100 0 0x100>;
+			interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
+			phys = <&usb2_phy0>;
+			phy-names = "usb";
+			companion = <&ohci0>;
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 703>, <&cpg 704>;
+			status = "disabled";
+		};
+
+		usb2_phy0: usb-phy at ee080200 {
+			compatible = "renesas,usb2-phy-r8a774c0",
+				     "renesas,rcar-gen3-usb2-phy";
+			reg = <0 0xee080200 0 0x700>;
+			interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 703>, <&cpg 704>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
 		sdhi0: sd at ee100000 {
 			compatible = "renesas,sdhi-r8a774c0",
 				     "renesas,rcar-gen3-sdhi";
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 04/17] usb: renesas_usbhs: add support for RZ/G2E
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (2 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 03/17] arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 05/17] usb: renesas_usbhs: Add reset_control Fabrizio Castro
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 1d6e81a288e28d8d0e38e0501a324216f79bba35 upstream.

HS-USB found in RZ/G2E (a.k.a. r8a774c0) is very similar to the
one found in R-Car E3 (a.k.a. r8a77990), as it needs to release
the PLL reset by the UGCTRL register like R-Car E3, therefore add
r8a774c0 support in a similar fashion to what was done for the
r8a77990.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/renesas_usbhs/common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 4310df4..b079258 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -458,6 +458,10 @@ static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
  */
 static const struct of_device_id usbhs_of_match[] = {
 	{
+		.compatible = "renesas,usbhs-r8a774c0",
+		.data = (void *)USBHS_TYPE_RCAR_GEN3_WITH_PLL,
+	},
+	{
 		.compatible = "renesas,usbhs-r8a7790",
 		.data = (void *)USBHS_TYPE_RCAR_GEN2,
 	},
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 05/17] usb: renesas_usbhs: Add reset_control
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (3 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 04/17] usb: renesas_usbhs: add support for RZ/G2E Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 06/17] usb: renesas_usbhs: Add multiple clocks management Fabrizio Castro
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit f181dbb4824130e84f46e5be5b49cf6456f96683 upstream.

R-Car Gen3 needs to deassert resets of both host and peripheral.
Since [eo]hci-platform is possible to assert the reset(s) when
the probing failed, renesas_usbhs driver doesn't work correctly
regardless of finished probing. To fix this issue, this patch adds
reset_control on this renesas_usbhs driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/usb/renesas_usbhs/common.c | 12 ++++++++++++
 drivers/usb/renesas_usbhs/common.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index b079258..0601b14 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -12,6 +12,7 @@
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 #include "common.h"
@@ -578,6 +579,10 @@ static int usbhs_probe(struct platform_device *pdev)
 			return PTR_ERR(priv->edev);
 	}
 
+	priv->rsts = devm_reset_control_array_get_optional_shared(&pdev->dev);
+	if (IS_ERR(priv->rsts))
+		return PTR_ERR(priv->rsts);
+
 	/*
 	 * care platform info
 	 */
@@ -662,6 +667,10 @@ static int usbhs_probe(struct platform_device *pdev)
 	/* dev_set_drvdata should be called after usbhs_mod_init */
 	platform_set_drvdata(pdev, priv);
 
+	ret = reset_control_deassert(priv->rsts);
+	if (ret)
+		goto probe_fail_rst;
+
 	/*
 	 * deviece reset here because
 	 * USB device might be used in boot loader.
@@ -715,6 +724,8 @@ static int usbhs_probe(struct platform_device *pdev)
 	return ret;
 
 probe_end_mod_exit:
+	reset_control_assert(priv->rsts);
+probe_fail_rst:
 	usbhs_mod_remove(priv);
 probe_end_fifo_exit:
 	usbhs_fifo_remove(priv);
@@ -743,6 +754,7 @@ static int usbhs_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 
 	usbhs_platform_call(priv, hardware_exit, pdev);
+	reset_control_assert(priv->rsts);
 	usbhs_mod_remove(priv);
 	usbhs_fifo_remove(priv);
 	usbhs_pipe_remove(priv);
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index 6137f79..bce7d35 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -10,6 +10,7 @@
 
 #include <linux/extcon.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 #include <linux/usb/renesas_usbhs.h>
 
 struct usbhs_priv;
@@ -277,6 +278,7 @@ struct usbhs_priv {
 	struct usbhs_fifo_info fifo_info;
 
 	struct phy *phy;
+	struct reset_control *rsts;
 };
 
 /*
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 06/17] usb: renesas_usbhs: Add multiple clocks management
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (4 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 05/17] usb: renesas_usbhs: Add reset_control Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-25  8:26   ` Pavel Machek
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 07/17] Revert "usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel" Fabrizio Castro
                   ` (12 subsequent siblings)
  18 siblings, 1 reply; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 3df0e240caba641e0d70640e3baf34d34c105176 upstream.

R-Car Gen3 needs to enable clocks of both host and peripheral.
Since [eo]hci-platform disables the reset(s) when the drivers are
removed, renesas_usbhs driver doesn't work correctly. To fix this
issue, this patch adds multiple clocks management on this
renesas_usbhs driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/usb/renesas_usbhs/common.c | 88 ++++++++++++++++++++++++++++++++++++++
 drivers/usb/renesas_usbhs/common.h |  2 +
 2 files changed, 90 insertions(+)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 0601b14..33088b9 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2011 Renesas Solutions Corp.
  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  */
+#include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
@@ -291,6 +292,79 @@ static void usbhsc_set_buswait(struct usbhs_priv *priv)
 		usbhs_bset(priv, BUSWAIT, 0x000F, wait);
 }
 
+static bool usbhsc_is_multi_clks(struct usbhs_priv *priv)
+{
+	if (priv->dparam.type == USBHS_TYPE_RCAR_GEN3 ||
+	    priv->dparam.type == USBHS_TYPE_RCAR_GEN3_WITH_PLL)
+		return true;
+
+	return false;
+}
+
+static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv)
+{
+	if (!usbhsc_is_multi_clks(priv))
+		return 0;
+
+	/* The first clock should exist */
+	priv->clks[0] = of_clk_get(dev->of_node, 0);
+	if (IS_ERR(priv->clks[0]))
+		return PTR_ERR(priv->clks[0]);
+
+	/*
+	 * To backward compatibility with old DT, this driver checks the return
+	 * value if it's -ENOENT or not.
+	 */
+	priv->clks[1] = of_clk_get(dev->of_node, 1);
+	if (PTR_ERR(priv->clks[1]) == -ENOENT)
+		priv->clks[1] = NULL;
+	else if (IS_ERR(priv->clks[1]))
+		return PTR_ERR(priv->clks[1]);
+
+	return 0;
+}
+
+static void usbhsc_clk_put(struct usbhs_priv *priv)
+{
+	int i;
+
+	if (!usbhsc_is_multi_clks(priv))
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
+		clk_put(priv->clks[i]);
+}
+
+static int usbhsc_clk_prepare_enable(struct usbhs_priv *priv)
+{
+	int i, ret;
+
+	if (!usbhsc_is_multi_clks(priv))
+		return 0;
+
+	for (i = 0; i < ARRAY_SIZE(priv->clks); i++) {
+		ret = clk_prepare_enable(priv->clks[i]);
+		if (ret) {
+			while (--i >= 0)
+				clk_disable_unprepare(priv->clks[i]);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
+static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv)
+{
+	int i;
+
+	if (!usbhsc_is_multi_clks(priv))
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
+		clk_disable_unprepare(priv->clks[i]);
+}
+
 /*
  *		platform default param
  */
@@ -341,6 +415,10 @@ static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
 		/* enable PM */
 		pm_runtime_get_sync(dev);
 
+		/* enable clks */
+		if (usbhsc_clk_prepare_enable(priv))
+			return;
+
 		/* enable platform power */
 		usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
 
@@ -353,6 +431,9 @@ static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
 		/* disable platform power */
 		usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
 
+		/* disable clks */
+		usbhsc_clk_disable_unprepare(priv);
+
 		/* disable PM */
 		pm_runtime_put_sync(dev);
 	}
@@ -671,6 +752,10 @@ static int usbhs_probe(struct platform_device *pdev)
 	if (ret)
 		goto probe_fail_rst;
 
+	ret = usbhsc_clk_get(&pdev->dev, priv);
+	if (ret)
+		goto probe_fail_clks;
+
 	/*
 	 * deviece reset here because
 	 * USB device might be used in boot loader.
@@ -724,6 +809,8 @@ static int usbhs_probe(struct platform_device *pdev)
 	return ret;
 
 probe_end_mod_exit:
+	usbhsc_clk_put(priv);
+probe_fail_clks:
 	reset_control_assert(priv->rsts);
 probe_fail_rst:
 	usbhs_mod_remove(priv);
@@ -754,6 +841,7 @@ static int usbhs_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 
 	usbhs_platform_call(priv, hardware_exit, pdev);
+	usbhsc_clk_put(priv);
 	reset_control_assert(priv->rsts);
 	usbhs_mod_remove(priv);
 	usbhs_fifo_remove(priv);
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index bce7d35..555b3e78 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -8,6 +8,7 @@
 #ifndef RENESAS_USB_DRIVER_H
 #define RENESAS_USB_DRIVER_H
 
+#include <linux/clk.h>
 #include <linux/extcon.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
@@ -279,6 +280,7 @@ struct usbhs_priv {
 
 	struct phy *phy;
 	struct reset_control *rsts;
+	struct clk *clks[2];
 };
 
 /*
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 07/17] Revert "usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel"
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (5 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 06/17] usb: renesas_usbhs: Add multiple clocks management Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 08/17] dt-bindings: usb: renesas_usbhs: add clock-names property Fabrizio Castro
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 91b20c5a5be0088f9534483276f86230c3a5872f upstream.

This reverts commit 8ada211d0383b72878582bd312b984a9eae62b30.

R-Car D3 can use OTG mode in fact. So, the commit doesn't need anymore.
In other words, like other R-Car Gen3 SoCs, R-Car D3 can change the mode
by using the phy-rcar-gen3-usb2 driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/usb/renesas_usbhs/common.c |  9 ---------
 drivers/usb/renesas_usbhs/common.h |  1 -
 drivers/usb/renesas_usbhs/rcar3.c  | 11 -----------
 3 files changed, 21 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 33088b9..4b5621d 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -681,15 +681,6 @@ static int usbhs_probe(struct platform_device *pdev)
 		break;
 	case USBHS_TYPE_RCAR_GEN3_WITH_PLL:
 		priv->pfunc = usbhs_rcar3_with_pll_ops;
-		if (!IS_ERR_OR_NULL(priv->edev)) {
-			priv->nb.notifier_call = priv->pfunc.notifier;
-			ret = devm_extcon_register_notifier(&pdev->dev,
-							    priv->edev,
-							    EXTCON_USB_HOST,
-							    &priv->nb);
-			if (ret < 0)
-				dev_err(&pdev->dev, "no notifier registered\n");
-		}
 		break;
 	case USBHS_TYPE_RZA1:
 		priv->pfunc = usbhs_rza1_ops;
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index 555b3e78..3777af8 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -257,7 +257,6 @@ struct usbhs_priv {
 	struct platform_device *pdev;
 
 	struct extcon_dev *edev;
-	struct notifier_block nb;
 
 	spinlock_t		lock;
 
diff --git a/drivers/usb/renesas_usbhs/rcar3.c b/drivers/usb/renesas_usbhs/rcar3.c
index d0ea4ff..b9a8453 100644
--- a/drivers/usb/renesas_usbhs/rcar3.c
+++ b/drivers/usb/renesas_usbhs/rcar3.c
@@ -112,16 +112,6 @@ static int usbhs_rcar3_get_id(struct platform_device *pdev)
 	return USBHS_GADGET;
 }
 
-static int usbhs_rcar3_notifier(struct notifier_block *nb, unsigned long event,
-				void *data)
-{
-	struct usbhs_priv *priv = container_of(nb, struct usbhs_priv, nb);
-
-	usbhs_rcar3_set_usbsel(priv, !!event);
-
-	return NOTIFY_DONE;
-}
-
 const struct renesas_usbhs_platform_callback usbhs_rcar3_ops = {
 	.power_ctrl = usbhs_rcar3_power_ctrl,
 	.get_id = usbhs_rcar3_get_id,
@@ -130,5 +120,4 @@ const struct renesas_usbhs_platform_callback usbhs_rcar3_ops = {
 const struct renesas_usbhs_platform_callback usbhs_rcar3_with_pll_ops = {
 	.power_ctrl = usbhs_rcar3_power_and_pll_ctrl,
 	.get_id = usbhs_rcar3_get_id,
-	.notifier = usbhs_rcar3_notifier,
 };
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 08/17] dt-bindings: usb: renesas_usbhs: add clock-names property
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (6 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 07/17] Revert "usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel" Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 09/17] dt-bindings: usb: renesas_usbhs: Add r8a774c0 support Fabrizio Castro
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 8e0d368a59bf87efa5ee4daea142527d01447864 upstream.

R-Car Gen3 needs to enable clocks of both host and peripheral.
Otherwise, other side device cannot work correctly. So, this patch
adds a property of clock-names for R-Car Gen3 as an optional.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index 43960fa..f19ec72 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -25,7 +25,11 @@ Required properties:
 
   - reg: Base address and length of the register for the USBHS
   - interrupts: Interrupt specifier for the USBHS
-  - clocks: A list of phandle + clock specifier pairs
+  - clocks: A list of phandle + clock specifier pairs.
+	    - In case of "renesas,rcar-gen3-usbhs", two clocks are required.
+	      First clock should be peripheral and second one should be host.
+	    - In case of except above, one clock is required. First clock
+	      should be peripheral.
 
 Optional properties:
   - renesas,buswait: Integer to use BUSWAIT register
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 09/17] dt-bindings: usb: renesas_usbhs: Add r8a774c0 support
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (7 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 08/17] dt-bindings: usb: renesas_usbhs: add clock-names property Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 10/17] dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0 Fabrizio Castro
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 539cf1039165ac59d217d916bc8f88bde8be73bd upstream.

Document RZ/G2E (R8A774C0) SoC bindings.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index f19ec72..616c6c4 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -5,6 +5,7 @@ Required properties:
 
 	- "renesas,usbhs-r8a7743" for r8a7743 (RZ/G1M) compatible device
 	- "renesas,usbhs-r8a7745" for r8a7745 (RZ/G1E) compatible device
+	- "renesas,usbhs-r8a774c0" for r8a774c0 (RZ/G2E) compatible device
 	- "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
 	- "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
 	- "renesas,usbhs-r8a7792" for r8a7792 (R-Car V2H) compatible device
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 10/17] dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (8 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 09/17] dt-bindings: usb: renesas_usbhs: Add r8a774c0 support Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 11/17] arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes Fabrizio Castro
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 3eaba568b54e572187a3f4a08d5582d4d623e7e3 upstream.

This patch adds bindings for the r8a774c0 (RZ/G2E).

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
index 482e543..4354ed6 100644
--- a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
+++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
@@ -5,6 +5,7 @@ Required Properties:
 	Examples with soctypes are:
 	  - "renesas,r8a7743-usb-dmac" (RZ/G1M)
 	  - "renesas,r8a7745-usb-dmac" (RZ/G1E)
+	  - "renesas,r8a774c0-usb-dmac" (RZ/G2E)
 	  - "renesas,r8a7790-usb-dmac" (R-Car H2)
 	  - "renesas,r8a7791-usb-dmac" (R-Car M2-W)
 	  - "renesas,r8a7793-usb-dmac" (R-Car M2-N)
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 11/17] arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (9 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 10/17] dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0 Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 12/17] usb: gadget: udc: renesas_usb3: add support for r8a77990 Fabrizio Castro
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 19777736ced78c4ea9b171ff758f62e04915f005 upstream.

Add usb dmac and hsusb device nodes on RZ/G2E SoC dtsi.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 45 +++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
index aa77094..a4eb5b8 100644
--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
@@ -637,6 +637,51 @@
 			status = "disabled";
 		};
 
+		hsusb: usb at e6590000 {
+			compatible = "renesas,usbhs-r8a774c0",
+				     "renesas,rcar-gen3-usbhs";
+			reg = <0 0xe6590000 0 0x200>;
+			interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 704>, <&cpg CPG_MOD 703>;
+			dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
+			       <&usb_dmac1 0>, <&usb_dmac1 1>;
+			dma-names = "ch0", "ch1", "ch2", "ch3";
+			renesas,buswait = <11>;
+			phys = <&usb2_phy0>;
+			phy-names = "usb";
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 704>, <&cpg 703>;
+			status = "disabled";
+		};
+
+		usb_dmac0: dma-controller at e65a0000 {
+			compatible = "renesas,r8a774c0-usb-dmac",
+				     "renesas,usb-dmac";
+			reg = <0 0xe65a0000 0 0x100>;
+			interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH
+				      GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "ch0", "ch1";
+			clocks = <&cpg CPG_MOD 330>;
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 330>;
+			#dma-cells = <1>;
+			dma-channels = <2>;
+		};
+
+		usb_dmac1: dma-controller at e65b0000 {
+			compatible = "renesas,r8a774c0-usb-dmac",
+				     "renesas,usb-dmac";
+			reg = <0 0xe65b0000 0 0x100>;
+			interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH
+				      GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "ch0", "ch1";
+			clocks = <&cpg CPG_MOD 331>;
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 331>;
+			#dma-cells = <1>;
+			dma-channels = <2>;
+		};
+
 		dmac0: dma-controller at e6700000 {
 			compatible = "renesas,dmac-r8a774c0",
 				     "renesas,rcar-dmac";
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 12/17] usb: gadget: udc: renesas_usb3: add support for r8a77990
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (10 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 11/17] arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 13/17] usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device Fabrizio Castro
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 30025efa8b5e75f545e38a592158c34b3169423b upstream.

Since r8a77990 (R-Car E3) doesn't have VBUS detect pin and
number of ramif is 4, this patch adds a new renesas_usb3_priv
variable for the SoC.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/usb/gadget/udc/renesas_usb3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 67d8a50..cdffbd1 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2603,6 +2603,13 @@ static const struct renesas_usb3_priv renesas_usb3_priv_gen3 = {
 	.ramsize_per_pipe = SZ_4K,
 };
 
+static const struct renesas_usb3_priv renesas_usb3_priv_r8a77990 = {
+	.ramsize_per_ramif = SZ_16K,
+	.num_ramif = 4,
+	.ramsize_per_pipe = SZ_4K,
+	.workaround_for_vbus = true,
+};
+
 static const struct of_device_id usb3_of_match[] = {
 	{
 		.compatible = "renesas,r8a7795-usb3-peri",
@@ -2621,6 +2628,10 @@ static const struct soc_device_attribute renesas_usb3_quirks_match[] = {
 		.soc_id = "r8a7795", .revision = "ES1.*",
 		.data = &renesas_usb3_priv_r8a7795_es1,
 	},
+	{
+		.soc_id = "r8a77990",
+		.data = &renesas_usb3_priv_r8a77990,
+	},
 	{ /* sentinel */ },
 };
 
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 13/17] usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (11 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 12/17] usb: gadget: udc: renesas_usb3: add support for r8a77990 Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-25  8:40   ` Pavel Machek
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 14/17] usb: gadget: udc: renesas_usb3: add support for r8a774c0 Fabrizio Castro
                   ` (5 subsequent siblings)
  18 siblings, 1 reply; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit ceb94bc52c437463f0903e61060a94a2226fb672 upstream.

This patch adds a safety connection way for "forced_b_device" with
"workaround_for_vbus" like below:

< Example for R-Car E3 Ebisu >
 # modprobe <any usb gadget driver>
 # echo 1 > /sys/kernel/debug/ee020000.usb/b_device
 (connect a usb cable to host side.)
 # echo 2 > /sys/kernel/debug/ee020000.usb/b_device

Previous code should have connected a usb cable before the "b_device"
is set to 1 on the Ebisu board. However, if xHCI driver on the board
is probed, it causes some troubles:
 - Conflicts USB VBUS/signals between the board and another host.
 - "Cannot enable. Maybe the USB cable is bad?" might happen on
   both the board and another host with a usb hub.
 - Cannot enumerate a usb gadget correctly because an interruption
   of VBUS change happens unexpectedly.

Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/usb/gadget/udc/renesas_usb3.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index cdffbd1..6e34f95 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -358,6 +358,7 @@ struct renesas_usb3 {
 	bool extcon_host;		/* check id and set EXTCON_USB_HOST */
 	bool extcon_usb;		/* check vbus and set EXTCON_USB */
 	bool forced_b_device;
+	bool start_to_connect;
 };
 
 #define gadget_to_renesas_usb3(_gadget)	\
@@ -476,7 +477,8 @@ static void usb3_init_axi_bridge(struct renesas_usb3 *usb3)
 static void usb3_init_epc_registers(struct renesas_usb3 *usb3)
 {
 	usb3_write(usb3, ~0, USB3_USB_INT_STA_1);
-	usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG);
+	if (!usb3->workaround_for_vbus)
+		usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG);
 }
 
 static bool usb3_wakeup_usb2_phy(struct renesas_usb3 *usb3)
@@ -700,8 +702,7 @@ static void usb3_mode_config(struct renesas_usb3 *usb3, bool host, bool a_dev)
 	usb3_set_mode_by_role_sw(usb3, host);
 	usb3_vbus_out(usb3, a_dev);
 	/* for A-Peripheral or forced B-device mode */
-	if ((!host && a_dev) ||
-	    (usb3->workaround_for_vbus && usb3->forced_b_device))
+	if ((!host && a_dev) || usb3->start_to_connect)
 		usb3_connect(usb3);
 	spin_unlock_irqrestore(&usb3->lock, flags);
 }
@@ -2432,7 +2433,11 @@ static ssize_t renesas_usb3_b_device_write(struct file *file,
 	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
 		return -EFAULT;
 
-	if (!strncmp(buf, "1", 1))
+	usb3->start_to_connect = false;
+	if (usb3->workaround_for_vbus && usb3->forced_b_device &&
+	    !strncmp(buf, "2", 1))
+		usb3->start_to_connect = true;
+	else if (!strncmp(buf, "1", 1))
 		usb3->forced_b_device = true;
 	else
 		usb3->forced_b_device = false;
@@ -2440,7 +2445,7 @@ static ssize_t renesas_usb3_b_device_write(struct file *file,
 	if (usb3->workaround_for_vbus)
 		usb3_disconnect(usb3);
 
-	/* Let this driver call usb3_connect() anyway */
+	/* Let this driver call usb3_connect() if needed */
 	usb3_check_id(usb3);
 
 	return count;
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 14/17] usb: gadget: udc: renesas_usb3: add support for r8a774c0
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (12 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 13/17] usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 15/17] usb: gadget: udc: renesas_usb3: Add r8a774a1 support Fabrizio Castro
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 546970fdab1da5fead4f0f5c8cbf4b1c68213707 upstream.

RZ/G2E USB 3.0 implementation is like the one found on R-Car E3,
therefore add the same quirk.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 drivers/usb/gadget/udc/renesas_usb3.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 6e34f95..7dc2485 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2630,6 +2630,10 @@ MODULE_DEVICE_TABLE(of, usb3_of_match);
 
 static const struct soc_device_attribute renesas_usb3_quirks_match[] = {
 	{
+		.soc_id = "r8a774c0",
+		.data = &renesas_usb3_priv_r8a77990,
+	},
+	{
 		.soc_id = "r8a7795", .revision = "ES1.*",
 		.data = &renesas_usb3_priv_r8a7795_es1,
 	},
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 15/17] usb: gadget: udc: renesas_usb3: Add r8a774a1 support
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (13 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 14/17] usb: gadget: udc: renesas_usb3: add support for r8a774c0 Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 16/17] usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0 Fabrizio Castro
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit a1acad03aa77bde2d7fda7b1391ee72a55a705da upstream.

Document RZ/G2M (R8A774A1) SoC bindings.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 Documentation/devicetree/bindings/usb/renesas_usb3.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/renesas_usb3.txt b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
index 2c071bb5..b22f0a5 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usb3.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
@@ -2,11 +2,12 @@ Renesas Electronics USB3.0 Peripheral driver
 
 Required properties:
   - compatible: Must contain one of the following:
+	- "renesas,r8a774a1-usb3-peri"
 	- "renesas,r8a7795-usb3-peri"
 	- "renesas,r8a7796-usb3-peri"
 	- "renesas,r8a77965-usb3-peri"
-	- "renesas,rcar-gen3-usb3-peri" for a generic R-Car Gen3 compatible
-	  device
+	- "renesas,rcar-gen3-usb3-peri" for a generic R-Car Gen3 or RZ/G2
+	  compatible device
 
     When compatible with the generic version, nodes must list the
     SoC-specific version corresponding to the platform first
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 16/17] usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (14 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 15/17] usb: gadget: udc: renesas_usb3: Add r8a774a1 support Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 17/17] arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes Fabrizio Castro
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 35ed6229c0f0d079f28b22b60b0af3114f9226fb upstream.

Document RZ/G2E (R8A774C0) SoC bindings.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 Documentation/devicetree/bindings/usb/renesas_usb3.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/renesas_usb3.txt b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
index b22f0a5..9551e8c 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usb3.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
@@ -3,6 +3,7 @@ Renesas Electronics USB3.0 Peripheral driver
 Required properties:
   - compatible: Must contain one of the following:
 	- "renesas,r8a774a1-usb3-peri"
+	- "renesas,r8a774c0-usb3-peri"
 	- "renesas,r8a7795-usb3-peri"
 	- "renesas,r8a7796-usb3-peri"
 	- "renesas,r8a77965-usb3-peri"
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 17/17] arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (15 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 16/17] usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0 Fabrizio Castro
@ 2019-04-24 17:20 ` Fabrizio Castro
  2019-04-25  0:54 ` [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E nobuhiro1.iwamatsu at toshiba.co.jp
  2019-04-25 10:00 ` Pavel Machek
  18 siblings, 0 replies; 23+ messages in thread
From: Fabrizio Castro @ 2019-04-24 17:20 UTC (permalink / raw)
  To: cip-dev

commit 3a6addcaedecf2a8261c3491693be38b28a75444 upstream.

Add usb3.0 host and function device nodes to the RZ/G2E SoC dtsi.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
index a4eb5b8..1d37a35 100644
--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
@@ -988,6 +988,28 @@
 			status = "disabled";
 		};
 
+		xhci0: usb at ee000000 {
+			compatible = "renesas,xhci-r8a774c0",
+				     "renesas,rcar-gen3-xhci";
+			reg = <0 0xee000000 0 0xc00>;
+			interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 328>;
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 328>;
+			status = "disabled";
+		};
+
+		usb3_peri0: usb at ee020000 {
+			compatible = "renesas,r8a774c0-usb3-peri",
+				     "renesas,rcar-gen3-usb3-peri";
+			reg = <0 0xee020000 0 0x400>;
+			interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 328>;
+			power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+			resets = <&cpg 328>;
+			status = "disabled";
+		};
+
 		ohci0: usb at ee080000 {
 			compatible = "generic-ohci";
 			reg = <0 0xee080000 0 0x100>;
-- 
2.7.4

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

* [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (16 preceding siblings ...)
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 17/17] arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes Fabrizio Castro
@ 2019-04-25  0:54 ` nobuhiro1.iwamatsu at toshiba.co.jp
  2019-04-25  8:11   ` Pavel Machek
  2019-04-25 10:00 ` Pavel Machek
  18 siblings, 1 reply; 23+ messages in thread
From: nobuhiro1.iwamatsu at toshiba.co.jp @ 2019-04-25  0:54 UTC (permalink / raw)
  To: cip-dev

Hi Fabrizio,

> Dear All,
>
> this series backports SoC specific USB Host 2.0/HSUSB/USB 3.0 DRD
> support for the RZ/G2E (a.k.a. R8A774C0).
> While at it, this series also cherry-picks some patches useful for
> the RZ/G2M (a.k.a. R8A774A1).
>
> Thanks,
> Fab
>
> Fabrizio Castro (11):
>   dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support
>   dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support
>   arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes
>   usb: renesas_usbhs: add support for RZ/G2E
>   dt-bindings: usb: renesas_usbhs: Add r8a774c0 support
>   dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0
>   arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes
>   usb: gadget: udc: renesas_usb3: add support for r8a774c0
>   usb: gadget: udc: renesas_usb3: Add r8a774a1 support
>   usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0
>   arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes
>
> Yoshihiro Shimoda (6):
>   usb: renesas_usbhs: Add reset_control
>   usb: renesas_usbhs: Add multiple clocks management
>   Revert "usb: renesas_usbhs: add extcon notifier to set mode for
>     non-otg channel"
>   dt-bindings: usb: renesas_usbhs: add clock-names property
>   usb: gadget: udc: renesas_usb3: add support for r8a77990
>   usb: gadget: udc: renesas_usb3: add a safety connection way for
>     forced_b_device
>
>  .../devicetree/bindings/dma/renesas,usb-dmac.txt   |   1 +
>  .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt |  11 +-
>  .../devicetree/bindings/usb/renesas_usb3.txt       |   6 +-
>  .../devicetree/bindings/usb/renesas_usbhs.txt      |   7 +-
>  arch/arm64/boot/dts/renesas/r8a774c0.dtsi          | 104 +++++++++++++++++++
>  drivers/usb/gadget/udc/renesas_usb3.c              |  30 +++++-
>  drivers/usb/renesas_usbhs/common.c                 | 113 +++++++++++++++++++--
>  drivers/usb/renesas_usbhs/common.h                 |   5 +-
>  drivers/usb/renesas_usbhs/rcar3.c                  |  11 --
>  9 files changed, 256 insertions(+), 32 deletions(-)
>

Looks good to me all patches.
Pavel, do you have a comment about this series?

Best regards,
  Nobuhiro

________________________________________
???: cip-dev-bounces at lists.cip-project.org <cip-dev-bounces@lists.cip-project.org> ? Fabrizio Castro <fabrizio.castro@bp.renesas.com> ??????
????: 2019?4?25? 2:20
??: cip-dev at lists.cip-project.org
CC: Biju Das
??: [cip-dev]  [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E

Dear All,

this series backports SoC specific USB Host 2.0/HSUSB/USB 3.0 DRD
support for the RZ/G2E (a.k.a. R8A774C0).
While at it, this series also cherry-picks some patches useful for
the RZ/G2M (a.k.a. R8A774A1).

Thanks,
Fab

Fabrizio Castro (11):
  dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support
  dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support
  arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes
  usb: renesas_usbhs: add support for RZ/G2E
  dt-bindings: usb: renesas_usbhs: Add r8a774c0 support
  dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0
  arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes
  usb: gadget: udc: renesas_usb3: add support for r8a774c0
  usb: gadget: udc: renesas_usb3: Add r8a774a1 support
  usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0
  arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes

Yoshihiro Shimoda (6):
  usb: renesas_usbhs: Add reset_control
  usb: renesas_usbhs: Add multiple clocks management
  Revert "usb: renesas_usbhs: add extcon notifier to set mode for
    non-otg channel"
  dt-bindings: usb: renesas_usbhs: add clock-names property
  usb: gadget: udc: renesas_usb3: add support for r8a77990
  usb: gadget: udc: renesas_usb3: add a safety connection way for
    forced_b_device

 .../devicetree/bindings/dma/renesas,usb-dmac.txt   |   1 +
 .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt |  11 +-
 .../devicetree/bindings/usb/renesas_usb3.txt       |   6 +-
 .../devicetree/bindings/usb/renesas_usbhs.txt      |   7 +-
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi          | 104 +++++++++++++++++++
 drivers/usb/gadget/udc/renesas_usb3.c              |  30 +++++-
 drivers/usb/renesas_usbhs/common.c                 | 113 +++++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h                 |   5 +-
 drivers/usb/renesas_usbhs/rcar3.c                  |  11 --
 9 files changed, 256 insertions(+), 32 deletions(-)

--
2.7.4

_______________________________________________
cip-dev mailing list
cip-dev at lists.cip-project.org
https://lists.cip-project.org/mailman/listinfo/cip-dev

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

* [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E
  2019-04-25  0:54 ` [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E nobuhiro1.iwamatsu at toshiba.co.jp
@ 2019-04-25  8:11   ` Pavel Machek
  0 siblings, 0 replies; 23+ messages in thread
From: Pavel Machek @ 2019-04-25  8:11 UTC (permalink / raw)
  To: cip-dev

Hi!

> Looks good to me all patches.
> Pavel, do you have a comment about this series?

Let me take a look. I'll apply them to the tree if there's no problem
with them...?

Best regards,

								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20190425/3125502d/attachment.sig>

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

* [cip-dev] [PATCH 4.19.y 06/17] usb: renesas_usbhs: Add multiple clocks management
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 06/17] usb: renesas_usbhs: Add multiple clocks management Fabrizio Castro
@ 2019-04-25  8:26   ` Pavel Machek
  0 siblings, 0 replies; 23+ messages in thread
From: Pavel Machek @ 2019-04-25  8:26 UTC (permalink / raw)
  To: cip-dev

Hi!

> +	/*
> +	 * To backward compatibility with old DT, this driver checks the return
> +	 * value if it's -ENOENT or not.
> +	 */
> +	priv->clks[1] = of_clk_get(dev->of_node, 1);
> +	if (PTR_ERR(priv->clks[1]) == -ENOENT)
> +		priv->clks[1] = NULL;
> +	else if (IS_ERR(priv->clks[1]))
> +		return PTR_ERR(priv->clks[1]);

I'd really use temporary variable here.

Something like

	  if (IS_ERR()) {
	          err = PTR_ERR();
	          if (err != -ENOENT)
		         return err;
                  priv->clks[1] = NULL;
          }

But this is -cip, so no need to fix it here, but consider fixing it in
mainline.
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20190425/e9cb0faf/attachment.sig>

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

* [cip-dev] [PATCH 4.19.y 13/17] usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device
  2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 13/17] usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device Fabrizio Castro
@ 2019-04-25  8:40   ` Pavel Machek
  0 siblings, 0 replies; 23+ messages in thread
From: Pavel Machek @ 2019-04-25  8:40 UTC (permalink / raw)
  To: cip-dev

Hi!

> From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> 
> commit ceb94bc52c437463f0903e61060a94a2226fb672 upstream.
> 
> This patch adds a safety connection way for "forced_b_device" with
> "workaround_for_vbus" like below:

I don't understand what "safety connection way" is.

> @@ -2432,7 +2433,11 @@ static ssize_t renesas_usb3_b_device_write(struct file *file,
>  	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
>  		return -EFAULT;
>  
> -	if (!strncmp(buf, "1", 1))
> +	usb3->start_to_connect = false;
> +	if (usb3->workaround_for_vbus && usb3->forced_b_device &&
> +	    !strncmp(buf, "2", 1))
> +		usb3->start_to_connect = true;
> +	else if (!strncmp(buf, "1", 1))
>  		usb3->forced_b_device = true;
>  	else
>  		usb3->forced_b_device = false;

I don't think this is correct. If user writes "12" to the file,
(!strncmp(buf, "1", 1)) will still be true, AFAICT. Similar problem
exists elsewhere in the file, with (!strncmp(buf, "host",
strlen("host"))).

This is adding new option to kernel interface. ("2" to sysfs file). I
believe that should be documented in Documentation/ABI.

Anyway, I'll most likely apply the patch, as problem needs to be fixed
in the mainline, first.

Best regards,
								Pavel

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20190425/1670d415/attachment.sig>

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

* [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E
  2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
                   ` (17 preceding siblings ...)
  2019-04-25  0:54 ` [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E nobuhiro1.iwamatsu at toshiba.co.jp
@ 2019-04-25 10:00 ` Pavel Machek
  18 siblings, 0 replies; 23+ messages in thread
From: Pavel Machek @ 2019-04-25 10:00 UTC (permalink / raw)
  To: cip-dev

Hi!

> this series backports SoC specific USB Host 2.0/HSUSB/USB 3.0 DRD
> support for the RZ/G2E (a.k.a. R8A774C0).
> While at it, this series also cherry-picks some patches useful for
> the RZ/G2M (a.k.a. R8A774A1).

Thanks for the series, applied, and pushed to kernel.org.

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20190425/f9bad5f6/attachment.sig>

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

end of thread, other threads:[~2019-04-25 10:00 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 17:20 [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 01/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774a1 support Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 02/17] dt-bindings: rcar-gen3-phy-usb2: Add r8a774c0 support Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 03/17] arm64: dts: renesas: r8a774c0: Add USB2.0 phy and host device nodes Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 04/17] usb: renesas_usbhs: add support for RZ/G2E Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 05/17] usb: renesas_usbhs: Add reset_control Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 06/17] usb: renesas_usbhs: Add multiple clocks management Fabrizio Castro
2019-04-25  8:26   ` Pavel Machek
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 07/17] Revert "usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel" Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 08/17] dt-bindings: usb: renesas_usbhs: add clock-names property Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 09/17] dt-bindings: usb: renesas_usbhs: Add r8a774c0 support Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 10/17] dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0 Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 11/17] arm64: dts: renesas: r8a774c0: Add USB-DMAC and HSUSB device nodes Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 12/17] usb: gadget: udc: renesas_usb3: add support for r8a77990 Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 13/17] usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device Fabrizio Castro
2019-04-25  8:40   ` Pavel Machek
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 14/17] usb: gadget: udc: renesas_usb3: add support for r8a774c0 Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 15/17] usb: gadget: udc: renesas_usb3: Add r8a774a1 support Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 16/17] usb: gadget: udc: renesas_usb3: Add bindings for r8a774c0 Fabrizio Castro
2019-04-24 17:20 ` [cip-dev] [PATCH 4.19.y 17/17] arm64: dts: renesas: r8a774c0: Add USB3.0 device nodes Fabrizio Castro
2019-04-25  0:54 ` [cip-dev] [PATCH 4.19.y 00/17] Backport USB support for RZ/G2E nobuhiro1.iwamatsu at toshiba.co.jp
2019-04-25  8:11   ` Pavel Machek
2019-04-25 10:00 ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.