diff options
author | Dinh Nguyen <dinguyen@opensource.altera.com> | 2016-08-10 09:53:34 -0400 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-22 03:45:11 -0400 |
commit | 83f8da562f8b5275fa1095b45762996971f7c607 (patch) | |
tree | 399f737f771099fa70ae01755d835d04894cbb29 | |
parent | b74c2d875baaa07186f617c5617f4c5e3a8a41ad (diff) |
usb: dwc2: Add reset control to dwc2
Allow for platforms that have a reset controller driver in place to bring
the USB IP out of reset.
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r-- | drivers/usb/dwc2/core.h | 1 | ||||
-rw-r--r-- | drivers/usb/dwc2/platform.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 9fae0291cd69..d64551243789 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
@@ -868,6 +868,7 @@ struct dwc2_hsotg { | |||
868 | void *priv; | 868 | void *priv; |
869 | int irq; | 869 | int irq; |
870 | struct clk *clk; | 870 | struct clk *clk; |
871 | struct reset_control *reset; | ||
871 | 872 | ||
872 | unsigned int queuing_high_bandwidth:1; | 873 | unsigned int queuing_high_bandwidth:1; |
873 | unsigned int srp_success:1; | 874 | unsigned int srp_success:1; |
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index fc6f5251de5d..530959a8a6d1 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/platform_device.h> | 45 | #include <linux/platform_device.h> |
46 | #include <linux/phy/phy.h> | 46 | #include <linux/phy/phy.h> |
47 | #include <linux/platform_data/s3c-hsotg.h> | 47 | #include <linux/platform_data/s3c-hsotg.h> |
48 | #include <linux/reset.h> | ||
48 | 49 | ||
49 | #include <linux/usb/of.h> | 50 | #include <linux/usb/of.h> |
50 | 51 | ||
@@ -337,6 +338,24 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) | |||
337 | { | 338 | { |
338 | int i, ret; | 339 | int i, ret; |
339 | 340 | ||
341 | hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2"); | ||
342 | if (IS_ERR(hsotg->reset)) { | ||
343 | ret = PTR_ERR(hsotg->reset); | ||
344 | switch (ret) { | ||
345 | case -ENOENT: | ||
346 | case -ENOTSUPP: | ||
347 | hsotg->reset = NULL; | ||
348 | break; | ||
349 | default: | ||
350 | dev_err(hsotg->dev, "error getting reset control %d\n", | ||
351 | ret); | ||
352 | return ret; | ||
353 | } | ||
354 | } | ||
355 | |||
356 | if (hsotg->reset) | ||
357 | reset_control_deassert(hsotg->reset); | ||
358 | |||
340 | /* Set default UTMI width */ | 359 | /* Set default UTMI width */ |
341 | hsotg->phyif = GUSBCFG_PHYIF16; | 360 | hsotg->phyif = GUSBCFG_PHYIF16; |
342 | 361 | ||
@@ -434,6 +453,9 @@ static int dwc2_driver_remove(struct platform_device *dev) | |||
434 | if (hsotg->ll_hw_enabled) | 453 | if (hsotg->ll_hw_enabled) |
435 | dwc2_lowlevel_hw_disable(hsotg); | 454 | dwc2_lowlevel_hw_disable(hsotg); |
436 | 455 | ||
456 | if (hsotg->reset) | ||
457 | reset_control_assert(hsotg->reset); | ||
458 | |||
437 | return 0; | 459 | return 0; |
438 | } | 460 | } |
439 | 461 | ||