diff mbox series

configs: stm32mp: force empty PREBOOT

Message ID 20201007081020.30635-1-patrick.delaunay@st.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series configs: stm32mp: force empty PREBOOT | expand

Commit Message

Patrick DELAUNAY Oct. 7, 2020, 8:10 a.m. UTC
This patch remove the default preboot command 'usb start' for
STMicroelectronics board. These command is added by the
commit 324d77998ed6 ("Define default CONFIG_PREBOOT with right config
option")' and commit 44758771eefb ("arm: move CONFIG_PREBOOT="usb start"
to KConfig").

The USB storage boot (not activated in stm32mp1.h) is correctly
managed by distro boot command 'usb_boot' (defined in
include/config_distro_bootcmd.h, it include 'usb start')
and USB keyboard is not supported in stm32mp15 defconfig.

So this patch avoids unnecessary USB initialization which slows
down the start-up:
  starting USB...
  Bus usbh-ehci@5800d000: USB EHCI 1.00
  scanning bus usbh-ehci@5800d000 for devices... 3 USB Device(s) found
         scanning usb for storage devices... 1 Storage Device(s) found

Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Jonas Smedegaard <dr@jones.dk>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 configs/stm32mp15_basic_defconfig   | 1 +
 configs/stm32mp15_trusted_defconfig | 1 +
 2 files changed, 2 insertions(+)

Comments

Tom Rini Oct. 8, 2020, 2:16 p.m. UTC | #1
On Wed, Oct 07, 2020 at 10:10:20AM +0200, Patrick Delaunay wrote:

> This patch remove the default preboot command 'usb start' for
> STMicroelectronics board. These command is added by the
> commit 324d77998ed6 ("Define default CONFIG_PREBOOT with right config
> option")' and commit 44758771eefb ("arm: move CONFIG_PREBOOT="usb start"
> to KConfig").
> 
> The USB storage boot (not activated in stm32mp1.h) is correctly
> managed by distro boot command 'usb_boot' (defined in
> include/config_distro_bootcmd.h, it include 'usb start')
> and USB keyboard is not supported in stm32mp15 defconfig.
> 
> So this patch avoids unnecessary USB initialization which slows
> down the start-up:
>   starting USB...
>   Bus usbh-ehci@5800d000: USB EHCI 1.00
>   scanning bus usbh-ehci@5800d000 for devices... 3 USB Device(s) found
>          scanning usb for storage devices... 1 Storage Device(s) found
> 
> Cc: Peter Robinson <pbrobinson@gmail.com>
> Cc: Jonas Smedegaard <dr@jones.dk>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> 
>  configs/stm32mp15_basic_defconfig   | 1 +
>  configs/stm32mp15_trusted_defconfig | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
> index a8c4112dbe..f937a0278d 100644
> --- a/configs/stm32mp15_basic_defconfig
> +++ b/configs/stm32mp15_basic_defconfig
> @@ -19,6 +19,7 @@ CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_FIT=y
>  CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> +CONFIG_PREBOOT=""
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
> diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
> index 0792884a9d..b0be064cc3 100644
> --- a/configs/stm32mp15_trusted_defconfig
> +++ b/configs/stm32mp15_trusted_defconfig
> @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_FIT=y
>  CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> +CONFIG_PREBOOT=""
>  CONFIG_SYS_PROMPT="STM32MP> "
>  CONFIG_CMD_ADTIMG=y
>  # CONFIG_CMD_ELF is not set

In this case you should disable CONFIG_USE_PREBOOT.
Patrick DELAUNAY Oct. 9, 2020, 7:46 a.m. UTC | #2
Hi Tom,

> From: Tom Rini <trini@konsulko.com>
> Sent: jeudi 8 octobre 2020 16:16
> 
> On Wed, Oct 07, 2020 at 10:10:20AM +0200, Patrick Delaunay wrote:
> 
> > This patch remove the default preboot command 'usb start' for
> > STMicroelectronics board. These command is added by the commit
> > 324d77998ed6 ("Define default CONFIG_PREBOOT with right config
> > option")' and commit 44758771eefb ("arm: move CONFIG_PREBOOT="usb
> start"
> > to KConfig").
> >
> > The USB storage boot (not activated in stm32mp1.h) is correctly
> > managed by distro boot command 'usb_boot' (defined in
> > include/config_distro_bootcmd.h, it include 'usb start') and USB
> > keyboard is not supported in stm32mp15 defconfig.
> >
> > So this patch avoids unnecessary USB initialization which slows down
> > the start-up:
> >   starting USB...
> >   Bus usbh-ehci@5800d000: USB EHCI 1.00
> >   scanning bus usbh-ehci@5800d000 for devices... 3 USB Device(s) found
> >          scanning usb for storage devices... 1 Storage Device(s) found
> >
> > Cc: Peter Robinson <pbrobinson@gmail.com>
> > Cc: Jonas Smedegaard <dr@jones.dk>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> > ---
> >
> >  configs/stm32mp15_basic_defconfig   | 1 +
> >  configs/stm32mp15_trusted_defconfig | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/configs/stm32mp15_basic_defconfig
> > b/configs/stm32mp15_basic_defconfig
> > index a8c4112dbe..f937a0278d 100644
> > --- a/configs/stm32mp15_basic_defconfig
> > +++ b/configs/stm32mp15_basic_defconfig
> > @@ -19,6 +19,7 @@ CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-
> ev1"
> >  CONFIG_DISTRO_DEFAULTS=y
> >  CONFIG_FIT=y
> >  CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> > +CONFIG_PREBOOT=""
> >  CONFIG_BOARD_EARLY_INIT_F=y
> >  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
> >  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
> > diff --git a/configs/stm32mp15_trusted_defconfig
> > b/configs/stm32mp15_trusted_defconfig
> > index 0792884a9d..b0be064cc3 100644
> > --- a/configs/stm32mp15_trusted_defconfig
> > +++ b/configs/stm32mp15_trusted_defconfig
> > @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-
> ev1"
> >  CONFIG_DISTRO_DEFAULTS=y
> >  CONFIG_FIT=y
> >  CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> > +CONFIG_PREBOOT=""
> >  CONFIG_SYS_PROMPT="STM32MP> "
> >  CONFIG_CMD_ADTIMG=y
> >  # CONFIG_CMD_ELF is not set
> 
> In this case you should disable CONFIG_USE_PREBOOT.

I activate CONFIG_USE_PREBOOT to handle the "preboot" variable in
common/main.c::main_loop()

	if (IS_ENABLED(CONFIG_USE_PREBOOT))
		run_preboot_environment_command();

But I expect that the "preboot" varibale in empty by default,
as it is the case until now.

In my case the preboot variable is dynamically build in 
arch/arm/mach-stm32mp/cpu.c::setup_boot_mode()

it is why I activate the USE_PREBOOT by default:
  with imply in mach-stm32mp Kconfig.

I use this feature to handle the 'forced' boot request,
and I preferred don't override the bootcmd
(I handle the fastboot 'continue' command without any effort:
  the bootcmd is executed after preboot=fastboot)

And it is managed by linux with reboot mode driver:

tamp: tamp@5c00a000 {
	compatible = "simple-bus", "syscon", "simple-mfd";
	reg = <0x5c00a000 0x400>;

	reboot-mode {
		compatible = "syscon-reboot-mode";
		offset = <0x150>; /* reg20 */
		mask = <0xff>;
		mode-normal = <0>;
		mode-fastboot = <0x1>;
		mode-recovery = <0x2>;
		mode-stm32cubeprogrammer = <0x3>;
		mode-ums_mmc0 = <0x10>;
		mode-ums_mmc1 = <0x11>;
		mode-ums_mmc2 = <0x12>;
	};
};

So the expected configuration for me is 
- CONFIG_USE_PREBOOT=y		=> variable preboot is handle
- CONFIG_PREBOOT=""		=> default value of variable


> --
> Tom

Regards
Patrick
diff mbox series

Patch

diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index a8c4112dbe..f937a0278d 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -19,6 +19,7 @@  CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
+CONFIG_PREBOOT=""
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
index 0792884a9d..b0be064cc3 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -12,6 +12,7 @@  CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
+CONFIG_PREBOOT=""
 CONFIG_SYS_PROMPT="STM32MP> "
 CONFIG_CMD_ADTIMG=y
 # CONFIG_CMD_ELF is not set