README.sandbox-spi 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Sandbox SPI/SPI Flash Implementation
  2. ====================================
  3. U-Boot supports SPI and SPI flash emulation in sandbox. This must be enabled
  4. via a device tree.
  5. For example:
  6. spi@0 {
  7. #address-cells = <1>;
  8. #size-cells = <0>;
  9. reg = <0 1>;
  10. compatible = "sandbox,spi";
  11. cs-gpios = <0>, <&gpio_a 0>;
  12. spi.bin@0 {
  13. reg = <0>;
  14. compatible = "spansion,m25p16", "jedec,spi-nor";
  15. spi-max-frequency = <40000000>;
  16. sandbox,filename = "spi.bin";
  17. };
  18. };
  19. Supported chips are W25Q16 (2MB), W25Q32 (4MB) and W25Q128 (16MB). Once
  20. U-Boot it started you can use 'sf' commands as normal. For example:
  21. $ dd if=/dev/zero of=spi.bin bs=1M count=2
  22. $ u-boot -T
  23. Since the SPI bus is fully implemented as well as the SPI flash connected to
  24. it, you can also use low-level SPI commands to access the flash. For example
  25. this reads the device ID from the emulated chip:
  26. => sspi 0 32 9f
  27. SF: Detected m25p16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB
  28. FF202015
  29. Simon Glass
  30. sjg@chromium.org
  31. 7/11/2013
  32. Note that the sandbox SPI implementation was written by Mike Frysinger
  33. <vapier@gentoo.org>.