Li Jun | 57677be | 2014-04-23 15:56:44 +0800 | [diff] [blame] | 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 | |
| 11 | #ifndef __DRIVERS_USB_CHIPIDEA_OTG_FSM_H |
| 12 | #define __DRIVERS_USB_CHIPIDEA_OTG_FSM_H |
| 13 | |
| 14 | #include <linux/usb/otg-fsm.h> |
| 15 | |
Li Jun | 826cfe7 | 2014-04-23 15:56:48 +0800 | [diff] [blame^] | 16 | enum ci_otg_fsm_timer_index { |
| 17 | /* |
| 18 | * CI specific timers, start from the end |
| 19 | * of standard and auxiliary OTG timers |
| 20 | */ |
| 21 | B_DATA_PLS = NUM_OTG_FSM_TIMERS, |
| 22 | B_SSEND_SRP, |
| 23 | B_SESS_VLD, |
| 24 | |
| 25 | NUM_CI_OTG_FSM_TIMERS, |
| 26 | }; |
| 27 | |
| 28 | struct ci_otg_fsm_timer { |
| 29 | unsigned long expires; /* Number of count increase to timeout */ |
| 30 | unsigned long count; /* Tick counter */ |
| 31 | void (*function)(void *, unsigned long); /* Timeout function */ |
| 32 | unsigned long data; /* Data passed to function */ |
| 33 | struct list_head list; |
| 34 | }; |
| 35 | |
| 36 | struct ci_otg_fsm_timer_list { |
| 37 | struct ci_otg_fsm_timer *timer_list[NUM_CI_OTG_FSM_TIMERS]; |
| 38 | struct list_head active_timers; |
| 39 | }; |
| 40 | |
Li Jun | 57677be | 2014-04-23 15:56:44 +0800 | [diff] [blame] | 41 | #ifdef CONFIG_USB_OTG_FSM |
| 42 | |
| 43 | int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci); |
| 44 | |
| 45 | #else |
| 46 | |
| 47 | static inline int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) |
| 48 | { |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | #endif |
| 53 | |
| 54 | #endif /* __DRIVERS_USB_CHIPIDEA_OTG_FSM_H */ |