All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH v3 08/12] usb: host: xhci-plat: Add reset support
Date: Sat, 21 Jan 2023 14:58:49 +0000	[thread overview]
Message-ID: <20230121145853.4792-9-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20230121145853.4792-1-biju.das.jz@bp.renesas.com>

Add optional reset support. This is in preparation to adding USB xHCI
support for RZ/V2M SoC.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2->v3:
 * No change
v1->v2:
 * Added Rb tag from Geert.
---
 drivers/usb/host/xhci-plat.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 11b3a0d6722d..c5fc175a5fd1 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -19,6 +19,7 @@
 #include <linux/slab.h>
 #include <linux/acpi.h>
 #include <linux/usb/of.h>
+#include <linux/reset.h>
 
 #include "xhci.h"
 #include "xhci-plat.h"
@@ -263,10 +264,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
 		goto put_hcd;
 	}
 
-	ret = clk_prepare_enable(xhci->reg_clk);
+	xhci->reset = devm_reset_control_array_get_optional_shared(&pdev->dev);
+	if (IS_ERR(xhci->reset)) {
+		ret = PTR_ERR(xhci->reset);
+		goto put_hcd;
+	}
+
+	ret = reset_control_deassert(xhci->reset);
 	if (ret)
 		goto put_hcd;
 
+	ret = clk_prepare_enable(xhci->reg_clk);
+	if (ret)
+		goto err_reset;
+
 	ret = clk_prepare_enable(xhci->clk);
 	if (ret)
 		goto disable_reg_clk;
@@ -377,6 +388,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
 disable_reg_clk:
 	clk_disable_unprepare(xhci->reg_clk);
 
+err_reset:
+	reset_control_assert(xhci->reset);
+
 put_hcd:
 	usb_put_hcd(hcd);
 
@@ -412,6 +426,7 @@ static int xhci_plat_remove(struct platform_device *dev)
 
 	clk_disable_unprepare(clk);
 	clk_disable_unprepare(reg_clk);
+	reset_control_assert(xhci->reset);
 	usb_put_hcd(hcd);
 
 	pm_runtime_disable(&dev->dev);
-- 
2.25.1


  parent reply	other threads:[~2023-01-21 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-21 14:58 [PATCH v3 00/12] ADD USB3.1 HOST, Peri and DRD support Biju Das
2023-01-21 14:58 ` [PATCH v3 01/12] dt-bindings: usb: renesas,usb-xhci: Document RZ/V2M support Biju Das
2023-01-21 14:58 ` [PATCH v3 02/12] dt-bindings: usb: renesas,usb3-peri: Update reset, clock-name and interrupts properties Biju Das
2023-01-21 14:58 ` [PATCH v3 03/12] dt-bindings: usb: renesas,usb3-peri: Document RZ/V2MA bindings Biju Das
2023-01-21 14:58 ` [PATCH v3 04/12] dt-bindings: usb: Add RZ/V2M USB3DRD binding Biju Das
2023-01-21 14:58 ` [PATCH v3 05/12] usb: gadget: Add support for RZ/V2M USB3DRD driver Biju Das
2023-01-21 14:58 ` [PATCH v3 06/12] usb: gadget: udc: renesas_usb3: Add role switch support for RZ/V2M Biju Das
2023-01-21 14:58 ` [PATCH v3 07/12] usb: host: xhci-plat: Improve clock handling in probe() Biju Das
2023-01-21 14:58 ` Biju Das [this message]
2023-01-21 14:58 ` [PATCH v3 09/12] xhci: host: Add Renesas RZ/V2M SoC support Biju Das
2023-01-21 14:58 ` [PATCH v3 10/12] arm64: dts: renesas: r9a09g011: Add USB3 DRD, device and host nodes Biju Das
2023-02-14 15:18   ` Geert Uytterhoeven
2023-01-21 14:58 ` [PATCH v3 11/12] arm64: dts: renesas: rzv2mevk2: Enable USB3 DRD, Peripheral and Host Biju Das
2023-02-14 15:18   ` Geert Uytterhoeven
2023-01-21 14:58 ` [PATCH v3 12/12] arm64: dts: renesas: rzv2mevk2: Enable USB3 role switch Biju Das
2023-02-14 15:18   ` Geert Uytterhoeven

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=20230121145853.4792-9-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=p.zabel@pengutronix.de \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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.