From: Bjorn Andersson <bjorn.andersson@oss.qualcomm.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>,
Felipe Balbi <balbi@kernel.org>,
Wesley Cheng <quic_wcheng@quicinc.com>,
Saravana Kannan <saravanak@google.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Frank Li <Frank.li@nxp.com>
Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Subject: [PATCH v4 3/7] usb: dwc3: core: Don't touch resets and clocks
Date: Wed, 26 Feb 2025 16:17:50 -0800 [thread overview]
Message-ID: <20250226-dwc3-refactor-v4-3-4415e7111e49@oss.qualcomm.com> (raw)
In-Reply-To: <20250226-dwc3-refactor-v4-0-4415e7111e49@oss.qualcomm.com>
When the core is integrated with glue, it's reasonable to assume that
the glue driver will have to touch the IP before/after the core takes
the hardware out and into reset. As such the glue must own these
resources and be allowed to turn them on/off outside the core's
handling.
Allow the platform or glue layer to indicate if the core logic for
clocks and resets should be skipped to deal with this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
---
drivers/usb/dwc3/core.c | 19 +++++++++++--------
drivers/usb/dwc3/glue.h | 1 +
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index d9f0a6782d36..aecdde8dc999 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -2187,15 +2187,17 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
if (IS_ERR(dwc->usb_psy))
return dev_err_probe(dev, PTR_ERR(dwc->usb_psy), "couldn't get usb power supply\n");
- dwc->reset = devm_reset_control_array_get_optional_shared(dev);
- if (IS_ERR(dwc->reset)) {
- ret = PTR_ERR(dwc->reset);
- goto err_put_psy;
- }
+ if (!data->ignore_clocks_and_resets) {
+ dwc->reset = devm_reset_control_array_get_optional_shared(dev);
+ if (IS_ERR(dwc->reset)) {
+ ret = PTR_ERR(dwc->reset);
+ goto err_put_psy;
+ }
- ret = dwc3_get_clocks(dwc);
- if (ret)
- goto err_put_psy;
+ ret = dwc3_get_clocks(dwc);
+ if (ret)
+ goto err_put_psy;
+ }
ret = reset_control_deassert(dwc->reset);
if (ret)
@@ -2328,6 +2330,7 @@ static int dwc3_probe(struct platform_device *pdev)
probe_data.dwc = dwc;
probe_data.res = res;
+ probe_data.ignore_clocks_and_resets = false;
return dwc3_core_probe(&probe_data);
}
diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
index e73cfc466012..1ddb451bdbd0 100644
--- a/drivers/usb/dwc3/glue.h
+++ b/drivers/usb/dwc3/glue.h
@@ -17,6 +17,7 @@
struct dwc3_probe_data {
struct dwc3 *dwc;
struct resource *res;
+ bool ignore_clocks_and_resets;
};
int dwc3_core_probe(const struct dwc3_probe_data *data);
--
2.45.2
next prev parent reply other threads:[~2025-02-27 0:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 0:17 [PATCH v4 0/7] usb: dwc3: qcom: Flatten dwc3 structure Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 1/7] dt-bindings: usb: Introduce qcom,snps-dwc3 Bjorn Andersson
2025-02-28 22:36 ` Rob Herring
2025-03-03 22:11 ` Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 2/7] usb: dwc3: core: Expose core driver as library Bjorn Andersson
2025-02-27 19:17 ` Frank Li
2025-02-27 0:17 ` Bjorn Andersson [this message]
2025-02-27 4:24 ` [PATCH v4 3/7] usb: dwc3: core: Don't touch resets and clocks Dmitry Baryshkov
2025-02-27 15:55 ` Bjorn Andersson
2025-02-27 16:07 ` Dmitry Baryshkov
2025-02-27 19:22 ` Frank Li
2025-02-27 0:17 ` [PATCH v4 4/7] usb: dwc3: qcom: Don't rely on drvdata during probe Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 5/7] usb: dwc3: qcom: Snapshot driver for backwards compatibilty Bjorn Andersson
2025-03-04 0:05 ` Thinh Nguyen
2025-03-04 0:39 ` Thinh Nguyen
2025-03-04 3:13 ` Bjorn Andersson
2025-03-05 0:31 ` Thinh Nguyen
2025-03-06 22:49 ` Bjorn Andersson
2025-03-07 16:17 ` Frank Li
2025-03-07 23:00 ` Thinh Nguyen
2025-03-07 23:16 ` Thinh Nguyen
2025-03-11 3:06 ` Bjorn Andersson
2025-03-11 23:59 ` Thinh Nguyen
2025-02-27 0:17 ` [PATCH v4 6/7] usb: dwc3: qcom: Transition to flattened model Bjorn Andersson
2025-03-07 6:41 ` Dmitry Baryshkov
2025-03-11 2:46 ` Bjorn Andersson
2025-03-11 19:02 ` Dmitry Baryshkov
2025-03-18 19:12 ` Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 7/7] arm64: dts: qcom: sc8280x: Flatten the USB nodes Bjorn Andersson
2025-03-08 17:58 ` Konrad Dybcio
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=20250226-dwc3-refactor-v4-3-4415e7111e49@oss.qualcomm.com \
--to=bjorn.andersson@oss.qualcomm.com \
--cc=Frank.li@nxp.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=andersson@kernel.org \
--cc=balbi@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_wcheng@quicinc.com \
--cc=robh@kernel.org \
--cc=saravanak@google.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;
as well as URLs for NNTP newsgroup(s).