Jaehoon Chung | 277b7cd | 2021-04-02 09:15:32 +0900 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | mmc command |
| 4 | ============ |
| 5 | |
| 6 | Synopsis |
| 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 | |
| 25 | Description |
| 26 | ----------- |
| 27 | |
| 28 | The mmc command is used to control MMC(eMMC/SD) device. |
| 29 | |
| 30 | The 'mmc info' command displays information (Manufacturer ID, OEM, Name, Bus Speed, Mode, ...) of MMC device. |
| 31 | |
| 32 | The 'mmc read' command reads raw data to memory address from MMC device with block offset and count. |
| 33 | |
| 34 | The '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 Chung | f14d260 | 2021-05-10 16:04:02 +0900 | [diff] [blame] | 43 | The 'mmc erase' command erases *cnt* blocks on the MMC device starting at block *blk#*. |
Jaehoon Chung | 277b7cd | 2021-04-02 09:15:32 +0900 | [diff] [blame] | 44 | |
| 45 | blk# |
| 46 | start block offset |
| 47 | cnt |
| 48 | block count |
| 49 | |
| 50 | The 'mmc rescan' command scans the available MMC device. |
| 51 | |
| 52 | The 'mmc part' command displays the list available partition on current mmc device. |
| 53 | |
| 54 | The '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 | |
| 61 | The 'mmc list' command displays the list available devices. |
| 62 | |
| 63 | The 'mmc wp' command enables "power on write protect" function for boot partitions. |
| 64 | |
| 65 | The '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 | |
| 93 | The '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 | |
| 112 | The 'mmc bootpart-resize' command changes sizes of boot and RPMB partitions. |
Jaehoon Chung | f14d260 | 2021-05-10 16:04:02 +0900 | [diff] [blame] | 113 | |
Jaehoon Chung | 277b7cd | 2021-04-02 09:15:32 +0900 | [diff] [blame] | 114 | dev |
| 115 | device number |
| 116 | boot part size MB |
| 117 | target size of boot partition |
| 118 | RPMB part size MB |
| 119 | target size of RPMB partition |
| 120 | |
| 121 | The 'mmc rst-function' command changes the RST_n_FUNCTION field. |
| 122 | **WARNING** : This is a write-once field. (*Refer to eMMC specification*) |
| 123 | |
| 124 | value |
| 125 | 0x0 |
| 126 | RST_n signal is temporarily disabled (default) |
| 127 | 0x1 |
| 128 | RST_n signal is permanently enabled |
| 129 | 0x2 |
| 130 | RST_n signal is permanently disabled |
| 131 | 0x3 |
| 132 | Reserved |
| 133 | |
| 134 | |
| 135 | Examples |
| 136 | -------- |
| 137 | |
| 138 | The 'mmc info' command displays device's capabilities: |
| 139 | :: |
| 140 | |
| 141 | => mmc info |
| 142 | Device: EXYNOS DWMMC |
| 143 | Manufacturer ID: 45 |
| 144 | OEM: 100 |
| 145 | Name: SDW16 |
| 146 | Bus Speed: 52000000 |
| 147 | Mode: MMC DDR52 (52MHz) |
| 148 | Rd Block Len: 512 |
| 149 | MMC version 5.0 |
| 150 | High Capacity: Yes |
| 151 | Capacity: 14.7 GiB |
| 152 | Bus Width: 8-bit DDR |
| 153 | Erase Group Size: 512 KiB |
| 154 | HC WP Group Size: 8 MiB |
| 155 | User Capacity: 14.7 GiB WRREL |
| 156 | Boot Capacity: 4 MiB ENH |
| 157 | RPMB Capacity: 4 MiB ENH |
| 158 | Boot area 0 is not write protected |
| 159 | Boot area 1 is not write protected |
| 160 | |
| 161 | The raw data can be read/written via 'mmc read/write' command: |
| 162 | :: |
| 163 | |
| 164 | => mmc read 0x40000000 0x5000 0x100 |
| 165 | MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK |
| 166 | |
| 167 | => mmc write 0x40000000 0x5000 0x10 |
| 168 | MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK |
| 169 | |
| 170 | The partition list can be shown via 'mmc part' command: |
| 171 | :: |
| 172 | |
| 173 | => mmc part |
| 174 | Partition Map for MMC device 0 -- Partition Type: DOS |
| 175 | |
| 176 | Part Start Sector Num Sectors UUID Type |
| 177 | 1 8192 131072 dff8751a-01 0e Boot |
| 178 | 2 139264 6291456 dff8751a-02 83 |
| 179 | 3 6430720 1048576 dff8751a-03 83 |
| 180 | 4 7479296 23298048 dff8751a-04 05 Extd |
| 181 | 5 7481344 307200 dff8751a-05 83 |
| 182 | 6 7790592 65536 dff8751a-06 83 |
| 183 | 7 7858176 16384 dff8751a-07 83 |
| 184 | 8 7876608 22900736 dff8751a-08 83 |
| 185 | |
| 186 | The current device can be shown or set via 'mmc dev' command: |
| 187 | :: |
| 188 | |
| 189 | => mmc dev |
| 190 | switch to partitions #0, OK |
| 191 | mmc0(part0) is current device |
| 192 | => mmc dev 2 0 |
| 193 | switch to partitions #0, OK |
| 194 | mmc2 is current device |
| 195 | |
| 196 | The list of available devices can be shown via 'mmc list' command: |
| 197 | :: |
| 198 | |
| 199 | => mmc list |
| 200 | mmc list |
| 201 | EXYNOS DWMMC: 0 (eMMC) |
| 202 | EXYNOS DWMMC: 2 (SD) |
| 203 | |
| 204 | Configuration |
| 205 | ------------- |
| 206 | |
| 207 | The mmc command is only available if CONFIG_CMD_MMC=y. |
| 208 | Some commands need to enable more configuration. |
| 209 | |
| 210 | write, erase |
| 211 | CONFIG_MMC_WRITE |
| 212 | bootbus, bootpart-resize, partconf, rst-function |
| 213 | CONFIG_SUPPORT_EMMC_BOOT=y |