112-add-support-for-vbus-control-with-phy.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
  2. +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
  3. @@ -33,6 +33,7 @@ static const struct ci_hdrc_platform_dat
  4. static struct ci_hdrc_platform_data ci_zynq_pdata = {
  5. .capoffset = DEF_CAPOFFSET,
  6. + .flags = CI_HDRC_PHY_VBUS_CONTROL,
  7. };
  8. static const struct of_device_id ci_hdrc_usb2_of_match[] = {
  9. --- a/drivers/usb/chipidea/host.c
  10. +++ b/drivers/usb/chipidea/host.c
  11. @@ -66,6 +66,14 @@ static int ehci_ci_portpower(struct usb_
  12. }
  13. }
  14. + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
  15. + ci->usb_phy && ci->usb_phy->set_vbus) {
  16. + if (enable)
  17. + ci->usb_phy->set_vbus(ci->usb_phy, 1);
  18. + else
  19. + ci->usb_phy->set_vbus(ci->usb_phy, 0);
  20. + }
  21. +
  22. if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
  23. /*
  24. * Marvell 28nm HSIC PHY requires forcing the port to HS mode.
  25. --- a/drivers/usb/chipidea/otg_fsm.c
  26. +++ b/drivers/usb/chipidea/otg_fsm.c
  27. @@ -456,6 +456,11 @@ static void ci_otg_drv_vbus(struct otg_f
  28. return;
  29. }
  30. }
  31. +
  32. + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
  33. + ci->usb_phy && ci->usb_phy->set_vbus)
  34. + ci->usb_phy->set_vbus(ci->usb_phy, 1);
  35. +
  36. /* Disable data pulse irq */
  37. hw_write_otgsc(ci, OTGSC_DPIE, 0);
  38. @@ -465,6 +470,10 @@ static void ci_otg_drv_vbus(struct otg_f
  39. if (ci->platdata->reg_vbus)
  40. regulator_disable(ci->platdata->reg_vbus);
  41. + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
  42. + ci->usb_phy && ci->usb_phy->set_vbus)
  43. + ci->usb_phy->set_vbus(ci->usb_phy, 0);
  44. +
  45. fsm->a_bus_drop = 1;
  46. fsm->a_bus_req = 0;
  47. }
  48. --- a/include/linux/usb/chipidea.h
  49. +++ b/include/linux/usb/chipidea.h
  50. @@ -55,6 +55,7 @@ struct ci_hdrc_platform_data {
  51. #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9)
  52. #define CI_HDRC_OVERRIDE_TX_BURST BIT(10)
  53. #define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
  54. +#define CI_HDRC_PHY_VBUS_CONTROL BIT(12)
  55. enum usb_dr_mode dr_mode;
  56. #define CI_HDRC_CONTROLLER_RESET_EVENT 0
  57. #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1