[U-Boot] [PATCH 3/6] sandbox: SPI emulation bus

Mike Frysinger vapier at gentoo.org
Tue Jan 24 02:42:43 CET 2012


On Monday 23 January 2012 19:31:23 Simon Glass wrote:
> On Sun, Jan 22, 2012 at 10:30 PM, Mike Frysinger wrote:
> > This adds a SPI framework for people to hook up simulated SPI clients.
> 
> I don't know the SPI interface as well as use - might be useful to
> have a few comments and debug() things when things go wrong I think.
> Please see below for some ideas.

i can add some more

> > +void spi_set_speed(struct spi_slave *slave, uint hz)
> > +{
> 
> Should this store the value somewhere?

it could, but i'm not sure where it'd be used ... i don't want to get into 
simulating the actual line transitions :).  the SID project is for that level 
of craziness:
	http://sourceware.org/sid/

> > +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> > +               unsigned int max_hz, unsigned int mode)
> > +{
> > +       struct sb_spi_slave *sss;
> > +
> > +       if (!spi_cs_is_valid(bus, cs))
> > +               return NULL;
> > +
> > +       sss = malloc(sizeof(*sss));
> > +       if (!sss)
> > +               return NULL;
> 
> Do we want a debug() message for this?

for memory failures, i don't generally think so.  for other probe type 
failures, sure.

> > +int spi_claim_bus(struct spi_slave *slave)
> > +{
> 
> Should we track claim/release for debugging purposes?

ah, that'd be good
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120123/9c2eef1b/attachment.pgp>


More information about the U-Boot mailing list