public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Environment and SPI drivers
@ 2010-03-15 19:29 Albin Tonnerre
  2010-03-15 20:25 ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Albin Tonnerre @ 2010-03-15 19:29 UTC (permalink / raw)
  To: u-boot

Hello,

The SPI framework provided by u-boot (spi_setup_slave, spi_xfer and the like)
cannot currently be used to read the environment from SPI devices. The reason is
that all the drivers implement spi_setup_slave using malloc(), and malloc()
cannot be used when env_init is called - this happens before mem_alloc_init.

I'm wondering what would be a proper fix for this. I don't think it is OK to say
'drivers reading the environment should not use the SPI framework', as those
drivers might be used to do others things - that would make the SPI framework
unsuitable for (e.g.) any SPI EEPROM. The only sane alternative I can see is
that we introduce spi_setup_slave_$whatever, which would work the same way as
spi_setup_slave, with the difference that it should be given caller-allocated
storage, so that we avoid the use for malloc().

Thoughts ?

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-15 20:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-15 19:29 [U-Boot] Environment and SPI drivers Albin Tonnerre
2010-03-15 20:25 ` Wolfgang Denk
2010-03-15 20:45   ` Albin Tonnerre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox