mmc.rst 7.1 KB

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