[PATCH 13/14] rockchip: Enable bootstage on rockpro64

Simon Glass sjg at chromium.org
Thu Dec 22 18:47:19 CET 2022


Hi Pali,

On Wed, 21 Dec 2022 at 16:12, Pali Rohár <pali at kernel.org> wrote:
>
> On Wednesday 21 December 2022 16:08:27 Simon Glass wrote:
> > This board is useful for benchmarking overall U-Boot performance. Enable
> > the bootstage feature so we get a report.
> >
> > Since this returns to the boot rom before finishing executing
> > board_init_r() in SPL, add a few bootstage calls so that we can collect
> > timing from TPL.
> >
> > For the stash region, use a portion of SRAM, 64KB below the stack top.
> > This allows the TPL image to be up to nearly 120KB (it is typically about
> > 64KB). SPL normally runs from SDRAM at 0, so can use the same stash
> > region.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >  arch/arm/mach-rockchip/tpl.c       | 18 +++++++++++++++---
> >  common/spl/spl.c                   |  2 +-
> >  configs/rockpro64-rk3399_defconfig |  8 ++++++++
> >  3 files changed, 24 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
> > index ed46a9ad286..2b7f852a28f 100644
> > --- a/arch/arm/mach-rockchip/tpl.c
> > +++ b/arch/arm/mach-rockchip/tpl.c
> > @@ -4,6 +4,7 @@
> >   */
> >
> >  #include <common.h>
> > +#include <bootstage.h>
> >  #include <debug_uart.h>
> >  #include <dm.h>
> >  #include <hang.h>
> > @@ -70,15 +71,17 @@ void board_init_f(ulong dummy)
> >                               U_BOOT_TIME ")\n");
> >  #endif
> >  #endif
> > +     /* Init secure timer */
> > +     rockchip_stimer_init();
> > +
> > +     puts("u_boot_first_phase(): ");
> > +     printhex8(u_boot_first_phase());
> >       ret = spl_early_init();
> >       if (ret) {
> >               debug("spl_early_init() failed: %d\n", ret);
> >               hang();
> >       }
> >
> > -     /* Init secure timer */
> > -     rockchip_stimer_init();
> > -
> >       /* Init ARM arch timer */
> >       if (IS_ENABLED(CONFIG_SYS_ARCH_TIMER))
> >               timer_init();
> > @@ -93,6 +96,15 @@ void board_init_f(ulong dummy)
> >  int board_return_to_bootrom(struct spl_image_info *spl_image,
> >                           struct spl_boot_device *bootdev)
> >  {
> > +#ifdef CONFIG_BOOTSTAGE_STASH
> > +     int ret;
> > +
> > +     bootstage_mark_name(BOOTSTAGE_ID_END_TPL, "end tpl");
> > +     ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> > +                           CONFIG_BOOTSTAGE_STASH_SIZE);
> > +     if (ret)
> > +             debug("Failed to stash bootstage: err=%d\n", ret);
> > +#endif
> >       back_to_bootrom(BROM_BOOT_NEXTSTAGE);
> >
> >       return 0;
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > index 1d2e8fda728..71cded774b8 100644
> > --- a/common/spl/spl.c
> > +++ b/common/spl/spl.c
> > @@ -910,7 +910,7 @@ void preloader_console_init(void)
> >       gd->have_console = 1;
> >
> >  #if CONFIG_IS_ENABLED(BANNER_PRINT)
> > -     puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
> > +     puts("\nxU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
>
> Why 'x'?
>

Oops, and there is another debugging bit added also.

Regards,
Simon


More information about the U-Boot mailing list