[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250113-dwc3-refactor-v3-9-d1722075df7b@oss.qualcomm.com>
Date: Mon, 13 Jan 2025 21:11:42 -0800
From: Bjorn Andersson <bjorn.andersson@....qualcomm.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Felipe Balbi <balbi@...nel.org>,
Wesley Cheng <quic_wcheng@...cinc.com>,
Saravana Kannan <saravanak@...gle.com>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Frank Li <Frank.li@....com>
Cc: linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Bjorn Andersson <bjorn.andersson@....qualcomm.com>
Subject: [PATCH v3 09/12] usb: dwc3: core: Don't touch resets and clocks
When the core is integrated with glue, it's expected that the glue IP
will require, and hence handle, the clocks and resets of the IP-block.
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@....qualcomm.com>
---
drivers/usb/dwc3/core.c | 22 ++++++++++++----------
drivers/usb/dwc3/glue.h | 2 +-
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 930d812a9fbb..c0b2398b8c18 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -2130,7 +2130,7 @@ static int dwc3_get_num_ports(struct dwc3 *dwc)
return 0;
}
-int dwc3_init(struct dwc3 *dwc, struct resource *res)
+int dwc3_init(struct dwc3 *dwc, struct resource *res, bool ignore_clocks_and_resets)
{
struct device *dev = dwc->dev;
struct resource dwc_res;
@@ -2173,15 +2173,17 @@ int dwc3_init(struct dwc3 *dwc, struct resource *res)
dwc3_get_software_properties(dwc);
- 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 (!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)
@@ -2311,7 +2313,7 @@ static int dwc3_probe(struct platform_device *pdev)
dwc->dev = &pdev->dev;
- return dwc3_init(dwc, res);
+ return dwc3_init(dwc, res, false);
}
void dwc3_uninit(struct dwc3 *dwc)
diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
index f6a513e43f53..ac87491bfdeb 100644
--- a/drivers/usb/dwc3/glue.h
+++ b/drivers/usb/dwc3/glue.h
@@ -9,7 +9,7 @@
#include <linux/types.h>
#include "core.h"
-int dwc3_init(struct dwc3 *dwc, struct resource *res);
+int dwc3_init(struct dwc3 *dwc, struct resource *res, bool ignore_clocks_and_resets);
void dwc3_uninit(struct dwc3 *dwc);
int dwc3_runtime_suspend(struct dwc3 *dwc);
--
2.45.2
Powered by blists - more mailing lists