If SPI/QSPI Flash is supported in Uboot, then you can use SF's erase, read, and write command to manipulate SPI Flash
SF read is used to read flash data to memory
SF Write write memory data to Flash
SF Erase erase the specified position, specify the length of the Flash content, erase the content after 1
Specific Usage
SF probe [[Bus:]cs] [Hz] [mode]-init flash device on given SPI bus and chip select
SF Read addr offset len-read ' len ' bytes starting at ' offset ' to memory at ' addr '
SF Write addr offset len-write ' len ' bytes from memor in ' addr ' to flash at ' offset '
SF erase offset [+]len-erase ' len ' bytes from ' offset ' ' +len ' round Up ' len ' to block size
SF Update addr Offset len-erase and write ' len ' bytes from memory in ' addr ' to flash at ' offset '
usage Examples
SF probe
Be sure to call the SF probe before using the SF read SF write
SF Write 0x82000000 0x0 0x20000
Put the memory 0x8200 0000 data, write to flash offset 0x0, write data length of 0x20000 (128KB), operation offset and length of the smallest unit is byte
SF Read 0x82000000 0x10000 0x20000
The Flash offset 0x10000 (64KB), the length of 0x20000 (128KB) of data, written to the memory 0x82000000, operation offset and length of the smallest unit is byte
SF Erase 0x0 0x10000
Erases the erase block between the offset 0x0 and the 0x10000, and the erase operation is in erase blocks, requiring the offset and Len parameters to be erase block aligned
from the SF command, you can see several points:
1. SPI Flash has no OOB data, that is, no EDC ECC, no bad block management concept.
2. Support for byte-level read and write operations, support random access.
How to verify read-write effects
Can combine uboot MD command, SF Read, SF write all involve memory operation, can use MD to view memory data
MD 0x82000000 0X100
Print 0x82000000 start, length range 256 bytes of memory data