1Sandbox SPI/SPI Flash Implementation 2==================================== 3 4U-Boot supports SPI and SPI flash emulation in sandbox. This must be enabled 5using the --spi_sf paramter when starting U-Boot. 6 7For example: 8 9$ make O=sandbox sandbox_config 10$ make O=sandbox 11$ ./sandbox/u-boot --spi_sf 0:0:W25Q128:b/chromeos_peach/out/image.bin 12 13The four parameters to spi_sf are: 14 15 SPI bus number (typically 0) 16 SPI chip select number (typically 0) 17 SPI chip to emulate 18 File containing emulated data 19 20Supported chips are W25Q16 (2MB), W25Q32 (4MB) and W25Q128 (16MB). Once 21U-Boot it started you can use 'sf' commands as normal. For example: 22 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" 26 27 28U-Boot 2013.10-00237-gd4e0fdb (Nov 07 2013 - 20:08:15) 29 30DRAM: 128 MiB 31Using default environment 32 33In: serial 34Out: serial 35Err: serial 36SF: Detected W25Q128BV with page size 256 Bytes, erase size 4 KiB, total 16 MiB 37SPI flash test: 380 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps 391 check: 2 ticks, 512000 KiB/s 4096.000 Mbps 402 write: 6 ticks, 170666 KiB/s 1365.328 Mbps 413 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps 42Test passed 430 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps 441 check: 2 ticks, 512000 KiB/s 4096.000 Mbps 452 write: 6 ticks, 170666 KiB/s 1365.328 Mbps 463 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps 47SF: 4096 bytes @ 0x1000 Read: OK 48SF: 4096 bytes @ 0x1000 Erased: OK 49SF: 4096 bytes @ 0x1000 Written: OK 50 51 52Since the SPI bus is fully implemented as well as the SPI flash connected to 53it, you can also use low-level SPI commands to access the flash. For example 54this reads the device ID from the emulated chip: 55 56=> sspi 0 32 9f 57FFEF4018 58 59 60Simon Glass 61sjg@chromium.org 627/11/2013 63Note that the sandbox SPI implementation was written by Mike Frysinger 64<vapier@gentoo.org>. 65