blob: 55e3f9cf98cb3ef4faf874490843d9c108c5e271 [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>
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
Jaehoon Chung07f26872021-05-10 16:04:02 +090043The 'mmc erase' command erases *cnt* blocks on the MMC device starting at block *blk#*.
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090044
45 blk#
46 start block offset
47 cnt
48 block count
49
50The 'mmc rescan' command scans the available MMC device.
51
Aswath Govindrajub8179592021-08-13 23:04:42 +053052 mode
53 speed mode to set.
Heinrich Schuchardt212f0782021-11-05 16:35:44 +010054 CONFIG_MMC_SPEED_MODE_SET should be enabled. The requested speed mode is
55 passed as a decimal number according to the following table:
Aswath Govindrajub8179592021-08-13 23:04:42 +053056
Heinrich Schuchardt212f0782021-11-05 16:35:44 +010057 ========== ==========================
58 Speed mode Description
59 ========== ==========================
60 0 MMC legacy
61 1 MMC High Speed (26MHz)
62 2 SD High Speed (50MHz)
63 3 MMC High Speed (52MHz)
64 4 MMC DDR52 (52MHz)
65 5 UHS SDR12 (25MHz)
66 6 UHS SDR25 (50MHz)
67 7 UHS SDR50 (100MHz)
68 8 UHS DDR50 (50MHz)
69 9 UHS SDR104 (208MHz)
70 10 HS200 (200MHz)
71 11 HS400 (200MHz)
72 12 HS400ES (200MHz)
73 ========== ==========================
Aswath Govindrajub8179592021-08-13 23:04:42 +053074
75 A speed mode can be set only if it has already been enabled in the device tree
76
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +090077The 'mmc part' command displays the list available partition on current mmc device.
78
79The 'mmc dev' command shows or set current mmc device.
80
81 dev
82 device number to change
83 part
84 partition number to change
85
Aswath Govindrajub8179592021-08-13 23:04:42 +053086 mode
87 speed mode to set.
Patrick Delaunay572934d2022-03-29 16:01:13 +020088 CONFIG_MMC_SPEED_MODE_SET should be enabled. The requested speed mode is
89 passed as a decimal number according to the following table:
Aswath Govindrajub8179592021-08-13 23:04:42 +053090
Patrick Delaunay572934d2022-03-29 16:01:13 +020091 ========== ==========================
92 Speed mode Description
93 ========== ==========================
94 0 MMC legacy
95 1 MMC High Speed (26MHz)
96 2 SD High Speed (50MHz)
97 3 MMC High Speed (52MHz)
98 4 MMC DDR52 (52MHz)
99 5 UHS SDR12 (25MHz)
100 6 UHS SDR25 (50MHz)
101 7 UHS SDR50 (100MHz)
102 8 UHS DDR50 (50MHz)
103 9 UHS SDR104 (208MHz)
104 10 HS200 (200MHz)
105 11 HS400 (200MHz)
106 12 HS400ES (200MHz)
107 ========== ==========================
Aswath Govindrajub8179592021-08-13 23:04:42 +0530108
109 A speed mode can be set only if it has already been enabled in the device tree
110
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900111The 'mmc list' command displays the list available devices.
112
113The 'mmc wp' command enables "power on write protect" function for boot partitions.
114
115The 'mmc bootbus' command sets the BOOT_BUS_WIDTH field. (*Refer to eMMC specification*)
116
117 boot_bus_width
118 0x0
119 x1 (sdr) or x4(ddr) buswidth in boot operation mode (default)
120 0x1
121 x4 (sdr/ddr) buswidth in boot operation mode
122 0x2
123 x8 (sdr/ddr) buswidth in boot operation mode
124 0x3
125 Reserved
126
127 reset_boot_bus_width
128 0x0
129 Reset buswidth to x1, Single data reate and backward compatible timing after boot operation (default)
130 0x1
131 Retain BOOT_BUS_WIDTH and BOOT_MODE value after boot operation. This is relevant to Push-pull mode operation only
132
133 boot_mode
134 0x0
135 Use single data rate + backward compatible timing in boot operation (default)
136 0x1
137 Use single data rate + High Speed timing in boot operation mode
138 0x2
139 Use dual data rate in boot operation
140 0x3
141 Reserved
142
143The 'mmc partconf' command shows or changes PARTITION_CONFIG field.
144
Reuben Dowle5c2beda2021-05-14 10:15:43 +1200145 varname
146 When showing the PARTITION_CONFIG, an optional environment variable to store the current boot_partition value into.
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900147 boot_ack
148 boot acknowledge value
149 boot_partition
150 boot partition to enable for boot
151 0x0
152 Device not boot enabled(default)
153 0x1
154 Boot partition1 enabled for boot
155 0x2
156 Boot partition2 enabled for boot
157 0x7
158 User area enabled for boot
159 others
160 Reserved
161 partition_access
162 partitions to access
163
164The 'mmc bootpart-resize' command changes sizes of boot and RPMB partitions.
Jaehoon Chung07f26872021-05-10 16:04:02 +0900165
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900166 dev
167 device number
168 boot part size MB
169 target size of boot partition
170 RPMB part size MB
171 target size of RPMB partition
172
173The 'mmc rst-function' command changes the RST_n_FUNCTION field.
174**WARNING** : This is a write-once field. (*Refer to eMMC specification*)
175
176 value
177 0x0
178 RST_n signal is temporarily disabled (default)
179 0x1
180 RST_n signal is permanently enabled
181 0x2
182 RST_n signal is permanently disabled
183 0x3
184 Reserved
185
186
187Examples
188--------
189
190The 'mmc info' command displays device's capabilities:
191::
192
193 => mmc info
194 Device: EXYNOS DWMMC
195 Manufacturer ID: 45
196 OEM: 100
197 Name: SDW16
198 Bus Speed: 52000000
199 Mode: MMC DDR52 (52MHz)
200 Rd Block Len: 512
201 MMC version 5.0
202 High Capacity: Yes
203 Capacity: 14.7 GiB
204 Bus Width: 8-bit DDR
205 Erase Group Size: 512 KiB
206 HC WP Group Size: 8 MiB
207 User Capacity: 14.7 GiB WRREL
208 Boot Capacity: 4 MiB ENH
209 RPMB Capacity: 4 MiB ENH
210 Boot area 0 is not write protected
211 Boot area 1 is not write protected
212
213The raw data can be read/written via 'mmc read/write' command:
214::
215
216 => mmc read 0x40000000 0x5000 0x100
217 MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
218
219 => mmc write 0x40000000 0x5000 0x10
220 MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
221
222The partition list can be shown via 'mmc part' command:
223::
224
225 => mmc part
226 Partition Map for MMC device 0 -- Partition Type: DOS
227
228 Part Start Sector Num Sectors UUID Type
229 1 8192 131072 dff8751a-01 0e Boot
230 2 139264 6291456 dff8751a-02 83
231 3 6430720 1048576 dff8751a-03 83
232 4 7479296 23298048 dff8751a-04 05 Extd
233 5 7481344 307200 dff8751a-05 83
234 6 7790592 65536 dff8751a-06 83
235 7 7858176 16384 dff8751a-07 83
236 8 7876608 22900736 dff8751a-08 83
237
238The current device can be shown or set via 'mmc dev' command:
239::
240
241 => mmc dev
242 switch to partitions #0, OK
243 mmc0(part0) is current device
244 => mmc dev 2 0
245 switch to partitions #0, OK
246 mmc2 is current device
Aswath Govindrajub8179592021-08-13 23:04:42 +0530247 => mmc dev 0 1 4
248 switch to partitions #1, OK
249 mmc0(part 1) is current device
Jaehoon Chung59ffe0e2021-04-02 09:15:32 +0900250
251The list of available devices can be shown via 'mmc list' command:
252::
253
254 => mmc list
255 mmc list
256 EXYNOS DWMMC: 0 (eMMC)
257 EXYNOS DWMMC: 2 (SD)
258
259Configuration
260-------------
261
262The mmc command is only available if CONFIG_CMD_MMC=y.
263Some commands need to enable more configuration.
264
265write, erase
266 CONFIG_MMC_WRITE
267bootbus, bootpart-resize, partconf, rst-function
268 CONFIG_SUPPORT_EMMC_BOOT=y