diff options
author | Tom Rini <trini@konsulko.com> | 2015-08-10 10:06:07 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-08-10 10:06:07 -0400 |
commit | e2c1c5bae619d2e87505de99f907a26237640bc9 (patch) | |
tree | 9dd97639a0c868888f03afa969185df6c4780ab1 /drivers/serial/serial-uclass.c | |
parent | 15f8876b1dd95dd6bcee686ada36369871bbcdc9 (diff) | |
parent | 8c4585881de51e8c9a8b2207bb2fab1cd83728b8 (diff) |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'drivers/serial/serial-uclass.c')
-rw-r--r-- | drivers/serial/serial-uclass.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index bbc366b322..2a496979bc 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -78,7 +78,9 @@ static void serial_find_console_or_panic(void) #undef INDEX } +#ifdef CONFIG_REQUIRE_SERIAL_CONSOLE panic_str("No serial driver found"); +#endif } /* Called prior to relocation */ @@ -140,28 +142,40 @@ static int _serial_tstc(struct udevice *dev) void serial_putc(char ch) { - _serial_putc(gd->cur_serial_dev, ch); + if (gd->cur_serial_dev) + _serial_putc(gd->cur_serial_dev, ch); } void serial_puts(const char *str) { - _serial_puts(gd->cur_serial_dev, str); + if (gd->cur_serial_dev) + _serial_puts(gd->cur_serial_dev, str); } int serial_getc(void) { + if (!gd->cur_serial_dev) + return 0; + return _serial_getc(gd->cur_serial_dev); } int serial_tstc(void) { + if (!gd->cur_serial_dev) + return 0; + return _serial_tstc(gd->cur_serial_dev); } void serial_setbrg(void) { - struct dm_serial_ops *ops = serial_get_ops(gd->cur_serial_dev); + struct dm_serial_ops *ops; + + if (!gd->cur_serial_dev) + return; + ops = serial_get_ops(gd->cur_serial_dev); if (ops->setbrg) ops->setbrg(gd->cur_serial_dev, gd->baudrate); } |