]> git.ipfire.org Git - people/ms/u-boot.git/commit
spi, sf: Use offset and size in sf cmd from mtdpartition
authorHeiko Schocher <hs@denx.de>
Mon, 27 Apr 2015 05:42:06 +0000 (07:42 +0200)
committerJagan Teki <jteki@openedev.com>
Mon, 29 Jun 2015 19:10:11 +0000 (00:40 +0530)
commit2ec1a4059cd0421653b19979a046e9fb7296652f
tree2d2621d60218d6820825a7ad8c0c1673d79c2128
parent09c3280754f8f68a4d7fc0ee397a92b38c4f59e4
spi, sf: Use offset and size in sf cmd from mtdpartition

With this patch, it is possible to get the offset and size information
from the mtdpartiton setting in "mtdparts", similiar to the
"nand" commandos.

=> sf
sf - SPI flash sub-system

Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus
                                  and chip select
sf read addr offset|partition len       - read `len' bytes starting at
                                          `offset' to memory at `addr'
sf write addr offset|partition len      - write `len' bytes from memory
                                          at `addr' to flash at `offset'
sf erase offset|partition [+]len        - erase `len' bytes from `offset'
                                          `+len' round up `len' to block size
sf update addr offset|partition len     - erase and write `len' bytes from memory
                                          at `addr' to flash at `offset'
=>
for example "env" is defined in mtdparts:

=> sf read 13000000 env
device 0 offset 0xd0000, size 0x10000
SF: 65536 bytes @ 0xd0000 Read: OK

zynq-uboot> mtdparts add nor0 0x10000@0x0 env
zynq-uboot> sf erase env 0x10000
SF: 65536 bytes @ 0x0 Erased: OK

zynq-uboot> sf write 0x100 env
device 0 offset 0x0, size 0x10000
SF: 65536 bytes @ 0x0 Written: OK

zynq-uboot> sf read 0x40000 env
device 0 offset 0x0, size 0x10000
SF: 65536 bytes @ 0x0 Read: OK

Signed-off-by: Heiko Schocher <hs@denx.de>
Tested-by: Jagannadh Teki <jteki@openedev.com>
Reviewed-by: Jagannadh Teki <jteki@openedev.com>
common/cmd_sf.c