From: Ryan Chen <ryan_chen@aspeedtech.com>
To: ryan_chen <ryan_chen@aspeedtech.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
"Alan Stern" <stern@rowland.harvard.edu>,
Philipp Zabel <p.zabel@pengutronix.de>,
<linux-usb@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v3 2/4] usb: uhci: Add reset control support
Date: Fri, 19 Sep 2025 10:57:10 +0800 [thread overview]
Message-ID: <20250919025712.719246-3-ryan_chen@aspeedtech.com> (raw)
In-Reply-To: <20250919025712.719246-1-ryan_chen@aspeedtech.com>
Some SoCs, such as the Aspeed AST2700, require the UHCI controller
to be taken out of reset before it can operate. Add optional reset
control support to the UHCI platform driver.
The driver now acquires an optional reset line from device tree,
deasserts it during probe, and asserts it again in the error path
and shutdown.
Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
drivers/usb/host/uhci-hcd.h | 1 +
drivers/usb/host/uhci-platform.c | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 13ee2a6144b2..4326d1f3ca76 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -445,6 +445,7 @@ struct uhci_hcd {
short load[MAX_PHASE]; /* Periodic allocations */
struct clk *clk; /* (optional) clock source */
+ struct reset_control *rsts; /* (optional) clock reset */
/* Reset host controller */
void (*reset_hc) (struct uhci_hcd *uhci);
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index 62318291f566..f255358d6242 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -11,6 +11,7 @@
#include <linux/of.h>
#include <linux/device.h>
#include <linux/platform_device.h>
+#include <linux/reset.h>
static int uhci_platform_init(struct usb_hcd *hcd)
{
@@ -132,17 +133,29 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
goto err_rmr;
}
+ uhci->rsts = devm_reset_control_array_get_optional_shared(&pdev->dev);
+ if (IS_ERR(uhci->rsts)) {
+ ret = PTR_ERR(uhci->rsts);
+ goto err_clk;
+ }
+ ret = reset_control_deassert(uhci->rsts);
+ if (ret)
+ goto err_clk;
+
ret = platform_get_irq(pdev, 0);
if (ret < 0)
- goto err_clk;
+ goto err_reset;
ret = usb_add_hcd(hcd, ret, IRQF_SHARED);
if (ret)
- goto err_clk;
+ goto err_reset;
device_wakeup_enable(hcd->self.controller);
return 0;
+err_reset:
+ if (!IS_ERR_OR_NULL(uhci->rsts))
+ reset_control_assert(uhci->rsts);
err_clk:
clk_disable_unprepare(uhci->clk);
err_rmr:
@@ -156,6 +169,7 @@ static void uhci_hcd_platform_remove(struct platform_device *pdev)
struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+ reset_control_assert(uhci->rsts);
clk_disable_unprepare(uhci->clk);
usb_remove_hcd(hcd);
usb_put_hcd(hcd);
--
2.34.1
next prev parent reply other threads:[~2025-09-19 2:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 2:57 [PATCH v3 0/4] Add Aspeed AST2700 uhci support Ryan Chen
2025-09-19 2:57 ` [PATCH v3 1/4] dt-bindings: usb: uhci: Add reset property Ryan Chen
2025-09-19 2:57 ` Ryan Chen [this message]
2025-09-19 15:03 ` [PATCH v3 2/4] usb: uhci: Add reset control support Alan Stern
2025-09-21 1:45 ` Ryan Chen
2025-09-22 2:03 ` Ryan Chen
2025-09-19 2:57 ` [PATCH v3 3/4] dt-bindings: usb: uhci: Add Aspeed AST2700 compatible Ryan Chen
2025-09-19 4:32 ` Rob Herring (Arm)
2025-09-19 2:57 ` [PATCH v3 4/4] usb: uhci: Add Aspeed AST2700 support Ryan Chen
2025-09-19 15:08 ` Alan Stern
2025-09-21 1:51 ` Ryan Chen
2025-09-22 2:52 ` Ryan Chen
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=20250919025712.719246-3-ryan_chen@aspeedtech.com \
--to=ryan_chen@aspeedtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=stern@rowland.harvard.edu \
/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 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).