930-chipidea-pullup.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --- a/drivers/usb/chipidea/ci.h
  2. +++ b/drivers/usb/chipidea/ci.h
  3. @@ -205,6 +205,7 @@ struct hw_bank {
  4. * @in_lpm: if the core in low power mode
  5. * @wakeup_int: if wakeup interrupt occur
  6. * @rev: The revision number for controller
  7. + * @dp_always_pullup: keep dp always pullup at device mode
  8. */
  9. struct ci_hdrc {
  10. struct device *dev;
  11. @@ -259,6 +260,7 @@ struct ci_hdrc {
  12. bool in_lpm;
  13. bool wakeup_int;
  14. enum ci_revision rev;
  15. + bool dp_always_pullup;
  16. };
  17. static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
  18. --- a/drivers/usb/chipidea/core.c
  19. +++ b/drivers/usb/chipidea/core.c
  20. @@ -818,7 +818,7 @@ static inline void ci_role_destroy(struc
  21. {
  22. ci_hdrc_gadget_destroy(ci);
  23. ci_hdrc_host_destroy(ci);
  24. - if (ci->is_otg && ci->roles[CI_ROLE_GADGET])
  25. + if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET])
  26. ci_hdrc_otg_destroy(ci);
  27. }
  28. @@ -923,6 +923,9 @@ static int ci_hdrc_probe(struct platform
  29. CI_HDRC_SUPPORTS_RUNTIME_PM);
  30. platform_set_drvdata(pdev, ci);
  31. + ci->dp_always_pullup = !!(ci->platdata->flags &
  32. + CI_HDRC_DP_ALWAYS_PULLUP);
  33. +
  34. ret = hw_device_init(ci, base);
  35. if (ret < 0) {
  36. dev_err(dev, "can't initialize hardware\n");
  37. @@ -1011,7 +1014,7 @@ static int ci_hdrc_probe(struct platform
  38. goto deinit_gadget;
  39. }
  40. - if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) {
  41. + if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET]) {
  42. ret = ci_hdrc_otg_init(ci);
  43. if (ret) {
  44. dev_err(dev, "init otg fails, ret = %d\n", ret);
  45. --- a/drivers/usb/chipidea/otg.c
  46. +++ b/drivers/usb/chipidea/otg.c
  47. @@ -131,8 +131,10 @@ enum ci_role ci_otg_role(struct ci_hdrc
  48. void ci_handle_vbus_change(struct ci_hdrc *ci)
  49. {
  50. - if (!ci->is_otg)
  51. + if (ci->dp_always_pullup) {
  52. + usb_gadget_vbus_connect(&ci->gadget);
  53. return;
  54. + }
  55. if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active)
  56. usb_gadget_vbus_connect(&ci->gadget);
  57. --- a/include/linux/usb/chipidea.h
  58. +++ b/include/linux/usb/chipidea.h
  59. @@ -60,6 +60,7 @@ struct ci_hdrc_platform_data {
  60. #define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
  61. #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
  62. #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
  63. +#define CI_HDRC_DP_ALWAYS_PULLUP BIT(14)
  64. enum usb_dr_mode dr_mode;
  65. #define CI_HDRC_CONTROLLER_RESET_EVENT 0
  66. #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1