[PATCH V4 06/12] board: ti: j721s2: Add support for detecting multiple device trees

Sinthu Raja M sinthu.raja at mistralsolutions.com
Wed Jan 4 14:22:52 CET 2023


Neha,

On Wed, Jan 4, 2023 at 5:37 PM Neha Malcom Francis <n-francis at ti.com> wrote:
>
> Hi Sinthu
>
> On 04/01/23 15:13, Sinthu Raja wrote:
> > From: Sinthu Raja <sinthu.raja at ti.com>
> >
> > Update the board_fit_config_name_match() to choose the right dtb
> > based on the board name read from EEPROM.
> >
> > Also restrict multpile EEPROM reads by verifying if EEPROM is already
> > read
> >
> > Signed-off-by: Sinthu Raja <sinthu.raja at ti.com>
> > ---
> >   board/ti/j721s2/evm.c | 30 ++++++++++++++++++++----------
> >   1 file changed, 20 insertions(+), 10 deletions(-)
> >
> > diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c
> > index a3adb8704e..a7c4082a7a 100644
> > --- a/board/ti/j721s2/evm.c
> > +++ b/board/ti/j721s2/evm.c
> > @@ -72,16 +72,6 @@ int dram_init_banksize(void)
> >       return 0;
> >   }
> >
> > -#ifdef CONFIG_SPL_LOAD_FIT
> > -int board_fit_config_name_match(const char *name)
> > -{
> > -     if (!strcmp(name, "k3-j721s2-common-proc-board"))
> > -             return 0;
> > -
> > -     return -1;
> > -}
> > -#endif
> > -
>
> Any reason why the modifications to board_fit_config_name_match was not
> made here itself and instead shifted, would make patch more readable.

If you please check patch number 4, we are bringing the Macro
board_is_xxxx under CONFIG_TI_I2C_BOARD_DETECT macro to make it as
functions specific to EVM and SK designs of J721S2/AM68 family. This
modification is suggested by Tom earlier. As we moved board_is_xxxx
we have to move board_fit_config_name_match() API also. Without this
change we will get an implicit declaration error.
>
> >   #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> >   int ft_board_setup(void *blob, struct bd_info *bd)
> >   {
> > @@ -111,6 +101,9 @@ int do_board_detect(void)
> >   {
> >       int ret;
> >
> > +     if (board_ti_was_eeprom_read())
> > +             return 0;
> > +
> >       ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
> >                                        CONFIG_EEPROM_CHIP_ADDRESS);
> >       if (ret) {
> > @@ -179,6 +172,23 @@ static void setup_serial(void)
> >   }
> >   #endif
> >
> > +#ifdef CONFIG_SPL_LOAD_FIT
> > +int board_fit_config_name_match(const char *name)
> > +{
> > +     bool eeprom_read = board_ti_was_eeprom_read();
> > +
> > +     if (!eeprom_read || board_is_j721s2_som()) {
> > +             if (!strcmp(name, "k3-j721s2-common-proc-board"))
> > +                     return 0;
> > +     } else if (!eeprom_read || board_is_am68_sk_som()) {
>
> This second eeprom_read check is unnecessary.
This is to check what board is loaded and to identify if the
corresponding DTB file is present in the image. If not this will work
only for EVM and not SK.
>
> > +             if (!strcmp(name, "k3-am68-sk-base-board"))
> > +                     return 0;
> > +     }
> > +
> > +     return -1;
> > +}
> > +#endif
> > +
> >   int board_late_init(void)
> >   {
> >       if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
>
> --
> Thanking You
> Neha Malcom Francis



-- 
With Regards
Sinthu Raja


More information about the U-Boot mailing list