diff mbox series

[4/5] dm: Avoid initing built-in devices when chain loading

Message ID 20191221161340.27047-5-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Improve support for chain-loading U-Boot | expand

Commit Message

Simon Glass Dec. 21, 2019, 4:13 p.m. UTC
When U-Boot is not the first-stage bootloader we don't want to init
devices early during boot. Add a check to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/board_r.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bin Meng Feb. 3, 2020, 11:17 a.m. UTC | #1
Hi Simon,

On Sun, Dec 22, 2019 at 12:13 AM Simon Glass <sjg@chromium.org> wrote:
>
> When U-Boot is not the first-stage bootloader we don't want to init
> devices early during boot. Add a check to avoid this.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/board_r.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index e711de64b5..4e0dfac4fc 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -320,6 +320,9 @@ static int initr_dm_devices(void)
>  {
>         int ret;
>
> +       if (!ll_boot_init())
> +               return 0;
> +

I can't think of a reason why dm_timer_init() cannot be called in this case.

>         if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
>                 ret = dm_timer_init();
>                 if (ret)
> --

Regards,
Bin
Simon Glass Feb. 3, 2020, 5:15 p.m. UTC | #2
Hi Bin,

On Mon, 3 Feb 2020 at 04:17, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Sun, Dec 22, 2019 at 12:13 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > When U-Boot is not the first-stage bootloader we don't want to init
> > devices early during boot. Add a check to avoid this.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  common/board_r.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/common/board_r.c b/common/board_r.c
> > index e711de64b5..4e0dfac4fc 100644
> > --- a/common/board_r.c
> > +++ b/common/board_r.c
> > @@ -320,6 +320,9 @@ static int initr_dm_devices(void)
> >  {
> >         int ret;
> >
> > +       if (!ll_boot_init())
> > +               return 0;
> > +
>
> I can't think of a reason why dm_timer_init() cannot be called in this case.

Perhaps we can drop this one, since we don't reset the timer base anymore.

>
> >         if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
> >                 ret = dm_timer_init();
> >                 if (ret)
> > --

Regards,
SImon
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index e711de64b5..4e0dfac4fc 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -320,6 +320,9 @@  static int initr_dm_devices(void)
 {
 	int ret;
 
+	if (!ll_boot_init())
+		return 0;
+
 	if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
 		ret = dm_timer_init();
 		if (ret)