[U-Boot] Using spi_alloc_slave() from SPL

Marek Vasut marex at denx.de
Thu Aug 6 15:33:44 CEST 2015


On Thursday, August 06, 2015 at 03:25:22 PM, Fabio Estevam wrote:
> Hi,
> 
> I am trying to use spi_flash_probe() inside SPL on a custom mx6 board.
> 
> The idea is to read some parameters from the SPI NOR flash and configure
> the DDR accordingly.
> 
> This is similar to what gw_ventana_spl.c does, but it reads from i2c
> eeprom instead of SPI NOR.
> 
> Here are the changes just to illustrate the problem:

I understand that you need to call spi_flash_probe() in board_init_f()
at which point you still have no malloc() area available, so it fails
with -ENOMEM or something like that, correct ?

What you can probably try is to define CONFIG_SYS_MALLOC_F_LEN and do
the following before doing spi_flash_probe():

static u8 array[128] __aligned(32);

gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
gd->malloc_ptr = array;

This might work, but is nasty.

Best regards,
Marek Vasut


More information about the U-Boot mailing list