blob: c0924ba5769a1e002e4f9393d60ab1a9c4d76147 [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
Aswath Govindrajub8179592021-08-13 23:04:42 +053015 mmc rescan [mode]
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090016 mmc part
Aswath Govindrajub8179592021-08-13 23:04:42 +053017 mmc dev [dev] [part] [mode]
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090018 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>
Reuben Dowle5c2beda2021-05-14 10:15:43 +120022 mmc partconf <dev> [[varname] | [<boot_ack> <boot_partition> <partition_access>]]
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090023 mmc rst-function <dev> <value>
Marek Vasutb5f40392023-10-31 13:20:17 +010024 mmc reg read <reg> <offset> [env]
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090025
26Description
27-----------
28
29The mmc command is used to control MMC(eMMC/SD) device.
30
31The 'mmc info' command displays information (Manufacturer ID, OEM, Name, Bus Speed, Mode, ...) of MMC device.
32
33The 'mmc read' command reads raw data to memory address from MMC device with block offset and count.
34
35The 'mmc write' command writes raw data to MMC device from memory address with block offset and count.
36
37 addr
38 memory address
39 blk#
40 start block offset
41 cnt
42 block count
43
Jaehoon Chung07f26872021-05-10 16:04:02 +090044The 'mmc erase' command erases *cnt* blocks on the MMC device starting at block *blk#*.
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090045
46 blk#
47 start block offset
48 cnt
49 block count
50
51The 'mmc rescan' command scans the available MMC device.
52
Aswath Govindrajub8179592021-08-13 23:04:42 +053053 mode
54 speed mode to set.
Heinrich Schuchardt212f0782021-11-05 16:35:44 +010055 CONFIG_MMC_SPEED_MODE_SET should be enabled. The requested speed mode is
56 passed as a decimal number according to the following table:
Aswath Govindrajub8179592021-08-13 23:04:42 +053057
Heinrich Schuchardt212f0782021-11-05 16:35:44 +010058 ========== ==========================
59 Speed mode Description
60 ========== ==========================
61 0 MMC legacy
62 1 MMC High Speed (26MHz)
63 2 SD High Speed (50MHz)
64 3 MMC High Speed (52MHz)
65 4 MMC DDR52 (52MHz)
66 5 UHS SDR12 (25MHz)
67 6 UHS SDR25 (50MHz)
68 7 UHS SDR50 (100MHz)
69 8 UHS DDR50 (50MHz)
70 9 UHS SDR104 (208MHz)
71 10 HS200 (200MHz)
72 11 HS400 (200MHz)
73 12 HS400ES (200MHz)
74 ========== ==========================
Aswath Govindrajub8179592021-08-13 23:04:42 +053075
76 A speed mode can be set only if it has already been enabled in the device tree
77
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090078The 'mmc part' command displays the list available partition on current mmc device.
79
80The 'mmc dev' command shows or set current mmc device.
81
82 dev
83 device number to change
84 part
85 partition number to change
86
Aswath Govindrajub8179592021-08-13 23:04:42 +053087 mode
88 speed mode to set.
Patrick Delaunay572934d2022-03-29 16:01:13 +020089 CONFIG_MMC_SPEED_MODE_SET should be enabled. The requested speed mode is
90 passed as a decimal number according to the following table:
Aswath Govindrajub8179592021-08-13 23:04:42 +053091
Patrick Delaunay572934d2022-03-29 16:01:13 +020092 ========== ==========================
93 Speed mode Description
94 ========== ==========================
95 0 MMC legacy
96 1 MMC High Speed (26MHz)
97 2 SD High Speed (50MHz)
98 3 MMC High Speed (52MHz)
99 4 MMC DDR52 (52MHz)
100 5 UHS SDR12 (25MHz)
101 6 UHS SDR25 (50MHz)
102 7 UHS SDR50 (100MHz)
103 8 UHS DDR50 (50MHz)
104 9 UHS SDR104 (208MHz)
105 10 HS200 (200MHz)
106 11 HS400 (200MHz)
107 12 HS400ES (200MHz)
108 ========== ==========================
Aswath Govindrajub8179592021-08-13 23:04:42 +0530109
110 A speed mode can be set only if it has already been enabled in the device tree
111
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900112The 'mmc list' command displays the list available devices.
113
114The 'mmc wp' command enables "power on write protect" function for boot partitions.
115
116The 'mmc bootbus' command sets the BOOT_BUS_WIDTH field. (*Refer to eMMC specification*)
117
118 boot_bus_width
119 0x0
120 x1 (sdr) or x4(ddr) buswidth in boot operation mode (default)
121 0x1
122 x4 (sdr/ddr) buswidth in boot operation mode
123 0x2
124 x8 (sdr/ddr) buswidth in boot operation mode
125 0x3
126 Reserved
127
128 reset_boot_bus_width
129 0x0
130 Reset buswidth to x1, Single data reate and backward compatible timing after boot operation (default)
131 0x1
132 Retain BOOT_BUS_WIDTH and BOOT_MODE value after boot operation. This is relevant to Push-pull mode operation only
133
134 boot_mode
135 0x0
136 Use single data rate + backward compatible timing in boot operation (default)
137 0x1
138 Use single data rate + High Speed timing in boot operation mode
139 0x2
140 Use dual data rate in boot operation
141 0x3
142 Reserved
143
144The 'mmc partconf' command shows or changes PARTITION_CONFIG field.
145
Reuben Dowle5c2beda2021-05-14 10:15:43 +1200146 varname
147 When showing the PARTITION_CONFIG, an optional environment variable to store the current boot_partition value into.
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900148 boot_ack
149 boot acknowledge value
150 boot_partition
151 boot partition to enable for boot
152 0x0
153 Device not boot enabled(default)
154 0x1
155 Boot partition1 enabled for boot
156 0x2
157 Boot partition2 enabled for boot
158 0x7
159 User area enabled for boot
160 others
161 Reserved
162 partition_access
163 partitions to access
164
165The 'mmc bootpart-resize' command changes sizes of boot and RPMB partitions.
Jaehoon Chung07f26872021-05-10 16:04:02 +0900166
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900167 dev
168 device number
169 boot part size MB
170 target size of boot partition
171 RPMB part size MB
172 target size of RPMB partition
173
174The 'mmc rst-function' command changes the RST_n_FUNCTION field.
175**WARNING** : This is a write-once field. (*Refer to eMMC specification*)
176
177 value
178 0x0
179 RST_n signal is temporarily disabled (default)
180 0x1
181 RST_n signal is permanently enabled
182 0x2
183 RST_n signal is permanently disabled
184 0x3
185 Reserved
186
Marek Vasutb5f40392023-10-31 13:20:17 +0100187The 'mmc reg read <reg> <offset> [env]' reads eMMC card register and
188either print it to standard output, or store the value in environment
189variable.
190
191<reg> with
192optional offset <offset> into the register array, and print it to
193standard output or store it into environment variable [env].
194
195 reg
196 cid
197 The Device IDentification (CID) register. Uses offset.
198 csd
199 The Device-Specific Data (CSD) register. Uses offset.
200 dsr
201 The driver stage register (DSR).
202 ocr
203 The operation conditions register (OCR).
204 rca
205 The relative Device address (RCA) register.
206 extcsd
207 The Extended CSD register. Uses offset.
208 offset
209 For 'cid'/'csd' 128 bit registers '[0..3]' in 32-bit increments. For 'extcsd' 512 bit register '[0..512,all]' in 8-bit increments, or 'all' to read the entire register.
210 env
211 Optional environment variable into which 32-bit value read from register should be stored.
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900212
213Examples
214--------
215
216The 'mmc info' command displays device's capabilities:
217::
218
219 => mmc info
220 Device: EXYNOS DWMMC
221 Manufacturer ID: 45
222 OEM: 100
223 Name: SDW16
224 Bus Speed: 52000000
225 Mode: MMC DDR52 (52MHz)
226 Rd Block Len: 512
227 MMC version 5.0
228 High Capacity: Yes
229 Capacity: 14.7 GiB
230 Bus Width: 8-bit DDR
231 Erase Group Size: 512 KiB
232 HC WP Group Size: 8 MiB
233 User Capacity: 14.7 GiB WRREL
234 Boot Capacity: 4 MiB ENH
235 RPMB Capacity: 4 MiB ENH
236 Boot area 0 is not write protected
237 Boot area 1 is not write protected
238
239The raw data can be read/written via 'mmc read/write' command:
240::
241
Alexander Shirokov962424a2023-04-27 12:12:07 +0200242 => mmc read 40000000 5000 100
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900243 MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
244
Alexander Shirokov962424a2023-04-27 12:12:07 +0200245 => mmc write 40000000 5000 100
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900246 MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
247
248The partition list can be shown via 'mmc part' command:
249::
250
251 => mmc part
252 Partition Map for MMC device 0 -- Partition Type: DOS
253
254 Part Start Sector Num Sectors UUID Type
255 1 8192 131072 dff8751a-01 0e Boot
256 2 139264 6291456 dff8751a-02 83
257 3 6430720 1048576 dff8751a-03 83
258 4 7479296 23298048 dff8751a-04 05 Extd
259 5 7481344 307200 dff8751a-05 83
260 6 7790592 65536 dff8751a-06 83
261 7 7858176 16384 dff8751a-07 83
262 8 7876608 22900736 dff8751a-08 83
263
264The current device can be shown or set via 'mmc dev' command:
265::
266
267 => mmc dev
268 switch to partitions #0, OK
269 mmc0(part0) is current device
270 => mmc dev 2 0
271 switch to partitions #0, OK
272 mmc2 is current device
Aswath Govindrajub8179592021-08-13 23:04:42 +0530273 => mmc dev 0 1 4
274 switch to partitions #1, OK
275 mmc0(part 1) is current device
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900276
277The list of available devices can be shown via 'mmc list' command:
278::
279
280 => mmc list
281 mmc list
282 EXYNOS DWMMC: 0 (eMMC)
283 EXYNOS DWMMC: 2 (SD)
284
285Configuration
286-------------
287
288The mmc command is only available if CONFIG_CMD_MMC=y.
289Some commands need to enable more configuration.
290
291write, erase
292 CONFIG_MMC_WRITE
293bootbus, bootpart-resize, partconf, rst-function
294 CONFIG_SUPPORT_EMMC_BOOT=y