On 07/11/2013 11:25 AM, Peter Chen wrote: > 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. even better. > >>> +/** >>> + * 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. Good idea - you might want to use timeout_ms. 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 |
Attachment:
signature.asc
Description: OpenPGP digital signature