1.. 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> [[varname] | [<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 *cnt* blocks on the MMC device starting at block *blk#*. 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 varname 96 When showing the PARTITION_CONFIG, an optional environment variable to store the current boot_partition value into. 97 boot_ack 98 boot acknowledge value 99 boot_partition 100 boot partition to enable for boot 101 0x0 102 Device not boot enabled(default) 103 0x1 104 Boot partition1 enabled for boot 105 0x2 106 Boot partition2 enabled for boot 107 0x7 108 User area enabled for boot 109 others 110 Reserved 111 partition_access 112 partitions to access 113 114The 'mmc bootpart-resize' command changes sizes of boot and RPMB partitions. 115 116 dev 117 device number 118 boot part size MB 119 target size of boot partition 120 RPMB part size MB 121 target size of RPMB partition 122 123The 'mmc rst-function' command changes the RST_n_FUNCTION field. 124**WARNING** : This is a write-once field. (*Refer to eMMC specification*) 125 126 value 127 0x0 128 RST_n signal is temporarily disabled (default) 129 0x1 130 RST_n signal is permanently enabled 131 0x2 132 RST_n signal is permanently disabled 133 0x3 134 Reserved 135 136 137Examples 138-------- 139 140The 'mmc info' command displays device's capabilities: 141:: 142 143 => mmc info 144 Device: EXYNOS DWMMC 145 Manufacturer ID: 45 146 OEM: 100 147 Name: SDW16 148 Bus Speed: 52000000 149 Mode: MMC DDR52 (52MHz) 150 Rd Block Len: 512 151 MMC version 5.0 152 High Capacity: Yes 153 Capacity: 14.7 GiB 154 Bus Width: 8-bit DDR 155 Erase Group Size: 512 KiB 156 HC WP Group Size: 8 MiB 157 User Capacity: 14.7 GiB WRREL 158 Boot Capacity: 4 MiB ENH 159 RPMB Capacity: 4 MiB ENH 160 Boot area 0 is not write protected 161 Boot area 1 is not write protected 162 163The raw data can be read/written via 'mmc read/write' command: 164:: 165 166 => mmc read 0x40000000 0x5000 0x100 167 MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK 168 169 => mmc write 0x40000000 0x5000 0x10 170 MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK 171 172The partition list can be shown via 'mmc part' command: 173:: 174 175 => mmc part 176 Partition Map for MMC device 0 -- Partition Type: DOS 177 178 Part Start Sector Num Sectors UUID Type 179 1 8192 131072 dff8751a-01 0e Boot 180 2 139264 6291456 dff8751a-02 83 181 3 6430720 1048576 dff8751a-03 83 182 4 7479296 23298048 dff8751a-04 05 Extd 183 5 7481344 307200 dff8751a-05 83 184 6 7790592 65536 dff8751a-06 83 185 7 7858176 16384 dff8751a-07 83 186 8 7876608 22900736 dff8751a-08 83 187 188The current device can be shown or set via 'mmc dev' command: 189:: 190 191 => mmc dev 192 switch to partitions #0, OK 193 mmc0(part0) is current device 194 => mmc dev 2 0 195 switch to partitions #0, OK 196 mmc2 is current device 197 198The list of available devices can be shown via 'mmc list' command: 199:: 200 201 => mmc list 202 mmc list 203 EXYNOS DWMMC: 0 (eMMC) 204 EXYNOS DWMMC: 2 (SD) 205 206Configuration 207------------- 208 209The mmc command is only available if CONFIG_CMD_MMC=y. 210Some commands need to enable more configuration. 211 212write, erase 213 CONFIG_MMC_WRITE 214bootbus, bootpart-resize, partconf, rst-function 215 CONFIG_SUPPORT_EMMC_BOOT=y 216