[PATCH v3 09/12] usb: dwc3: core: Don't touch resets and clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux