After the env is relocated, make sure that the serial baudrate is
applied in case it's different (such as the env_nand case).

Signed-off-by: Joe Hershberger <joe.hershber...@ni.com>
---
 common/env_common.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/common/env_common.c b/common/env_common.c
index 0c7e845..e58971d 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -232,6 +232,10 @@ int env_import(const char *buf, int check)
 
 void env_relocate(void)
 {
+#ifdef CONFIG_BAUDRATE_UPDATE_ON_RELOC
+       const char *baudrate_str;
+#endif
+
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
        env_reloc();
 #endif
@@ -253,6 +257,21 @@ void env_relocate(void)
        else
                gd->flags &= ~GD_FLG_SILENT;
 #endif
+
+#ifdef CONFIG_BAUDRATE_UPDATE_ON_RELOC
+       baudrate_str = getenv("baudrate");
+       if (baudrate_str != NULL) {
+               int baudrate = simple_strtoul(baudrate_str, NULL, 10);
+
+               if (baudrate != gd->baudrate) {
+                       gd->baudrate = baudrate;
+#if defined(CONFIG_PPC) || defined(CONFIG_MCF52x2)
+                       gd->bd->bi_baudrate = baudrate;
+#endif
+                       serial_setbrg();
+               }
+       }
+#endif
 }
 
 #ifdef CONFIG_AUTO_COMPLETE
-- 
1.7.11.5

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to