sandbox: update documents regarding spi_sf
Since the commit 1289e96797
("sandbox: spi: Drop command-line SPI
option"), "--spi_sf" command line option is no longer supported.
So update the following documents to sync them up with the change.
doc/arch/sandbox.rst
doc/SPI/README.sandbox-spi
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
02c770b4e4
commit
5e61c4e89d
@ -2,59 +2,37 @@ Sandbox SPI/SPI Flash Implementation
|
|||||||
====================================
|
====================================
|
||||||
|
|
||||||
U-Boot supports SPI and SPI flash emulation in sandbox. This must be enabled
|
U-Boot supports SPI and SPI flash emulation in sandbox. This must be enabled
|
||||||
using the --spi_sf paramter when starting U-Boot.
|
via a device tree.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
$ make O=sandbox sandbox_config
|
spi@0 {
|
||||||
$ make O=sandbox
|
#address-cells = <1>;
|
||||||
$ ./sandbox/u-boot --spi_sf 0:0:W25Q128:b/chromeos_peach/out/image.bin
|
#size-cells = <0>;
|
||||||
|
reg = <0 1>;
|
||||||
The four parameters to spi_sf are:
|
compatible = "sandbox,spi";
|
||||||
|
cs-gpios = <0>, <&gpio_a 0>;
|
||||||
SPI bus number (typically 0)
|
spi.bin@0 {
|
||||||
SPI chip select number (typically 0)
|
reg = <0>;
|
||||||
SPI chip to emulate
|
compatible = "spansion,m25p16", "jedec,spi-nor";
|
||||||
File containing emulated data
|
spi-max-frequency = <40000000>;
|
||||||
|
sandbox,filename = "spi.bin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
Supported chips are W25Q16 (2MB), W25Q32 (4MB) and W25Q128 (16MB). Once
|
Supported chips are W25Q16 (2MB), W25Q32 (4MB) and W25Q128 (16MB). Once
|
||||||
U-Boot it started you can use 'sf' commands as normal. For example:
|
U-Boot it started you can use 'sf' commands as normal. For example:
|
||||||
|
|
||||||
$ ./b/sandbox/u-boot --spi_sf 0:0:W25Q128:b/chromeos_peach/out/image.bin \
|
$ dd if=/dev/zero of=spi.bin bs=1M count=2
|
||||||
-c "sf probe; sf test 0 100000; sf read 0 1000 1000; \
|
$ u-boot -T
|
||||||
sf erase 1000 1000; sf write 0 1000 1000"
|
|
||||||
|
|
||||||
|
|
||||||
U-Boot 2013.10-00237-gd4e0fdb (Nov 07 2013 - 20:08:15)
|
|
||||||
|
|
||||||
DRAM: 128 MiB
|
|
||||||
Using default environment
|
|
||||||
|
|
||||||
In: serial
|
|
||||||
Out: serial
|
|
||||||
Err: serial
|
|
||||||
SF: Detected W25Q128BV with page size 256 Bytes, erase size 4 KiB, total 16 MiB
|
|
||||||
SPI flash test:
|
|
||||||
0 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps
|
|
||||||
1 check: 2 ticks, 512000 KiB/s 4096.000 Mbps
|
|
||||||
2 write: 6 ticks, 170666 KiB/s 1365.328 Mbps
|
|
||||||
3 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps
|
|
||||||
Test passed
|
|
||||||
0 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps
|
|
||||||
1 check: 2 ticks, 512000 KiB/s 4096.000 Mbps
|
|
||||||
2 write: 6 ticks, 170666 KiB/s 1365.328 Mbps
|
|
||||||
3 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps
|
|
||||||
SF: 4096 bytes @ 0x1000 Read: OK
|
|
||||||
SF: 4096 bytes @ 0x1000 Erased: OK
|
|
||||||
SF: 4096 bytes @ 0x1000 Written: OK
|
|
||||||
|
|
||||||
|
|
||||||
Since the SPI bus is fully implemented as well as the SPI flash connected to
|
Since the SPI bus is fully implemented as well as the SPI flash connected to
|
||||||
it, you can also use low-level SPI commands to access the flash. For example
|
it, you can also use low-level SPI commands to access the flash. For example
|
||||||
this reads the device ID from the emulated chip:
|
this reads the device ID from the emulated chip:
|
||||||
|
|
||||||
=> sspi 0 32 9f
|
=> sspi 0 32 9f
|
||||||
FFEF4018
|
SF: Detected m25p16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB
|
||||||
|
FF202015
|
||||||
|
|
||||||
|
|
||||||
Simon Glass
|
Simon Glass
|
||||||
|
@ -316,19 +316,29 @@ SPI Emulation
|
|||||||
|
|
||||||
Sandbox supports SPI and SPI flash emulation.
|
Sandbox supports SPI and SPI flash emulation.
|
||||||
|
|
||||||
This is controlled by the spi_sf argument, the format of which is::
|
The device can be enabled via a device tree, for example::
|
||||||
|
|
||||||
bus:cs:device:file
|
spi@0 {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0 1>;
|
||||||
|
compatible = "sandbox,spi";
|
||||||
|
cs-gpios = <0>, <&gpio_a 0>;
|
||||||
|
spi.bin@0 {
|
||||||
|
reg = <0>;
|
||||||
|
compatible = "spansion,m25p16", "jedec,spi-nor";
|
||||||
|
spi-max-frequency = <40000000>;
|
||||||
|
sandbox,filename = "spi.bin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
bus - SPI bus number
|
The file must be created in advance::
|
||||||
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=2
|
||||||
|
$ u-boot -T
|
||||||
|
|
||||||
dd if=/dev/zero of=spi.bin bs=1M count=4
|
Here, you can use "-T" or "-D" option to specify test.dtb or u-boot.dtb,
|
||||||
./u-boot --spi_sf 0:0:M25P16:spi.bin
|
respectively, or "-d <file>" for your own dtb.
|
||||||
|
|
||||||
With this setup you can issue SPI flash commands as normal::
|
With this setup you can issue SPI flash commands as normal::
|
||||||
|
|
||||||
@ -346,22 +356,6 @@ also use low-level SPI commands::
|
|||||||
This is issuing a READ_ID command and getting back 20 (ST Micro) part
|
This is issuing a READ_ID command and getting back 20 (ST Micro) part
|
||||||
0x2015 (the M25P16).
|
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
|
|
||||||
|
|
||||||
|
|
||||||
Block Device Emulation
|
Block Device Emulation
|
||||||
----------------------
|
----------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user