[U-Boot] [PATCH 1/7] dm: serial: fix a bug of console putc
Masahiro Yamada
yamada.m at jp.panasonic.com
Wed Oct 22 11:13:56 CEST 2014
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 <yamada.m at jp.panasonic.com>
---
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
More information about the U-Boot
mailing list