otg_fsm.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2014 Freescale Semiconductor, Inc.
  4. *
  5. * Author: Jun Li
  6. */
  7. #ifndef __DRIVERS_USB_CHIPIDEA_OTG_FSM_H
  8. #define __DRIVERS_USB_CHIPIDEA_OTG_FSM_H
  9. #include <linux/usb/otg-fsm.h>
  10. /*
  11. * A-DEVICE timing constants
  12. */
  13. /* Wait for VBUS Rise */
  14. #define TA_WAIT_VRISE (100) /* a_wait_vrise: section 7.1.2
  15. * a_wait_vrise_tmr: section 7.4.5.1
  16. * TA_VBUS_RISE <= 100ms, section 4.4
  17. * Table 4-1: Electrical Characteristics
  18. * ->DC Electrical Timing
  19. */
  20. /* Wait for VBUS Fall */
  21. #define TA_WAIT_VFALL (1000) /* a_wait_vfall: section 7.1.7
  22. * a_wait_vfall_tmr: section: 7.4.5.2
  23. */
  24. /* Wait for B-Connect */
  25. #define TA_WAIT_BCON (10000) /* a_wait_bcon: section 7.1.3
  26. * TA_WAIT_BCON: should be between 1100
  27. * and 30000 ms, section 5.5, Table 5-1
  28. */
  29. /* A-Idle to B-Disconnect */
  30. #define TA_AIDL_BDIS (5000) /* a_suspend min 200 ms, section 5.2.1
  31. * TA_AIDL_BDIS: section 5.5, Table 5-1
  32. */
  33. /* B-Idle to A-Disconnect */
  34. #define TA_BIDL_ADIS (500) /* TA_BIDL_ADIS: section 5.2.1
  35. * 500ms is used for B switch to host
  36. * for safe
  37. */
  38. /*
  39. * B-device timing constants
  40. */
  41. /* Data-Line Pulse Time*/
  42. #define TB_DATA_PLS (10) /* b_srp_init,continue 5~10ms
  43. * section:5.1.3
  44. */
  45. /* SRP Fail Time */
  46. #define TB_SRP_FAIL (6000) /* b_srp_init,fail time 5~6s
  47. * section:5.1.6
  48. */
  49. /* A-SE0 to B-Reset */
  50. #define TB_ASE0_BRST (155) /* minimum 155 ms, section:5.3.1 */
  51. /* SE0 Time Before SRP */
  52. #define TB_SE0_SRP (1000) /* b_idle,minimum 1s, section:5.1.2 */
  53. /* SSEND time before SRP */
  54. #define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */
  55. #define TB_AIDL_BDIS (20) /* 4ms ~ 150ms, section 5.2.1 */
  56. #if IS_ENABLED(CONFIG_USB_OTG_FSM)
  57. int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
  58. int ci_otg_fsm_work(struct ci_hdrc *ci);
  59. irqreturn_t ci_otg_fsm_irq(struct ci_hdrc *ci);
  60. void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci);
  61. void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci);
  62. #else
  63. static inline int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
  64. {
  65. return 0;
  66. }
  67. static inline int ci_otg_fsm_work(struct ci_hdrc *ci)
  68. {
  69. return -ENXIO;
  70. }
  71. static inline irqreturn_t ci_otg_fsm_irq(struct ci_hdrc *ci)
  72. {
  73. return IRQ_NONE;
  74. }
  75. static inline void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci)
  76. {
  77. }
  78. static inline void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci)
  79. {
  80. }
  81. #endif
  82. #endif /* __DRIVERS_USB_CHIPIDEA_OTG_FSM_H */