From: Svyatoslav Ryhel <clamor95@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Peter Chen <peter.chen@kernel.org>,
Svyatoslav Ryhel <clamor95@gmail.com>,
Xu Yang <xu.yang_2@nxp.com>, Peng Fan <peng.fan@nxp.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/4] usb: chipidea: tegra: Avoid controller/PHY init if bus is externally controlled
Date: Sat, 23 May 2026 11:30:11 +0300 [thread overview]
Message-ID: <20260523083013.46372-4-clamor95@gmail.com> (raw)
In-Reply-To: <20260523083013.46372-1-clamor95@gmail.com>
If the USB controller and PHY are externally controlled, then the
registration of the controller and the PHY initialization should be
skipped, since these configurations must be done by the device that
controls the bus to work correctly.
Since USB PHY in Tegra controls clock gates required by the controller
itself, Chipidea core PHY management is not suitable for Tegra.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/usb/chipidea/ci_hdrc_tegra.c | 32 ++++++++++++++++++----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
index 372788f0f970..a19cb3b33bf3 100644
--- a/drivers/usb/chipidea/ci_hdrc_tegra.c
+++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
@@ -32,6 +32,7 @@ struct tegra_usb {
struct clk *clk;
bool needs_double_reset;
+ bool externally_controlled;
};
struct tegra_usb_soc_info {
@@ -312,6 +313,9 @@ static int tegra_usb_probe(struct platform_device *pdev)
if (device_property_present(&pdev->dev, "nvidia,needs-double-reset"))
usb->needs_double_reset = true;
+ if (device_property_present(&pdev->dev, "nvidia,external-control"))
+ usb->externally_controlled = true;
+
err = tegra_usb_reset_controller(&pdev->dev);
if (err) {
dev_err_probe(&pdev->dev, err, "failed to reset controller");
@@ -323,9 +327,11 @@ static int tegra_usb_probe(struct platform_device *pdev)
* initialized, otherwise CPU will hang because clocks are gated.
* PHY driver controls gating of internal USB clocks on Tegra.
*/
- err = usb_phy_init(usb->phy);
- if (err)
- goto fail_power_off;
+ if (!usb->externally_controlled) {
+ err = usb_phy_init(usb->phy);
+ if (err)
+ goto fail_power_off;
+ }
/* setup and register ChipIdea HDRC device */
usb->soc = soc;
@@ -342,12 +348,14 @@ static int tegra_usb_probe(struct platform_device *pdev)
if (of_usb_get_phy_mode(pdev->dev.of_node) == USBPHY_INTERFACE_MODE_ULPI)
usb->data.flags &= ~CI_HDRC_SUPPORTS_RUNTIME_PM;
- usb->dev = ci_hdrc_add_device(&pdev->dev, pdev->resource,
- pdev->num_resources, &usb->data);
- if (IS_ERR(usb->dev)) {
- err = dev_err_probe(&pdev->dev, PTR_ERR(usb->dev),
- "failed to add HDRC device");
- goto phy_shutdown;
+ if (!usb->externally_controlled) {
+ usb->dev = ci_hdrc_add_device(&pdev->dev, pdev->resource,
+ pdev->num_resources, &usb->data);
+ if (IS_ERR(usb->dev)) {
+ err = dev_err_probe(&pdev->dev, PTR_ERR(usb->dev),
+ "failed to add HDRC device");
+ goto phy_shutdown;
+ }
}
return 0;
@@ -365,8 +373,10 @@ static void tegra_usb_remove(struct platform_device *pdev)
{
struct tegra_usb *usb = platform_get_drvdata(pdev);
- ci_hdrc_remove_device(usb->dev);
- usb_phy_shutdown(usb->phy);
+ if (!usb->externally_controlled) {
+ ci_hdrc_remove_device(usb->dev);
+ usb_phy_shutdown(usb->phy);
+ }
pm_runtime_put_sync_suspend(&pdev->dev);
pm_runtime_force_suspend(&pdev->dev);
--
2.51.0
next prev parent reply other threads:[~2026-05-23 8:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 8:30 [PATCH v2 0/4] usb: chipidea: tegra: Add external control option Svyatoslav Ryhel
2026-05-23 8:30 ` [PATCH v2 1/4] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema Svyatoslav Ryhel
2026-05-23 8:30 ` [PATCH v2 2/4] dt-bindings: usb: chipidea,usb2-tegra: Document nvidia,external-control property Svyatoslav Ryhel
2026-05-23 8:30 ` Svyatoslav Ryhel [this message]
2026-05-25 14:43 ` [PATCH v2 3/4] usb: chipidea: tegra: Avoid controller/PHY init if bus is externally controlled Svyatoslav Ryhel
2026-05-28 7:23 ` Peter Chen (CIX)
2026-05-28 11:12 ` Svyatoslav Ryhel
2026-05-23 8:30 ` [PATCH v2 4/4] usb: chipidea: tegra: Expose tegra_usb structure Svyatoslav Ryhel
2026-05-29 14:57 ` [PATCH v2 0/4] usb: chipidea: tegra: Add external control option Svyatoslav Ryhel
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=20260523083013.46372-4-clamor95@gmail.com \
--to=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=peter.chen@kernel.org \
--cc=robh@kernel.org \
--cc=thierry.reding@kernel.org \
--cc=xu.yang_2@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox