blob: 57284ed6741e3b5866a8b2f5127c9352faaa94cb [file] [log] [blame]
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +09001.. SPDX-License-Identifier: GPL-2.0+:
2
3mmc command
4============
5
6Synopsis
7--------
8
9::
10
11 mmc info
12 mmc read addr blk# cnt
13 mmc write addr blk# cnt
14 mmc erase blk# cnt
15 mmc rescan
16 mmc part
17 mmc dev [dev] [part]
18 mmc list
19 mmc wp
20 mmc bootbus <dev> <boot_bus_width> <reset_boot_bus_width> <boot_mode>
21 mmc bootpart-resize <dev> <dev part size MB> <RPMB part size MB>
22 mmc partconf <dev> [boot_ack boot_partition partition_access]
23 mmc rst-function <dev> <value>
24
25Description
26-----------
27
28The mmc command is used to control MMC(eMMC/SD) device.
29
30The 'mmc info' command displays information (Manufacturer ID, OEM, Name, Bus Speed, Mode, ...) of MMC device.
31
32The 'mmc read' command reads raw data to memory address from MMC device with block offset and count.
33
34The 'mmc write' command writes raw data to MMC device from memory address with block offset and count.
35
36 addr
37 memory address
38 blk#
39 start block offset
40 cnt
41 block count
42
43The 'mmc erase' command erases MMC device from block offset until count.
44
45 blk#
46 start block offset
47 cnt
48 block count
49
50The 'mmc rescan' command scans the available MMC device.
51
52The 'mmc part' command displays the list available partition on current mmc device.
53
54The 'mmc dev' command shows or set current mmc device.
55
56 dev
57 device number to change
58 part
59 partition number to change
60
61The 'mmc list' command displays the list available devices.
62
63The 'mmc wp' command enables "power on write protect" function for boot partitions.
64
65The 'mmc bootbus' command sets the BOOT_BUS_WIDTH field. (*Refer to eMMC specification*)
66
67 boot_bus_width
68 0x0
69 x1 (sdr) or x4(ddr) buswidth in boot operation mode (default)
70 0x1
71 x4 (sdr/ddr) buswidth in boot operation mode
72 0x2
73 x8 (sdr/ddr) buswidth in boot operation mode
74 0x3
75 Reserved
76
77 reset_boot_bus_width
78 0x0
79 Reset buswidth to x1, Single data reate and backward compatible timing after boot operation (default)
80 0x1
81 Retain BOOT_BUS_WIDTH and BOOT_MODE value after boot operation. This is relevant to Push-pull mode operation only
82
83 boot_mode
84 0x0
85 Use single data rate + backward compatible timing in boot operation (default)
86 0x1
87 Use single data rate + High Speed timing in boot operation mode
88 0x2
89 Use dual data rate in boot operation
90 0x3
91 Reserved
92
93The 'mmc partconf' command shows or changes PARTITION_CONFIG field.
94
95 boot_ack
96 boot acknowledge value
97 boot_partition
98 boot partition to enable for boot
99 0x0
100 Device not boot enabled(default)
101 0x1
102 Boot partition1 enabled for boot
103 0x2
104 Boot partition2 enabled for boot
105 0x7
106 User area enabled for boot
107 others
108 Reserved
109 partition_access
110 partitions to access
111
112The 'mmc bootpart-resize' command changes sizes of boot and RPMB partitions.
113 dev
114 device number
115 boot part size MB
116 target size of boot partition
117 RPMB part size MB
118 target size of RPMB partition
119
120The 'mmc rst-function' command changes the RST_n_FUNCTION field.
121**WARNING** : This is a write-once field. (*Refer to eMMC specification*)
122
123 value
124 0x0
125 RST_n signal is temporarily disabled (default)
126 0x1
127 RST_n signal is permanently enabled
128 0x2
129 RST_n signal is permanently disabled
130 0x3
131 Reserved
132
133
134Examples
135--------
136
137The 'mmc info' command displays device's capabilities:
138::
139
140 => mmc info
141 Device: EXYNOS DWMMC
142 Manufacturer ID: 45
143 OEM: 100
144 Name: SDW16
145 Bus Speed: 52000000
146 Mode: MMC DDR52 (52MHz)
147 Rd Block Len: 512
148 MMC version 5.0
149 High Capacity: Yes
150 Capacity: 14.7 GiB
151 Bus Width: 8-bit DDR
152 Erase Group Size: 512 KiB
153 HC WP Group Size: 8 MiB
154 User Capacity: 14.7 GiB WRREL
155 Boot Capacity: 4 MiB ENH
156 RPMB Capacity: 4 MiB ENH
157 Boot area 0 is not write protected
158 Boot area 1 is not write protected
159
160The raw data can be read/written via 'mmc read/write' command:
161::
162
163 => mmc read 0x40000000 0x5000 0x100
164 MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
165
166 => mmc write 0x40000000 0x5000 0x10
167 MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
168
169The partition list can be shown via 'mmc part' command:
170::
171
172 => mmc part
173 Partition Map for MMC device 0 -- Partition Type: DOS
174
175 Part Start Sector Num Sectors UUID Type
176 1 8192 131072 dff8751a-01 0e Boot
177 2 139264 6291456 dff8751a-02 83
178 3 6430720 1048576 dff8751a-03 83
179 4 7479296 23298048 dff8751a-04 05 Extd
180 5 7481344 307200 dff8751a-05 83
181 6 7790592 65536 dff8751a-06 83
182 7 7858176 16384 dff8751a-07 83
183 8 7876608 22900736 dff8751a-08 83
184
185The current device can be shown or set via 'mmc dev' command:
186::
187
188 => mmc dev
189 switch to partitions #0, OK
190 mmc0(part0) is current device
191 => mmc dev 2 0
192 switch to partitions #0, OK
193 mmc2 is current device
194
195The list of available devices can be shown via 'mmc list' command:
196::
197
198 => mmc list
199 mmc list
200 EXYNOS DWMMC: 0 (eMMC)
201 EXYNOS DWMMC: 2 (SD)
202
203Configuration
204-------------
205
206The mmc command is only available if CONFIG_CMD_MMC=y.
207Some commands need to enable more configuration.
208
209write, erase
210 CONFIG_MMC_WRITE
211bootbus, bootpart-resize, partconf, rst-function
212 CONFIG_SUPPORT_EMMC_BOOT=y