From f7f9d63eac12b345d6243d1d608b7944a05be921 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Tue, 31 Mar 2009 12:32:12 -0700 Subject: musb: otg timer cleanup Minor cleanup of OTG timer handling: * unify decls for OTG time constants, in the core header * set up and use that timer in a more normal way * move to the driver struct, so it's usable outside core And tighten use and setup of T(a_wait_bcon) so that if it's used, it's always valid. (If that timer expires, the A-device will stop powering VBUS. For non-OTG systems, that will be a surprise.) No behavioral changes, other than more consistency when applying that core HNP timeout. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_core.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'drivers/usb/musb/musb_core.h') diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 2b49c989f04..78116fdb578 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -180,10 +181,15 @@ enum musb_g_ep0_state { MUSB_EP0_STAGE_ACKWAIT, /* after zlp, before statusin */ } __attribute__ ((packed)); -/* OTG protocol constants */ +/* + * OTG protocol constants. See USB OTG 1.3 spec, + * sections 5.5 "Device Timings" and 6.6.5 "Timers". + */ #define OTG_TIME_A_WAIT_VRISE 100 /* msec (max) */ -#define OTG_TIME_A_WAIT_BCON 0 /* 0=infinite; min 1000 msec */ -#define OTG_TIME_A_IDLE_BDIS 200 /* msec (min) */ +#define OTG_TIME_A_WAIT_BCON 1100 /* min 1 second */ +#define OTG_TIME_A_AIDL_BDIS 200 /* min 200 msec */ +#define OTG_TIME_B_ASE0_BRST 100 /* min 3.125 ms */ + /*************************** REGISTER ACCESS ********************************/ @@ -332,6 +338,8 @@ struct musb { struct list_head control; /* of musb_qh */ struct list_head in_bulk; /* of musb_qh */ struct list_head out_bulk; /* of musb_qh */ + + struct timer_list otg_timer; #endif /* called with IRQs blocked; ON/nonzero implies starting a session, -- cgit v1.2.3