0074-ipq806x-usb-Control-USB-master-reset.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From a86bda9f8a7965f0cedd347a9c04800eb9f41ea3 Mon Sep 17 00:00:00 2001
  2. From: Vasudevan Murugesan <[email protected]>
  3. Date: Tue, 21 Jul 2015 10:22:38 +0530
  4. Subject: ipq806x: usb: Control USB master reset
  5. During removal of the glue layer(dwc3-of-simple),
  6. USB master reset is set to active and during insertion
  7. it is de-activated.
  8. Change-Id: I537dc810f6cb2a46664ee674840145066432b957
  9. Signed-off-by: Vasudevan Murugesan <[email protected]>
  10. (cherry picked from commit 4611e13580a216812f85f0801b95442d02eeb836)
  11. ---
  12. drivers/usb/dwc3/dwc3-of-simple.c | 22 ++++++++++++++++++++++
  13. 1 file changed, 12 insertions(+)
  14. (limited to 'drivers/usb/dwc3/dwc3-of-simple.c')
  15. diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
  16. index f9e92ef..49bf556 100644
  17. --- a/drivers/usb/dwc3/dwc3-of-simple.c
  18. +++ b/drivers/usb/dwc3/dwc3-of-simple.c
  19. @@ -26,6 +26,7 @@
  20. #include <linux/dma-mapping.h>
  21. #include <linux/clk.h>
  22. #include <linux/clk-provider.h>
  23. +#include <linux/reset.h>
  24. #include <linux/of.h>
  25. #include <linux/of_platform.h>
  26. #include <linux/pm_runtime.h>
  27. @@ -34,6 +35,8 @@ struct dwc3_of_simple {
  28. struct device *dev;
  29. struct clk **clks;
  30. int num_clocks;
  31. + struct reset_control *mstr_rst_30_0;
  32. + struct reset_control *mstr_rst_30_1;
  33. };
  34. static int dwc3_of_simple_probe(struct platform_device *pdev)
  35. @@ -89,6 +92,20 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
  36. simple->clks[i] = clk;
  37. }
  38. + simple->mstr_rst_30_0 = devm_reset_control_get(dev, "usb30_0_mstr_rst");
  39. +
  40. + if (!IS_ERR(simple->mstr_rst_30_0))
  41. + reset_control_deassert(simple->mstr_rst_30_0);
  42. + else
  43. + dev_dbg(simple->dev, "cannot get handle for USB PHY 0 master reset control\n");
  44. +
  45. + simple->mstr_rst_30_1 = devm_reset_control_get(dev, "usb30_1_mstr_rst");
  46. +
  47. + if (!IS_ERR(simple->mstr_rst_30_1))
  48. + reset_control_deassert(simple->mstr_rst_30_1);
  49. + else
  50. + dev_dbg(simple->dev, "cannot get handle for USB PHY 1 master reset control\n");
  51. +
  52. ret = of_platform_populate(np, NULL, NULL, dev);
  53. if (ret) {
  54. for (i = 0; i < simple->num_clocks; i++) {
  55. @@ -117,6 +134,12 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
  56. clk_put(simple->clks[i]);
  57. }
  58. + if (!IS_ERR(simple->mstr_rst_30_0))
  59. + reset_control_assert(simple->mstr_rst_30_0);
  60. +
  61. + if (!IS_ERR(simple->mstr_rst_30_1))
  62. + reset_control_assert(simple->mstr_rst_30_1);
  63. +
  64. of_platform_depopulate(dev);
  65. pm_runtime_put_sync(dev);
  66. --
  67. cgit v1.1