1
0

930-chipidea-pullup.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --- a/drivers/usb/chipidea/core.c
  2. +++ b/drivers/usb/chipidea/core.c
  3. @@ -827,7 +827,7 @@ static inline void ci_role_destroy(struc
  4. {
  5. ci_hdrc_gadget_destroy(ci);
  6. ci_hdrc_host_destroy(ci);
  7. - if (ci->is_otg && ci->roles[CI_ROLE_GADGET])
  8. + if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET])
  9. ci_hdrc_otg_destroy(ci);
  10. }
  11. @@ -941,6 +941,9 @@ static int ci_hdrc_probe(struct platform
  12. CI_HDRC_SUPPORTS_RUNTIME_PM);
  13. platform_set_drvdata(pdev, ci);
  14. + ci->dp_always_pullup = !!(ci->platdata->flags &
  15. + CI_HDRC_DP_ALWAYS_PULLUP);
  16. +
  17. ret = hw_device_init(ci, base);
  18. if (ret < 0) {
  19. dev_err(dev, "can't initialize hardware\n");
  20. @@ -1029,7 +1032,7 @@ static int ci_hdrc_probe(struct platform
  21. goto deinit_gadget;
  22. }
  23. - if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) {
  24. + if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET]) {
  25. ret = ci_hdrc_otg_init(ci);
  26. if (ret) {
  27. dev_err(dev, "init otg fails, ret = %d\n", ret);
  28. --- a/drivers/usb/chipidea/otg.c
  29. +++ b/drivers/usb/chipidea/otg.c
  30. @@ -131,8 +131,10 @@ enum ci_role ci_otg_role(struct ci_hdrc
  31. void ci_handle_vbus_change(struct ci_hdrc *ci)
  32. {
  33. - if (!ci->is_otg)
  34. + if (ci->dp_always_pullup) {
  35. + usb_gadget_vbus_connect(&ci->gadget);
  36. return;
  37. + }
  38. if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active)
  39. usb_gadget_vbus_connect(&ci->gadget);
  40. --- a/include/linux/usb/chipidea.h
  41. +++ b/include/linux/usb/chipidea.h
  42. @@ -60,6 +60,7 @@ struct ci_hdrc_platform_data {
  43. #define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
  44. #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
  45. #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
  46. +#define CI_HDRC_DP_ALWAYS_PULLUP BIT(14)
  47. enum usb_dr_mode dr_mode;
  48. #define CI_HDRC_CONTROLLER_RESET_EVENT 0
  49. #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
  50. --- a/drivers/usb/chipidea/ci.h
  51. +++ b/drivers/usb/chipidea/ci.h
  52. @@ -260,6 +260,7 @@ struct ci_hdrc {
  53. bool in_lpm;
  54. bool wakeup_int;
  55. enum ci_revision rev;
  56. + bool dp_always_pullup;
  57. struct mutex mutex;
  58. };