summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-10-22 21:37:02 -0600
committerSimon Glass <sjg@chromium.org>2014-10-23 19:29:07 -0600
commitc487fd476c8779dbd6ee1427489f1312b34bfc5e (patch)
tree49211e4c6df93f064408ef73a4978bd780d70fe6 /drivers/serial
parentfe1ef503381c4c03c059de3324271ce21cae3078 (diff)
downloadu-boot-imx-c487fd476c8779dbd6ee1427489f1312b34bfc5e.zip
u-boot-imx-c487fd476c8779dbd6ee1427489f1312b34bfc5e.tar.gz
u-boot-imx-c487fd476c8779dbd6ee1427489f1312b34bfc5e.tar.bz2
dm: serial: Reset the watchdog while waiting in getc()
We have moved the busy-wait loop out of drivers and into the uclass. This means that we must reset the watchdog when busy-waiting. Note: some drivers may still have a busy-wait even with driver model, as a transition mechanism. Driver model will tolerate this, and is can be cleaned up when all users of the driver use driver model. An example is ns16550. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial-uclass.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 1a75950..1983a3d 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -11,9 +11,12 @@
#include <os.h>
#include <serial.h>
#include <stdio_dev.h>
+#include <watchdog.h>
#include <dm/lists.h>
#include <dm/device-internal.h>
+#include <ns16550.h>
+
DECLARE_GLOBAL_DATA_PTR;
/* The currently-selected console serial device */
@@ -119,6 +122,8 @@ static int serial_getc_dev(struct udevice *dev)
do {
err = ops->getc(dev);
+ if (err == -EAGAIN)
+ WATCHDOG_RESET();
} while (err == -EAGAIN);
return err >= 0 ? err : 0;