chipidea.h 2.6 KB

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