README.sandbox-spi 1.9 KB

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