[U-Boot] WIP for SPI

Simon Glass sjg at chromium.org
Wed Jun 11 05:54:14 CEST 2014


Hi Jon,

I thought I should mention that I spent time on a flight to look at
SPI with driver model. I have put the WIP code in branch 'working' in
u-boot-dm.git. Note it doesn't work, and is very early. Also note that
many of the patches have not been posted - I just want to make it
clear what I am up to.

In doing this I had to sort out the numbering of devices. U-Boot has
the concept of SPI bus 2 on its command line, and for now at lest we
need to keep that working. So I have added sequence numbers to devices
- so a device can be considered 'child number 3' of its parent, for
example. The numbers don't need to be sequential. I suppose we could
generalise this to GPIOs if it works out.

My approach for scanning the SPI bus in the device tree is similar to
what I suggested a week or so ago - I took the code from dm_scan_fdt()
and put it in a function with a udevice parent and node parameters. It
seems to work OK for this simple case.

I'll continue to update 'working' as I get closer to making this run.
So far you can do this:

./b/sandbox/u-boot -d b/sandbox/u-boot.dtb -c "sspi 0:0 48 9f000000"


U-Boot 2014.07-rc3-00064-ga8af843-dirty (Jun 10 2014 - 21:43:51)

DRAM:  128 MiB
No match for node 'host at 0'
No match for node 'lcd'
No match for node 'cros-ec-keyb'
Using default environment

In:    cros-ec-keyb
Out:   lcd
Err:   lcd
sandbox_sf: state:0(CMD) bytes:6
sandbox_sf: CS activated; state is fresh!
 cmd: transition to ID state
 id: off:0 tx:0 20
 id: off:1 tx:1 20
 id: off:2 tx:2 15
 id: off:3 tx:3 00
 id: off:4 tx:4 00
sandbox_sf: CS deactivated; cmd done processing!
FF2020150000


Regards,
Simon


More information about the U-Boot mailing list