stm32mp: stm32prog: reactivate console and display serial error
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Thu, 25 Feb 2021 12:37:02 +0000 (13:37 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Thu, 11 Mar 2021 16:41:17 +0000 (17:41 +0100)
When serial instance is not found in device tree, the console
should be enabled and the error should be indicated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
arch/arm/mach-stm32mp/cpu.c

index a453f89..527b629 100644 (file)
@@ -476,11 +476,17 @@ static void setup_boot_mode(void)
                        break;
                /* serial : search associated alias in devicetree */
                sprintf(cmd, "serial@%x", serial_addr[instance]);
-               if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev))
-                       break;
-               if (fdtdec_get_alias_seq(gd->fdt_blob, "serial",
-                                        dev_of_offset(dev), &alias))
+               if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev) ||
+                   fdtdec_get_alias_seq(gd->fdt_blob, "serial",
+                                        dev_of_offset(dev), &alias)) {
+                       /* restore console on error */
+                       if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL))
+                               gd->flags &= ~(GD_FLG_SILENT |
+                                              GD_FLG_DISABLE_CONSOLE);
+                       printf("serial%d = %s not found in device tree!\n",
+                              instance, cmd);
                        break;
+               }
                sprintf(cmd, "%d", alias);
                env_set("boot_device", "serial");
                env_set("boot_instance", cmd);