otg_fsm.h 2.5 KB

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