aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-09-05 11:31:20 +0200
committerTom Rini <trini@konsulko.com>2022-09-24 11:34:38 -0400
commit989cc40f806b68678e10203ec3b63d38d0fdd6eb (patch)
treed50599477f4272ec2815939caaea122ae290be90 /cmd
parent78b5243182be8fa222f6d496e7d49675fde4d09e (diff)
downloadu-boot-989cc40f806b68678e10203ec3b63d38d0fdd6eb.zip
u-boot-989cc40f806b68678e10203ec3b63d38d0fdd6eb.tar.gz
u-boot-989cc40f806b68678e10203ec3b63d38d0fdd6eb.tar.bz2
serial: Call flush() before changing baudrate
Changing baudrate is a sensitive operation. To ensure that U-Boot messages printed before changing baudrate are not lost, call new U-Boot console flush() function. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/load.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/load.c b/cmd/load.c
index e44ae0d..5c4f347 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -83,6 +83,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
printf("## Switch baudrate to %d bps and press ENTER ...\n",
load_baudrate);
udelay(50000);
+ flush();
gd->baudrate = load_baudrate;
serial_setbrg();
udelay(50000);
@@ -126,6 +127,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
printf("## Switch baudrate to %d bps and press ESC ...\n",
current_baudrate);
udelay(50000);
+ flush();
gd->baudrate = current_baudrate;
serial_setbrg();
udelay(50000);
@@ -317,6 +319,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
printf("## Switch baudrate to %d bps and press ESC ...\n",
(int)current_baudrate);
udelay(50000);
+ flush();
gd->baudrate = current_baudrate;
serial_setbrg();
udelay(50000);
@@ -471,6 +474,7 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
printf("## Switch baudrate to %d bps and press ENTER ...\n",
load_baudrate);
udelay(50000);
+ flush();
gd->baudrate = load_baudrate;
serial_setbrg();
udelay(50000);
@@ -533,6 +537,7 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
printf("## Switch baudrate to %d bps and press ESC ...\n",
current_baudrate);
udelay(50000);
+ flush();
gd->baudrate = current_baudrate;
serial_setbrg();
udelay(50000);