ns16550: Add WATCHDOG_RESET to putc for short watchdog timeout boards
PATCH v3 1/1 ns16550: Add WATCHDOG_RESET to putc for short watchdog timeout boards
Call watchdog_reset() upon newline. This is done here in putc since the environment code uses a single puts() to print the complete envrironment upon "printenv". So we can't put this watchdog call in puts().
This is needed for boards with a very short watchdog timeout, like the lwmon5 with a 100ms timeout. Without this patch this board resets in the commands with long outputs, like "printenv" or "fdt print".
Note that the image size is not increased with this patch when CONFIG_HW_WATCHDOG or CONFIG_WATCHDOG are not defined since the compiler optimizes this additional code away.
---
v3:
- Only call WATCHDOG_RESET() upon newline
- Remove inclusion of common.h
v2:
- Move declaration and assignment of "count" out of loop as pointed out by Wolfgang (thanks).
drivers/serial/ns16550.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/serial/ns16550.c +9 -0
@@ -70,6 +70,15 @@ void NS16550_putc (NS16550_t com_port, char c) {while ((serial_in (&com_port->lsr) &UART_LSR_THRE ) ==0 );serial_out (c, &com_port->thr); + +/* +* Call watchdog_reset() upon newline. This is done here in putc +* since the environment code uses a single puts() to print the complete +* envrironment upon "printenv". So we can't put this watchdog call +* in puts(). +*/ +if (c =='\n' ) +WATCHDOG_RESET (); }#ifndef CONFIG_NS16550_MIN_FUNCTIONS
Signature · 1 line
1.7.3.1
PATCH v3 1/1 ns16550: Add WATCHDOG_RESET to putc for short watchdog timeout boards
Dear Stefan Roese,
Quoted 12 lines · In message <[email protected]> you wrote:
Call
watchdog_reset()upon newline. This is done here in putc since the environment code uses a singleputs()to print the complete envrironment upon "printenv". So we can't put this watchdog call inputs().This is needed for boards with a very short watchdog timeout, like the lwmon5 with a 100ms timeout. Without this patch this board resets in the commands with long outputs, like "printenv" or "fdt print".
Note that the image size is not increased with this patch when
CONFIG_HW_WATCHDOGorCONFIG_WATCHDOGare not defined since the compiler optimizes this additional code away.
...
drivers/serial/ns16550.c void NS16550_putc (NS16550_t com_port, char c) · line 77
Quoted 5 lines
drivers/serial/ns16550.c +5
-0+ +/* +* Call watchdog_reset() upon newline. This is done here in putc +* since the environment code uses a single puts() to print the complete +* envrironment upon "printenv". So we can't put this watchdog call
--------------^ s/r//
Applied after fixing the typo. Thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
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 ... The prejudices people feel about each other disappear when then get to know each other. -- Kirk, "Elaan of Troyius", stardate 4372.5