All of lore.kernel.org
 help / color / mirror / Atom feed
From: fabrizio.castro@bp.renesas.com (Fabrizio Castro)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y 05/17] usb: renesas_usbhs: Add reset_control
Date: Wed, 24 Apr 2019 18:20:28 +0100	[thread overview]
Message-ID: <1556126440-27978-6-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1556126440-27978-1-git-send-email-fabrizio.castro@bp.renesas.com>

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

  parent reply	other threads:[~2019-04-24 17:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Fabrizio Castro [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1556126440-27978-6-git-send-email-fabrizio.castro@bp.renesas.com \
    --to=fabrizio.castro@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.