Without this commit, functions such as printf(), puts() stop working
after the console is ready (= after GD_FLG_DEVINIT is set in
console_init_r() function).

The function serial_putc() is called to print a character before the
console is available, while serial_stub_putc() is used on the console.

The cause of the problem is that the error handling of ops->putc
handler is missing from serial_stub_putc(); it should behave
like serial_putc().

Signed-off-by: Masahiro Yamada <[email protected]>
---

 drivers/serial/serial-uclass.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 6dde4ea..163308b 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -127,8 +127,13 @@ void serial_stub_putc(struct stdio_dev *sdev, const char 
ch)
 {
        struct udevice *dev = sdev->priv;
        struct dm_serial_ops *ops = serial_get_ops(dev);
+       int err;
 
-       ops->putc(dev, ch);
+       do {
+               err = ops->putc(cur_dev, ch);
+       } while (err == -EAGAIN);
+       if (ch == '\n')
+               serial_putc('\r');
 }
 
 void serial_stub_puts(struct stdio_dev *sdev, const char *str)
-- 
1.9.1

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to