diff options
author | Mike Frysinger <vapier@gentoo.org> | 2013-12-03 16:43:27 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2013-12-09 12:22:39 -0700 |
commit | ffdb20bea16e00a326cc3d106f275e58bf302a0c (patch) | |
tree | 468e8f02d9b56089d8e12b4ab873e0d2fb455342 /board/sandbox | |
parent | 6122813fa2cb9eef4a211bd47292322096db9fa8 (diff) | |
download | u-boot-imx-ffdb20bea16e00a326cc3d106f275e58bf302a0c.zip u-boot-imx-ffdb20bea16e00a326cc3d106f275e58bf302a0c.tar.gz u-boot-imx-ffdb20bea16e00a326cc3d106f275e58bf302a0c.tar.bz2 |
sandbox: spi: Add new SPI flash driver
This adds a SPI flash driver which simulates SPI flash clients.
Currently supports the bare min that U-Boot requires: you can
probe, read, erase, and write. Should be easy to extend to make
it behave more exactly like a real SPI flash, but this is good
enough to merge now.
sjg@chromium.org added a README and tidied up code a little.
Added a required map_sysmem() for sandbox.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board/sandbox')
-rw-r--r-- | board/sandbox/sandbox/README.sandbox | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/board/sandbox/sandbox/README.sandbox b/board/sandbox/sandbox/README.sandbox index 30b0541..6989557 100644 --- a/board/sandbox/sandbox/README.sandbox +++ b/board/sandbox/sandbox/README.sandbox @@ -31,6 +31,60 @@ the console. It does not set the terminal into raw mode, so cursor keys and history will not work yet. +SPI Emulation +------------- + +Sandbox supports SPI and SPI flash emulation. + +This is controlled by the spi_sf argument, the format of which is: + + bus:cs:device:file + + bus - SPI bus number + cs - SPI chip select number + device - SPI device emulation name + file - File on disk containing the data + +For example: + + dd if=/dev/zero of=spi.bin bs=1M count=4 + ./u-boot --spi_sf 0:0:M25P16:spi.bin + +With this setup you can issue SPI flash commands as normal: + +=>sf probe +SF: Detected M25P16 with page size 64 KiB, total 2 MiB +=>sf read 0 0 10000 +SF: 65536 bytes @ 0x0 Read: OK +=> + +Since this is a full SPI emulation (rather than just flash), you can +also use low-level SPI commands: + +=>sspi 0:0 32 9f +FF202015 + +This is issuing a READ_ID command and getting back 20 (ST Micro) part +0x2015 (the M25P16). + +Drivers are connected to a particular bus/cs using sandbox's state +structure (see the 'spi' member). A set of operations must be provided +for each driver. + + +Configuration settings for the curious are: + +CONFIG_SANDBOX_SPI_MAX_BUS + The maximum number of SPI buses supported by the driver (default 1). + +CONFIG_SANDBOX_SPI_MAX_CS + The maximum number of chip selects supported by the driver + (default 10). + +CONFIG_SPI_IDLE_VAL + The idle value on the SPI bus + + Tests ----- |