Message ID | 20210225133652.3.Ief81f05149ac2a0801badd2baadb49387c0e0fcb@changeid |
---|---|
State | Accepted |
Commit | b9d5e3aa8ff65e133e7fc5c808fa5ceb6a5d788d |
Delegated to: | Patrice Chotard |
Headers | show |
Series | [1/4] stm32mp: stm32prog: Add Kconfig file for stm32prog command | expand |
Hi Patrick On 2/25/21 1:37 PM, Patrick Delaunay wrote: > 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> > --- > > arch/arm/mach-stm32mp/cpu.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c > index a453f89d02..527b6290de 100644 > --- a/arch/arm/mach-stm32mp/cpu.c > +++ b/arch/arm/mach-stm32mp/cpu.c > @@ -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); > Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Thanks Patrice
Hi On 2/25/21 1:37 PM, Patrick Delaunay wrote: > 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> > --- > > arch/arm/mach-stm32mp/cpu.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c > index a453f89d02..527b6290de 100644 > --- a/arch/arm/mach-stm32mp/cpu.c > +++ b/arch/arm/mach-stm32mp/cpu.c > @@ -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); > Applied to u-boot-stm/next Thanks Patrice
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index a453f89d02..527b6290de 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -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);
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> --- arch/arm/mach-stm32mp/cpu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)