[U-Boot] Using spi_alloc_slave() from SPL

Fabio Estevam festevam at gmail.com
Thu Aug 6 18:44:04 CEST 2015


Hi Marek,

On Thu, Aug 6, 2015 at 11:28 AM, Marek Vasut <marex at denx.de> wrote:

> You want to avoid this "CONFIG_SYS_SPL_MALLOC_*" stuff, as it increases the
> SPL size by 3kiB compared to MALLOC_F . Also, MALLOC_F needs just the base
> address of the malloc area to work (see my email).

Thanks, I removed CONFIG_SYS_SPL_MALLOC_*.

>
> Do you know the return value ?

The malloc() inside spi_do_alloc_slave() returns NULL in the SPL case:

void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
             unsigned int cs)
{
    struct spi_slave *slave;
    void *ptr;

    ptr = malloc(size);

    if (ptr) {
        memset(ptr, '\0', size);
        slave = (struct spi_slave *)(ptr + offset);
        slave->bus = bus;
        slave->cs = cs;
        slave->wordlen = SPI_DEFAULT_WORDLEN;
    }

    return ptr;
}

size is only 56.

Also tried to modify spi_do_alloc_slave() as per your earlier
recommendation, but no success so far.

I was not able to find a way to make malloc() to be happy with SPL yet.

Thanks,

Fabio Estevam


More information about the U-Boot mailing list