1 Sandbox SPI/SPI Flash Implementation
2 ====================================
4 U-Boot supports SPI and SPI flash emuation in sandbox. This must be enabled
5 using the --spi_sf paramter when starting U-Boot.
9 $ make O=sandbox sandbox_config
11 $ ./sandbox/u-boot --spi_sf 0:0:W25Q128:b/chromeos_peach/out/image.bin
13 The four parameters to spi_sf are:
15 SPI bus number (typically 0)
16 SPI chip select number (typically 0)
18 File containing emulated data
20 Supported chips are W25Q16 (2MB), W25Q32 (4MB) and W25Q128 (16MB). Once
21 U-Boot it started you can use 'sf' commands as normal. For example:
23 $ ./b/sandbox/u-boot --spi_sf 0:0:W25Q128:b/chromeos_peach/out/image.bin \
24 -c "sf probe; sf test 0 100000; sf read 0 1000 1000; \
25 sf erase 1000 1000; sf write 0 1000 1000"
28 U-Boot 2013.10-00237-gd4e0fdb (Nov 07 2013 - 20:08:15)
31 Using default environment
36 SF: Detected W25Q128BV with page size 256 Bytes, erase size 4 KiB, total 16 MiB
38 0 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps
39 1 check: 2 ticks, 512000 KiB/s 4096.000 Mbps
40 2 write: 6 ticks, 170666 KiB/s 1365.328 Mbps
41 3 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps
43 0 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps
44 1 check: 2 ticks, 512000 KiB/s 4096.000 Mbps
45 2 write: 6 ticks, 170666 KiB/s 1365.328 Mbps
46 3 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps
47 SF: 4096 bytes @ 0x1000 Read: OK
48 SF: 4096 bytes @ 0x1000 Erased: OK
49 SF: 4096 bytes @ 0x1000 Written: OK
52 Since the SPI bus is fully implemented as well as the SPI flash connected to
53 it, you can also use low-level SPI commands to access the flash. For example
54 this reads the device ID from the emulated chip:
63 Note that the sandbox SPI implementation was written by Mike Frysinger