Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2014 Freescale Semiconductor, Inc.
0004  *
0005  * Author: Jun Li
0006  */
0007 
0008 #ifndef __DRIVERS_USB_CHIPIDEA_OTG_FSM_H
0009 #define __DRIVERS_USB_CHIPIDEA_OTG_FSM_H
0010 
0011 #include <linux/usb/otg-fsm.h>
0012 
0013 /*
0014  *  A-DEVICE timing  constants
0015  */
0016 
0017 /* Wait for VBUS Rise  */
0018 #define TA_WAIT_VRISE        (100)  /* a_wait_vrise: section 7.1.2
0019                      * a_wait_vrise_tmr: section 7.4.5.1
0020                      * TA_VBUS_RISE <= 100ms, section 4.4
0021                      * Table 4-1: Electrical Characteristics
0022                      * ->DC Electrical Timing
0023                      */
0024 /* Wait for VBUS Fall  */
0025 #define TA_WAIT_VFALL        (1000) /* a_wait_vfall: section 7.1.7
0026                      * a_wait_vfall_tmr: section: 7.4.5.2
0027                      */
0028 /* Wait for B-Connect */
0029 #define TA_WAIT_BCON         (10000)    /* a_wait_bcon: section 7.1.3
0030                      * TA_WAIT_BCON: should be between 1100
0031                      * and 30000 ms, section 5.5, Table 5-1
0032                      */
0033 /* A-Idle to B-Disconnect */
0034 #define TA_AIDL_BDIS         (5000) /* a_suspend min 200 ms, section 5.2.1
0035                      * TA_AIDL_BDIS: section 5.5, Table 5-1
0036                      */
0037 /* B-Idle to A-Disconnect */
0038 #define TA_BIDL_ADIS         (500)  /* TA_BIDL_ADIS: section 5.2.1
0039                      * 500ms is used for B switch to host
0040                      * for safe
0041                      */
0042 
0043 /*
0044  * B-device timing constants
0045  */
0046 
0047 /* Data-Line Pulse Time*/
0048 #define TB_DATA_PLS          (10)   /* b_srp_init,continue 5~10ms
0049                      * section:5.1.3
0050                      */
0051 /* SRP Fail Time  */
0052 #define TB_SRP_FAIL          (6000) /* b_srp_init,fail time 5~6s
0053                      * section:5.1.6
0054                      */
0055 /* A-SE0 to B-Reset  */
0056 #define TB_ASE0_BRST         (155)  /* minimum 155 ms, section:5.3.1 */
0057 /* SE0 Time Before SRP */
0058 #define TB_SE0_SRP           (1000) /* b_idle,minimum 1s, section:5.1.2 */
0059 /* SSEND time before SRP */
0060 #define TB_SSEND_SRP         (1500) /* minimum 1.5 sec, section:5.1.2 */
0061 
0062 #define TB_AIDL_BDIS         (20)   /* 4ms ~ 150ms, section 5.2.1 */
0063 
0064 #if IS_ENABLED(CONFIG_USB_OTG_FSM)
0065 
0066 int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
0067 int ci_otg_fsm_work(struct ci_hdrc *ci);
0068 irqreturn_t ci_otg_fsm_irq(struct ci_hdrc *ci);
0069 void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci);
0070 void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci);
0071 
0072 #else
0073 
0074 static inline int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
0075 {
0076     return 0;
0077 }
0078 
0079 static inline int ci_otg_fsm_work(struct ci_hdrc *ci)
0080 {
0081     return -ENXIO;
0082 }
0083 
0084 static inline irqreturn_t ci_otg_fsm_irq(struct ci_hdrc *ci)
0085 {
0086     return IRQ_NONE;
0087 }
0088 
0089 static inline void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci)
0090 {
0091 
0092 }
0093 
0094 static inline void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci)
0095 {
0096 
0097 }
0098 
0099 #endif
0100 
0101 #endif /* __DRIVERS_USB_CHIPIDEA_OTG_FSM_H */