1.. SPDX-License-Identifier: GPL-2.0-or-later:
2
3read and write commands
4=======================
5
6Synopsis
7--------
8
9::
10
11    read <interface> <dev[:part|#partname]> <addr> <blk#> <cnt>
12    write <interface> <dev[:part|#partname]> <addr> <blk#> <cnt>
13
14The read and write commands can be used for raw access to data in
15block devices (or partitions therein), i.e. without going through a
16file system.
17
18read
19----
20
21The block device is specified using the <interface> (e.g. "mmc") and
22<dev> parameters. If the block device has a partition table, one can
23optionally specify a partition number (using the :part syntax) or
24partition name (using the #partname syntax). The command then reads
25the <cnt> blocks of data starting at block number <blk#> of the given
26device/partition to the memory address <addr>.
27
28write
29-----
30
31The write command is completely equivalent to the read command, except
32of course that the transfer direction is reversed.
33
34Examples
35--------
36
37    # Read 2 MiB from partition 3 of mmc device 2 to $loadaddr
38    read mmc 2.3 $loadaddr 0 0x1000
39
40    # Read 16 MiB from the partition named 'kernel' of mmc device 1 to $loadaddr
41    read mmc 1#kernel $loadaddr 0 0x8000
42
43    # Write to the third sector of the partition named 'bootdata' of mmc device 0
44    write mmc 0#bootdata $loadaddr 2 1
45