summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/console.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/console.c b/common/console.c
index 48586fd2166..22e554cf203 100644
--- a/common/console.c
+++ b/common/console.c
@@ -1212,13 +1212,16 @@ int console_init_r(void)
list_for_each(pos, list) {
dev = list_entry(pos, struct stdio_dev, list);
- if ((dev->flags & DEV_FLAGS_INPUT) && (inputdev == NULL)) {
+ if ((dev->flags & DEV_FLAGS_INPUT) &&
+ (dev->priv == gd->cur_serial_dev || !inputdev))
inputdev = dev;
- }
- if ((dev->flags & DEV_FLAGS_OUTPUT) && (outputdev == NULL)) {
+
+ if ((dev->flags & DEV_FLAGS_OUTPUT) &&
+ (dev->priv == gd->cur_serial_dev || !outputdev))
outputdev = dev;
- }
- if(inputdev && outputdev)
+
+ /* The current serial console is the preferred stdio. */
+ if (dev->priv == gd->cur_serial_dev && inputdev && outputdev)
break;
}