board::vcores_init() - SPL doesn't boot if you implement "complex conditional statements"

Hi,

In u-boot/board/ti/am57xx/board.c, function, vcores_init() appears to be initializing a pointer to one of 2-3 tables which appear to contain a set of voltage rails for all the cores on a given board.

I witnessed something a little funky last-night and I was wondering if you might have some insight into what’s going on. If you implement a simple if, else statement (e.g. with two possible tables), then SPL boots. However, if you implement an if : else if : else construct, the board doesn’t want to boot. I’m not sure what’s going on here, but I’m wondering if vcores_init has timing constraints? I know that the PMIC shuts everything (or at least the A15 cores) down if you don’t send a message to it on the I2C bus to keep the cores powered on.

I’m wondering if vcores_init is called close to the end of this time window??

If you use a simple if, else statement:

if (board_is_am572x_idk())
{
*omap_vcores = &am572x_idk_volts;
}
else
{
*omap_vcores = &beagle_x15_volts;
}

SPL loads and vectors to u-boot.

If, however, you code the following construct:

if (board_is_am572x_idk())
{
*omap_vcores = &am572x_idk_volts;
}
else if (board_is_am571x_idk())
{
*omap_vcores = &am571x_idk_volts;
}
else if (board_is_am572x_custom())
{
*omap_vcores = &beagle_x15_volts;
}
else
{
*omap_vcores = &beagle_x15_volts;
}

Then all that pops up on the boot console is 1-2 ASCII characters and then everything APPEARS dead.

I have no idea what’s going on, but I wonder if the additional assembly code generated for the else if, else if could be delaying the “stay powered on” I2C message which gets sent to the PMIC until after the PMIC has already started the core power down ???

Thanks!

Jeff

Update,

This doesn’t look like a timing issue, but an SPL executable size issue, being larger than the # block size for the dd command.

When I compile in the 3 condition else if branch in vcores_init (but compiler switch off some other code so as to keep the MLO code size small enough), the board boots up again, so long as the MLO size is < ~ 131 KB (128 KiB)…

Thanks, FYI, and regards…

Jeff