[U-Boot] [PATCH] dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts

Lukasz Majewski l.majewski at samsung.com
Tue Mar 17 13:56:38 CET 2015


Hi Heiko,

> Hello Lukasz,
> 
> Am 17.03.2015 10:52, schrieb Lukasz Majewski:
> > Hi Heiko,
> >
> >> trigger watchdog before calling usb_gadget_handle_interrupts()
> >> This prevents board resets when calling dfu command on boards
> >> which have a watchdog.
> >>
> >> Signed-off-by: Heiko Schocher <hs at denx.de>
> >> ---
> >>
> >>   common/cmd_dfu.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> >> index e975abe..46af4cf 100644
> >> --- a/common/cmd_dfu.c
> >> +++ b/common/cmd_dfu.c
> >> @@ -9,6 +9,7 @@
> >>    */
> >>
> >>   #include <common.h>
> >> +#include <watchdog.h>
> >>   #include <dfu.h>
> >>   #include <g_dnl.h>
> >>   #include <usb.h>
> >> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> >> argc, char * const argv[]) if (ctrlc())
> >>   			goto exit;
> >>
> >> +		WATCHDOG_RESET();
> >>   		usb_gadget_handle_interrupts();
> >>   	}
> >>   exit:
> >
> > It seems strange for me, that we must reset watchdog when looping in
> > the dfu.
> 
> Hmm.. maybe I overlook something, but If you look into this while(1)
> loop, there is no trigger of the watchdog ... and if I start the dfu
> command without a USB cable on the board, what triggers the boards
> watchdog?

So the problem is when cable is not attached to the board and you call
dfu command to execute?

> 
> > What is the WATCHDOG interval on the affected board?
> 
> ~5 seconds
> 
> Ah, this is on an at91 board .. and in the
> drivers/serial/atmel_usart.c atmel_serial_tstc() is no
> WATCHDOG_RESET...
> 
> So ctrlc() does not trigger the watchdog

Could you be a bit more specific here. Does your board expect ctrlc()
to update watchdog, so it won't reset?

> 
> bye,
> Heiko



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list