[PATCH v12 10/13] usb: chipidea: add wait vbus lower than OTGSC_BSV before role starts
Peter Chen
peter.chen at freescale.com
Thu Jul 11 05:25:36 EDT 2013
On Thu, Jul 11, 2013 at 09:24:56AM +0200, Marc Kleine-Budde wrote:
> On 07/11/2013 08:27 AM, Peter Chen wrote:
> > When the gadget role starts, we need to make sure the vbus is lower
> > than OTGSC_BSV, or there will be an vbus interrupt since we use
> > B_SESSION_VALID as vbus interrupt to indicate connect and disconnect.
> > When the host role starts, it may not be useful to wait vbus to lower
> > than OTGSC_BSV, but it can indicate some hardware problems like the
> > vbus is still higher than OTGSC_BSV after we disconnect to host some
> > time later (500 jiffies currently), which is obvious not correct.
>
> Jiffies ist not constant. I think you have to specify the timeout in
> fractions of HZ. The system ticks with HZ jiffies per second. So a
> timeout of 500ms is "HZ / 2".
Thanks, I will use msecs_to_jiffies.
> > +/**
> > + * hw_wait_reg: wait the register value
> > + *
> > + * Sometimes, it needs to wait register value before going on.
> > + * Eg, when switch to device mode, the vbus value should be lower
> > + * than OTGSC_BSV before connects to host.
> > + *
> > + * @ci: the controller
> > + * @reg: register index
> > + * @mask: mast bit
> > + * @value: the bit value to wait
> > + * @timeout: timeout to indicate an error
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Better: timeout in jiffies
>
As I will use msecs_to_jiffies, @timeout: timeout in millisecond.
Thanks.
--
Best Regards,
Peter Chen
More information about the linux-arm-kernel
mailing list