On 01/08/2014 10:06 AM, Li Jun wrote: > Add OTG HNP and SRP operation functions implementation: > - charge vbus > - drive vbus > - connection signaling > - drive sof > - start data pulse > - add fsm timer > - delete fsm timer > - start host > - start gadget > > Signed-off-by: Li Jun <b47...@freescale.com> > --- > drivers/usb/chipidea/bits.h | 11 ++ > drivers/usb/chipidea/otg_fsm.c | 311 > ++++++++++++++++++++++++++++++++++++++++ > drivers/usb/chipidea/otg_fsm.h | 8 + > 3 files changed, 330 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h > index a857131..4347414 100644 > --- a/drivers/usb/chipidea/bits.h > +++ b/drivers/usb/chipidea/bits.h > @@ -44,9 +44,14 @@ > #define DEVICEADDR_USBADR (0x7FUL << 25) > > /* PORTSC */ > +#define PORTSC_CCS BIT(0) > +#define PORTSC_CSC BIT(1) > +#define PORTSC_PEC BIT(3) > +#define PORTSC_OCC BIT(5) > #define PORTSC_FPR BIT(6) > #define PORTSC_SUSP BIT(7) > #define PORTSC_HSP BIT(9) > +#define PORTSC_PP BIT(12) > #define PORTSC_PTC (0x0FUL << 16) > #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) > /* PTS and PTW for non lpm version only */ > @@ -55,6 +60,9 @@ > #define PORTSC_PTW BIT(28) > #define PORTSC_STS BIT(29) > > +#define PORTSC_W1C_BITS \ > + (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC) > + > /* DEVLC */ > #define DEVLC_PSPD (0x03UL << 25) > #define DEVLC_PSPD_HS (0x02UL << 25) > @@ -69,7 +77,10 @@ > #define PTS_HSIC 4 > > /* OTGSC */ > +#define OTGSC_VD BIT(0) > +#define OTGSC_VC BIT(1) > #define OTGSC_IDPU BIT(5) > +#define OTGSC_HADP BIT(6) > #define OTGSC_ID BIT(8) > #define OTGSC_AVV BIT(9) > #define OTGSC_ASV BIT(10) > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > index 1f8907d..31a046d 100644 > --- a/drivers/usb/chipidea/otg_fsm.c > +++ b/drivers/usb/chipidea/otg_fsm.c > @@ -19,12 +19,322 @@ > #include <linux/usb/otg-fsm.h> > #include <linux/usb/gadget.h> > #include <linux/usb/chipidea.h> > +#include <linux/regulator/consumer.h> > > #include "ci.h" > #include "bits.h" > #include "otg.h" > #include "otg_fsm.h" > > +static struct list_head active_timers; > + > +#define HA_DATA_PULSE 1 > + > +/* FSM timers */ > +struct ci_otg_fsm_timer *a_wait_vrise_tmr, *a_wait_vfall_tmr, > *a_wait_bcon_tmr, > + *a_aidl_bdis_tmr, *a_bidl_adis_tmr, *b_ase0_brst_tmr, > + *b_se0_srp_tmr, *b_srp_fail_tmr, *b_data_pulse_tmr;
IIRC the USB spec says there is only one OTG port per machine, but I think you shouldn't add new code that uses so many global variables, better embed these into a per device struct. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
signature.asc
Description: OpenPGP digital signature