[PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match

Aristo Chen aristo.chen at canonical.com
Tue Jun 23 09:01:00 CEST 2026


Hi Anshul,

On Tue, Jun 23, 2026 at 2:18 PM Anshul Dalal <anshuld at ti.com> wrote:
>
> On Thu, 28 May 2026 13:27:10 +0000, Aristo Chen <aristo.chen at canonical.com> wrote:
> > diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> > index 19a6e24f38b..f4c6c4f098e 100644
> > --- a/arch/arm/mach-k3/common.c
> > +++ b/arch/arm/mach-k3/common.c
> > @@ -191,6 +191,33 @@ enum k3_device_type get_device_type(void)
> > [ ... skip 22 lines ... ]
> > +     name_len = strlen(name);
> > +     suffix_len = strlen(suffix);
> > +     if (name_len < suffix_len)
> > +             return -EINVAL;
> > +
> > +     return strcmp(name + name_len - suffix_len, suffix) ? -EINVAL : 0;
>
> Since we already know suffix_len, a strncmp might be better here. Also the
> ternary is redundant since -EINVAL would still mean the 'invalid' configuration
> is selected.

Will fix it in V2.

>
> >
> > diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
> > index 466ad22f895..37ff98d8992 100644
> > --- a/arch/arm/mach-k3/common.h
> > +++ b/arch/arm/mach-k3/common.h
> > @@ -55,7 +46,6 @@ const struct k3_speed_grade_map *k3_get_speed_grade_map(void);
> >  void k3_fix_rproc_clock(const char *path);
> >  void mmr_unlock(uintptr_t base, u32 partition);
> >  bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data);
> > -enum k3_device_type get_device_type(void);
>
> Why the move of this function from common.h to hardware.h? This header should be
> accessible to all of K3 anyways.

If I understand correctly, arch/arm/mach-k3/common.h is currently
mach-k3-internal. It is not in the include search path for board
files; it is pulled in by .c files inside mach-k3/ via relative
includes (#include "common.h" or #include "../common.h").

Board files like board/ti/am62x/evm.c include the K3 SoC header via
<asm/arch/hardware.h>, which maps to
arch/arm/mach-k3/include/mach/hardware.h. They have no direct path to
arch/arm/mach-k3/common.h today.

For the board_fit_config_name_match() wrappers in this patch to call
get_device_type(), the declaration needs to live somewhere boards can
reach. The two options I considered were:

  1. Move enum k3_device_type and get_device_type() to hardware.h
(what this patch does). Touches two files.

  2. Relocate common.h into arch/arm/mach-k3/include/mach/ to make it
public, then update every relative include inside mach-k3/. Touches
every mach-k3/ source file.

I went with (1) as the smaller change. Happy to revisit if you would
prefer (2), but it felt out of scope for this series.

>
> >
> > diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
> > index 49e58ad6d6c..59201f8d2ca 100644
> > --- a/board/ti/am62x/evm.c
> > +++ b/board/ti/am62x/evm.c
> > @@ -135,6 +136,13 @@ int board_late_init(void)
> >  }
> >  #endif
> >
> > +#if defined(CONFIG_SPL_LOAD_FIT)
>
> There's no need for the #if guard here, SPL_LOAD_FIT is enabled for all ARCH_K3
> and if disabled LTO will optimize out the function anyways at build time.

Will remove it in V2

>
> --
> Anshul Dalal <anshuld at ti.com>

Best regards,
Aristo


More information about the U-Boot mailing list