diff options
author | Simon Glass <sjg@chromium.org> | 2014-10-22 21:37:06 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-10-23 19:29:07 -0600 |
commit | 91155c65604904b2048f7ad79d8303eb9a27e351 (patch) | |
tree | 97cdcbde88f61eaa85f88e1f87817391d272239d | |
parent | 11c1a87893a1005180e9609925b35cee241ec88c (diff) | |
download | u-boot-imx-91155c65604904b2048f7ad79d8303eb9a27e351.zip u-boot-imx-91155c65604904b2048f7ad79d8303eb9a27e351.tar.gz u-boot-imx-91155c65604904b2048f7ad79d8303eb9a27e351.tar.bz2 |
dm: serial: Support CONFIG_CONS_INDEX if available
Try to use this option to select the correct uart for the console. This
mimics the behaviour of drivers/serial.c.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
-rw-r--r-- | drivers/serial/serial-uclass.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 1983a3d..c9383dc 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -50,13 +50,22 @@ static void serial_find_console_or_panic(void) } #endif /* + * Try to use CONFIG_CONS_INDEX if available (it is numbered from 1!). + * * Failing that, get the device with sequence number 0, or in extremis * just the first serial device we can find. But we insist on having * a console (even if it is silent). */ - if (uclass_get_device_by_seq(UCLASS_SERIAL, 0, &cur_dev) && +#ifdef CONFIG_CONS_INDEX +#define INDEX (CONFIG_CONS_INDEX - 1) +#else +#define INDEX 0 +#endif + if (uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &cur_dev) && + uclass_get_device(UCLASS_SERIAL, INDEX, &cur_dev) && (uclass_first_device(UCLASS_SERIAL, &cur_dev) || !cur_dev)) panic("No serial driver found"); +#undef INDEX } /* Called prior to relocation */ |