All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albin Tonnerre <albin.tonnerre@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Environment and SPI drivers
Date: Mon, 15 Mar 2010 21:45:41 +0100	[thread overview]
Message-ID: <20100315204541.GD14032@pc-ran3241> (raw)
In-Reply-To: <20100315202540.0F5C85086C@gemini.denx.de>

On Mon, 15 Mar 2010 21:25 +0100, Wolfgang Denk wrote :
> Dear Albin Tonnerre,
> 
> In message <20100315192914.GA14032@pc-ran3241> you wrote:
> > 
> > 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
> 
> This depends on what sort of SPI devices you are talking about. Do you
> have plain simple EEPROM in mind, or things like SPI flash, or
> eventually MMC/SDCard?  These are pretty different thinngs...

In this particular case, mostly EEPROM, but that would apply to anything trying
to use the SPI framework before mem_malloc_init is called.

> 
> > 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().
> 
> If you are talking about SPI EEPROM, then just enable EEPROM support
> and environment in EEPROM, and set CONFIG_SPI. The EEPROM framework in
> "common/cmd_eeprom.c" includes support for SPI EEPROM (this actually
> predates the SPI framework).

I know, I did that. The thing is, even with the support for SPI EEPROM, you
need a driver to actually issue the proper commands to read/write data from/to
the SPI EEPROM -- that is, implement spi_read/write. If you do that using the
SPI framework as, I guess, one would expect, then you're screwed since all the
implementations of spi_setup_slave call malloc(), and you can't read your
environment.

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

      reply	other threads:[~2010-03-15 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100315204541.GD14032@pc-ran3241 \
    --to=albin.tonnerre@free-electrons.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.