[U-Boot] [PATCH 1/2]: common: Add a watchdog CLI command
Wolfgang Denk
wd at denx.de
Wed Oct 28 16:56:09 CET 2009
Dear Simon Kagstrom,
In message <20091028154925.1dd1a8a9 at marrow.netinsight.se> you wrote:
>
> > Can we check for some error code here from lower layer and dump some error message?
> > For ex. Specified timeout value may be invalid for specific h/w
>
> We could, but I'd like to keep the interface simple. Basically: tell
Well, but error checking and sending respective information to the
user is essential.
> the hardware driver to enable the watchdog "as good as possible", and
> then the hardware will enable a watchdog that will timeout "sometime".
Um... No. This sounds horrible to me.
The driver should do _exactly_ what the user asks for, or raise an
error.
> This is hardly an end-user issue anyway: he/she will test the board
> properly to find a good timeout value anyway, and I believe the
> interface can be kept simple. I just like it since it makes it simple
> to enable the watchdog where you like it in boot scripts etc.
Well, if you have anything on your board which is actually worth the
name watchdog then this whole command will be moot.
A _real_ watchdog is automatically active after reset, and cannot be
disabled by any software.
A somewhat reasonable watchdog can be configured exactly once (for
example, the MPC8xx processors use a write-once register for this
purpose).
A "watchdog" that can be disabled by software is just a toy and
neither worth the money nor the effort ;-)
> > > +#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
> > > +extern void watchdog_enable(unsigned int timeout_secs);
> > > +
> > > +extern void watchdog_disable(void);
> > > +#else
> > > +static inline void watchdog_enable(unsigned int timeout_secs) { }
> > > +static inline void watchdog_disable(void) { }
> > > +#endif
> > > +
> >
> > What does this means?
>
> It was just a way of making the interface calls valid (but empty) if
> the watchdog support isn't there. The idea is to avoid #ifdefs in the
> code (like for WATCHDOG_RESET).
Please use weak functions for this purpose.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Anyone who doesn't believe in miracles is not a realist.
- David Ben Gurion
More information about the U-Boot
mailing list