Hello Sascha,

On 4/14/25 13:23, Sascha Hauer wrote:
> On Fri, Apr 11, 2025 at 09:27:47AM +0200, Ahmad Fatoum wrote:
>> Add support for the Linux Automation GmbH Test Automation
>> Controller (TAC). The board boots from eMMC, but requires USB loading if
>> no previous barebox has been put into the eMMC boot partition.
>>
>> Signed-off-by: Leonard Göhrs <l.goe...@pengutronix.de>
>> Signed-off-by: Rouven Czerwinski <r.czerwin...@pengutronix.de>
>> Signed-off-by: Marc Kleine-Budde <m...@pengutronix.de>
>> Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>

[snip]

>> +static const int board_rev_pins[] = {0, 1, 2, 3, 6, 7};
>> +
>> +static u32 get_board_rev(void)
>> +{
>> +    u32 board_rev = 0;
>> +
>> +    /* Enable GPIOZ bank */
>> +    setbits_le32(STM32MP15_RCC_MP_AHB5ENSETR, BIT(0));
>> +
>> +    for (size_t i = 0; i < ARRAY_SIZE(board_rev_pins); i++) {
>> +            int pin = board_rev_pins[i];
>> +
>> +            __stm32_pmx_gpio_input(STM32MP15_GPIOZ_BASE, pin);
>> +            board_rev |= __stm32_pmx_gpio_get(STM32MP15_GPIOZ_BASE, pin) << 
>> i;
>> +    }
>> +
>> +    return board_rev;
>> +}
> 
> Is this information available during runtime with some pr_* message or
> variable?

No. There is more extensive board revision information in the EEPROM
though, which is indeed available at runtime via the separately
submitted TLV series.

>> +static void noinline select_fdt_and_start(void *fdt)
>> +{
>> +    putc_ll('>');
>> +
>> +    switch (get_board_rev()) {
>> +    case BOARD_GEN1:
>> +            fdt = runtime_address(__dtb_z_stm32mp157c_lxa_tac_gen1_start);
>> +            break;
>> +    case BOARD_GEN2:
>> +            fdt = runtime_address(__dtb_z_stm32mp157c_lxa_tac_gen2_start);
>> +            break;
>> +    case BOARD_GEN3:
>> +            fdt = runtime_address(__dtb_z_stm32mp153c_lxa_tac_gen3_start);
>> +            break;
>> +    }
> 
> This check only matches for minor revision 0. Shouldn't the minor
> version rather be ignored here?

I am not sure if a generation is always equal to the major version - 1.
It seems we have no minor revisions != 0 in the field.

If Leonard (Cc'd) doesn't object, I'll mask away the lower 2 bits for v2.

>> +ENTRY_FUNCTION(start_stm32mp15xc_lxa_tac, r0, r1, r2)
>> +{
>> +    stm32mp_cpu_lowlevel_init();
>> +
>> +    /*
>> +     * stm32mp_cpu_lowlevel_init sets up a stack. Do the remaining
>> +     * init in a non-naked function. Register r2 points to the fdt
>> +     * from the FIT image which can be used as a default.
>> +     */
> 
> "the fdt from the FIT image" seems to imply that this entry is only used
> as a 2nd state entry, but it's used as a 1st stage entry as well, isn't
> it?

s/FIT/FIP. First stage bootloader is TF-A.

> I would rephrase that to something like "in case of a 2nd stage boot r2
> points to the fdt..."

There is no first stage boot.

Cheers,
Ahmad

> 
> Sascha
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |


Reply via email to