Patchwork [U-Boot,IXP42x,series,v4,03/17] trigger hardware watchdog in IXP42x serial driver

login
register
mail settings
Submitter Michael Schwingen
Date April 6, 2011, 9:49 p.m.
Message ID <1302126558-1318-4-git-send-email-michael@schwingen.org>
Download mbox | patch
Permalink /patch/90078/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Michael Schwingen - April 6, 2011, 9:49 p.m.
Signed-off-by: Michael Schwingen <michael@schwingen.org>
---
Changes for V2:

Changes for V3:
 - coding style fixes
Changes for V4:
 - add changelog

 drivers/serial/serial_ixp.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Marek Vasut - May 20, 2011, 11:54 p.m.
On Wednesday, April 06, 2011 11:49:04 PM Michael Schwingen wrote:
> Signed-off-by: Michael Schwingen <michael@schwingen.org>
> ---
> Changes for V2:
> 
> Changes for V3:
>  - coding style fixes
> Changes for V4:
>  - add changelog
> 
>  drivers/serial/serial_ixp.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
> index dd26af4..a9acd47 100644
> --- a/drivers/serial/serial_ixp.c
> +++ b/drivers/serial/serial_ixp.c
> @@ -30,6 +30,7 @@
> 
>  #include <common.h>
>  #include <asm/arch/ixp425.h>
> +#include <watchdog.h>
> 
>  /*
>   *               14.7456 MHz
> @@ -85,7 +86,8 @@ int serial_init (void)
>  void serial_putc (const char c)
>  {
>  	/* wait for room in the tx FIFO on UART */
> -	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0);
> +	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0)
> +		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
> 
>  	THR(CONFIG_SYS_IXP425_CONSOLE) = c;
> 
> @@ -111,7 +113,8 @@ int serial_tstc (void)
>   */
>  int serial_getc (void)
>  {
> -	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR));
> +	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR))
> +		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
> 
>  	return (char) RBR(CONFIG_SYS_IXP425_CONSOLE) & 0xff;
>  }

Please recheck for line-too-long here, but it might be just lack of sleep. 
Otherwise:

Acked-by: Marek Vasut <marek.vasut@gmail.com>

Patch

diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index dd26af4..a9acd47 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -30,6 +30,7 @@ 
 
 #include <common.h>
 #include <asm/arch/ixp425.h>
+#include <watchdog.h>
 
 /*
  *               14.7456 MHz
@@ -85,7 +86,8 @@  int serial_init (void)
 void serial_putc (const char c)
 {
 	/* wait for room in the tx FIFO on UART */
-	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0);
+	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0)
+		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
 
 	THR(CONFIG_SYS_IXP425_CONSOLE) = c;
 
@@ -111,7 +113,8 @@  int serial_tstc (void)
  */
 int serial_getc (void)
 {
-	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR));
+	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR))
+		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
 
 	return (char) RBR(CONFIG_SYS_IXP425_CONSOLE) & 0xff;
 }