chipidea.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Platform data for the chipidea USB dual role controller
  3. */
  4. #ifndef __LINUX_USB_CHIPIDEA_H
  5. #define __LINUX_USB_CHIPIDEA_H
  6. #include <linux/extcon.h>
  7. #include <linux/usb/otg.h>
  8. struct ci_hdrc;
  9. /**
  10. * struct ci_hdrc_cable - structure for external connector cable state tracking
  11. * @state: current state of the line
  12. * @changed: set to true when extcon event happen
  13. * @edev: device which generate events
  14. * @ci: driver state of the chipidea device
  15. * @nb: hold event notification callback
  16. * @conn: used for notification registration
  17. */
  18. struct ci_hdrc_cable {
  19. bool state;
  20. bool changed;
  21. struct extcon_dev *edev;
  22. struct ci_hdrc *ci;
  23. struct notifier_block nb;
  24. };
  25. struct ci_hdrc_platform_data {
  26. const char *name;
  27. /* offset of the capability registers */
  28. uintptr_t capoffset;
  29. unsigned power_budget;
  30. struct phy *phy;
  31. /* old usb_phy interface */
  32. struct usb_phy *usb_phy;
  33. enum usb_phy_interface phy_mode;
  34. unsigned long flags;
  35. #define CI_HDRC_REGS_SHARED BIT(0)
  36. #define CI_HDRC_DISABLE_DEVICE_STREAMING BIT(1)
  37. #define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
  38. #define CI_HDRC_DISABLE_HOST_STREAMING BIT(3)
  39. #define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING | \
  40. CI_HDRC_DISABLE_HOST_STREAMING)
  41. /*
  42. * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
  43. * but otg is not supported (no register otgsc).
  44. */
  45. #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
  46. #define CI_HDRC_IMX28_WRITE_FIX BIT(5)
  47. #define CI_HDRC_FORCE_FULLSPEED BIT(6)
  48. #define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
  49. #define CI_HDRC_SET_NON_ZERO_TTHA BIT(8)
  50. #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9)
  51. #define CI_HDRC_OVERRIDE_TX_BURST BIT(10)
  52. #define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
  53. enum usb_dr_mode dr_mode;
  54. #define CI_HDRC_CONTROLLER_RESET_EVENT 0
  55. #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
  56. void (*notify_event) (struct ci_hdrc *ci, unsigned event);
  57. struct regulator *reg_vbus;
  58. struct usb_otg_caps ci_otg_caps;
  59. bool tpl_support;
  60. /* interrupt threshold setting */
  61. u32 itc_setting;
  62. u32 ahb_burst_config;
  63. u32 tx_burst_size;
  64. u32 rx_burst_size;
  65. /* VBUS and ID signal state tracking, using extcon framework */
  66. struct ci_hdrc_cable vbus_extcon;
  67. struct ci_hdrc_cable id_extcon;
  68. u32 phy_clkgate_delay_us;
  69. };
  70. /* Default offset of capability registers */
  71. #define DEF_CAPOFFSET 0x100
  72. /* Add ci hdrc device */
  73. struct platform_device *ci_hdrc_add_device(struct device *dev,
  74. struct resource *res, int nres,
  75. struct ci_hdrc_platform_data *platdata);
  76. /* Remove ci hdrc device */
  77. void ci_hdrc_remove_device(struct platform_device *pdev);
  78. #endif