blob: 5a0b0f660754c4b4ef72223967b9181cb971791c [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenk71f95112003-06-15 22:40:42 +00002/*
3 * (C) Copyright 2003
4 * Kyle Harris, kharris@nexus-tech.net
wdenk71f95112003-06-15 22:40:42 +00005 */
6
7#include <common.h>
8#include <command.h>
Simon Glass24b852a2015-11-08 23:47:45 -07009#include <console.h>
wdenk71f95112003-06-15 22:40:42 +000010#include <mmc.h>
11
Mike Frysinger02e22c22009-06-14 21:35:21 -040012static int curr_device = -1;
Andy Fleming272cc702008-10-30 16:41:01 -050013
14static void print_mmcinfo(struct mmc *mmc)
15{
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010016 int i;
17
Pantelis Antoniou93bfd612014-03-11 19:34:20 +020018 printf("Device: %s\n", mmc->cfg->name);
Andy Fleming272cc702008-10-30 16:41:01 -050019 printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24);
20 printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff);
21 printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff,
22 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff,
23 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
24
Jean-Jacques Hiblot7a96ec72017-09-21 16:29:56 +020025 printf("Bus Speed: %d\n", mmc->clock);
Jean-Jacques Hiblot52d241d2017-11-30 17:43:54 +010026#if CONFIG_IS_ENABLED(MMC_VERBOSE)
Jean-Jacques Hiblot7a96ec72017-09-21 16:29:56 +020027 printf("Mode : %s\n", mmc_mode_name(mmc->selected_mode));
Jean-Jacques Hiblot52d241d2017-11-30 17:43:54 +010028 mmc_dump_capabilities("card capabilities", mmc->card_caps);
29 mmc_dump_capabilities("host capabilities", mmc->host_caps);
30#endif
Andy Fleming272cc702008-10-30 16:41:01 -050031 printf("Rd Block Len: %d\n", mmc->read_bl_len);
32
Pantelis Antoniou4b7cee52015-01-23 12:12:01 +020033 printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC",
34 EXTRACT_SDMMC_MAJOR_VERSION(mmc->version),
35 EXTRACT_SDMMC_MINOR_VERSION(mmc->version));
36 if (EXTRACT_SDMMC_CHANGE_VERSION(mmc->version) != 0)
37 printf(".%d", EXTRACT_SDMMC_CHANGE_VERSION(mmc->version));
38 printf("\n");
Andy Fleming272cc702008-10-30 16:41:01 -050039
40 printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No");
Minkyu Kang940e0782011-01-04 01:04:19 +000041 puts("Capacity: ");
42 print_size(mmc->capacity, "\n");
Andy Fleming272cc702008-10-30 16:41:01 -050043
Andrew Gabbasov786e8f82014-12-01 06:59:09 -060044 printf("Bus Width: %d-bit%s\n", mmc->bus_width,
45 mmc->ddr_mode ? " DDR" : "");
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010046
Jean-Jacques Hiblote6fa5a52018-01-04 15:23:34 +010047#if CONFIG_IS_ENABLED(MMC_WRITE)
Diego Santa Cruzb0361522014-12-23 10:50:26 +010048 puts("Erase Group Size: ");
49 print_size(((u64)mmc->erase_grp_size) << 9, "\n");
Jean-Jacques Hiblote6fa5a52018-01-04 15:23:34 +010050#endif
Diego Santa Cruzb0361522014-12-23 10:50:26 +010051
Diego Santa Cruz525ada22014-12-23 10:50:19 +010052 if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4_41) {
Diego Santa Cruzc3dbb4f2014-12-23 10:50:17 +010053 bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0;
Diego Santa Cruzbeb98a12014-12-23 10:50:23 +010054 bool usr_enh = has_enh && (mmc->part_attr & EXT_CSD_ENH_USR);
Diego Santa Cruzb0361522014-12-23 10:50:26 +010055
Jean-Jacques Hiblotb7a6e2c2018-01-04 15:23:36 +010056#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
Diego Santa Cruzb0361522014-12-23 10:50:26 +010057 puts("HC WP Group Size: ");
58 print_size(((u64)mmc->hc_wp_grp_size) << 9, "\n");
Jean-Jacques Hiblotb7a6e2c2018-01-04 15:23:36 +010059#endif
Diego Santa Cruzb0361522014-12-23 10:50:26 +010060
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010061 puts("User Capacity: ");
Diego Santa Cruz9e41a002014-12-23 10:50:33 +010062 print_size(mmc->capacity_user, usr_enh ? " ENH" : "");
63 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_USR)
64 puts(" WRREL\n");
65 else
66 putc('\n');
Diego Santa Cruzbeb98a12014-12-23 10:50:23 +010067 if (usr_enh) {
68 puts("User Enhanced Start: ");
69 print_size(mmc->enh_user_start, "\n");
70 puts("User Enhanced Size: ");
71 print_size(mmc->enh_user_size, "\n");
72 }
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010073 puts("Boot Capacity: ");
Diego Santa Cruzc3dbb4f2014-12-23 10:50:17 +010074 print_size(mmc->capacity_boot, has_enh ? " ENH\n" : "\n");
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010075 puts("RPMB Capacity: ");
Diego Santa Cruzc3dbb4f2014-12-23 10:50:17 +010076 print_size(mmc->capacity_rpmb, has_enh ? " ENH\n" : "\n");
Diego Santa Cruzb0361522014-12-23 10:50:26 +010077
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010078 for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) {
Diego Santa Cruzc3dbb4f2014-12-23 10:50:17 +010079 bool is_enh = has_enh &&
80 (mmc->part_attr & EXT_CSD_ENH_GP(i));
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010081 if (mmc->capacity_gp[i]) {
Diego Santa Cruzf289fd72014-12-23 10:50:18 +010082 printf("GP%i Capacity: ", i+1);
Diego Santa Cruzc3dbb4f2014-12-23 10:50:17 +010083 print_size(mmc->capacity_gp[i],
Diego Santa Cruz9e41a002014-12-23 10:50:33 +010084 is_enh ? " ENH" : "");
85 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_GP(i))
86 puts(" WRREL\n");
87 else
88 putc('\n');
Diego Santa Cruzc5f0d3f2014-12-23 10:50:16 +010089 }
90 }
91 }
Andy Fleming272cc702008-10-30 16:41:01 -050092}
Stephen Warren1ae24a52014-05-23 13:24:45 -060093static struct mmc *init_mmc_device(int dev, bool force_init)
Pierre Aubert1fd93c62014-04-24 10:30:08 +020094{
95 struct mmc *mmc;
96 mmc = find_mmc_device(dev);
97 if (!mmc) {
98 printf("no mmc device at slot %x\n", dev);
99 return NULL;
100 }
Eric Nelsonbcfde7f2016-03-27 12:00:14 -0700101
Stephen Warren1ae24a52014-05-23 13:24:45 -0600102 if (force_init)
103 mmc->has_init = 0;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200104 if (mmc_init(mmc))
105 return NULL;
106 return mmc;
107}
Kim Phillips088f1b12012-10-29 13:34:31 +0000108static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Andy Fleming272cc702008-10-30 16:41:01 -0500109{
110 struct mmc *mmc;
Andy Fleming272cc702008-10-30 16:41:01 -0500111
Lei Wenea6ebe22011-05-02 16:26:25 +0000112 if (curr_device < 0) {
113 if (get_mmc_num() > 0)
114 curr_device = 0;
115 else {
116 puts("No MMC device available\n");
117 return 1;
118 }
119 }
Andy Fleming272cc702008-10-30 16:41:01 -0500120
Stephen Warren1ae24a52014-05-23 13:24:45 -0600121 mmc = init_mmc_device(curr_device, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200122 if (!mmc)
123 return CMD_RET_FAILURE;
Andy Fleming272cc702008-10-30 16:41:01 -0500124
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200125 print_mmcinfo(mmc);
126 return CMD_RET_SUCCESS;
Andy Fleming272cc702008-10-30 16:41:01 -0500127}
128
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200129#ifdef CONFIG_SUPPORT_EMMC_RPMB
130static int confirm_key_prog(void)
131{
132 puts("Warning: Programming authentication key can be done only once !\n"
133 " Use this command only if you are sure of what you are doing,\n"
134 "Really perform the key programming? <y/N> ");
135 if (confirm_yesno())
136 return 1;
137
138 puts("Authentication key programming aborted\n");
139 return 0;
140}
141static int do_mmcrpmb_key(cmd_tbl_t *cmdtp, int flag,
142 int argc, char * const argv[])
143{
144 void *key_addr;
145 struct mmc *mmc = find_mmc_device(curr_device);
146
147 if (argc != 2)
148 return CMD_RET_USAGE;
149
150 key_addr = (void *)simple_strtoul(argv[1], NULL, 16);
151 if (!confirm_key_prog())
152 return CMD_RET_FAILURE;
153 if (mmc_rpmb_set_key(mmc, key_addr)) {
154 printf("ERROR - Key already programmed ?\n");
155 return CMD_RET_FAILURE;
156 }
157 return CMD_RET_SUCCESS;
158}
159static int do_mmcrpmb_read(cmd_tbl_t *cmdtp, int flag,
160 int argc, char * const argv[])
161{
162 u16 blk, cnt;
163 void *addr;
164 int n;
165 void *key_addr = NULL;
166 struct mmc *mmc = find_mmc_device(curr_device);
167
168 if (argc < 4)
169 return CMD_RET_USAGE;
170
171 addr = (void *)simple_strtoul(argv[1], NULL, 16);
172 blk = simple_strtoul(argv[2], NULL, 16);
173 cnt = simple_strtoul(argv[3], NULL, 16);
174
175 if (argc == 5)
176 key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
177
178 printf("\nMMC RPMB read: dev # %d, block # %d, count %d ... ",
179 curr_device, blk, cnt);
180 n = mmc_rpmb_read(mmc, addr, blk, cnt, key_addr);
181
182 printf("%d RPMB blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR");
183 if (n != cnt)
184 return CMD_RET_FAILURE;
185 return CMD_RET_SUCCESS;
186}
187static int do_mmcrpmb_write(cmd_tbl_t *cmdtp, int flag,
188 int argc, char * const argv[])
189{
190 u16 blk, cnt;
191 void *addr;
192 int n;
193 void *key_addr;
194 struct mmc *mmc = find_mmc_device(curr_device);
195
196 if (argc != 5)
197 return CMD_RET_USAGE;
198
199 addr = (void *)simple_strtoul(argv[1], NULL, 16);
200 blk = simple_strtoul(argv[2], NULL, 16);
201 cnt = simple_strtoul(argv[3], NULL, 16);
202 key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
203
204 printf("\nMMC RPMB write: dev # %d, block # %d, count %d ... ",
205 curr_device, blk, cnt);
206 n = mmc_rpmb_write(mmc, addr, blk, cnt, key_addr);
207
208 printf("%d RPMB blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR");
209 if (n != cnt)
210 return CMD_RET_FAILURE;
211 return CMD_RET_SUCCESS;
212}
213static int do_mmcrpmb_counter(cmd_tbl_t *cmdtp, int flag,
214 int argc, char * const argv[])
215{
216 unsigned long counter;
217 struct mmc *mmc = find_mmc_device(curr_device);
218
219 if (mmc_rpmb_get_counter(mmc, &counter))
220 return CMD_RET_FAILURE;
221 printf("RPMB Write counter= %lx\n", counter);
222 return CMD_RET_SUCCESS;
223}
224
225static cmd_tbl_t cmd_rpmb[] = {
226 U_BOOT_CMD_MKENT(key, 2, 0, do_mmcrpmb_key, "", ""),
227 U_BOOT_CMD_MKENT(read, 5, 1, do_mmcrpmb_read, "", ""),
228 U_BOOT_CMD_MKENT(write, 5, 0, do_mmcrpmb_write, "", ""),
229 U_BOOT_CMD_MKENT(counter, 1, 1, do_mmcrpmb_counter, "", ""),
230};
231
232static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
233 int argc, char * const argv[])
234{
235 cmd_tbl_t *cp;
236 struct mmc *mmc;
237 char original_part;
238 int ret;
239
240 cp = find_cmd_tbl(argv[1], cmd_rpmb, ARRAY_SIZE(cmd_rpmb));
241
242 /* Drop the rpmb subcommand */
243 argc--;
244 argv++;
245
246 if (cp == NULL || argc > cp->maxargs)
247 return CMD_RET_USAGE;
248 if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
249 return CMD_RET_SUCCESS;
250
Stephen Warren1ae24a52014-05-23 13:24:45 -0600251 mmc = init_mmc_device(curr_device, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200252 if (!mmc)
253 return CMD_RET_FAILURE;
254
255 if (!(mmc->version & MMC_VERSION_MMC)) {
256 printf("It is not a EMMC device\n");
257 return CMD_RET_FAILURE;
258 }
259 if (mmc->version < MMC_VERSION_4_41) {
260 printf("RPMB not supported before version 4.41\n");
261 return CMD_RET_FAILURE;
262 }
263 /* Switch to the RPMB partition */
Kever Yang4dc80c82017-06-08 09:20:03 +0800264#ifndef CONFIG_BLK
Marek Vasutb955e422016-05-04 16:35:25 +0200265 original_part = mmc->block_dev.hwpart;
Kever Yang4dc80c82017-06-08 09:20:03 +0800266#else
267 original_part = mmc_get_blk_desc(mmc)->hwpart;
268#endif
Simon Glass69f45cd2016-05-01 13:52:29 -0600269 if (blk_select_hwpart_devnum(IF_TYPE_MMC, curr_device, MMC_PART_RPMB) !=
270 0)
Stephen Warren873cc1d2015-12-07 11:38:49 -0700271 return CMD_RET_FAILURE;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200272 ret = cp->cmd(cmdtp, flag, argc, argv);
273
274 /* Return to original partition */
Simon Glass69f45cd2016-05-01 13:52:29 -0600275 if (blk_select_hwpart_devnum(IF_TYPE_MMC, curr_device, original_part) !=
276 0)
Stephen Warren873cc1d2015-12-07 11:38:49 -0700277 return CMD_RET_FAILURE;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200278 return ret;
279}
280#endif
281
282static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
283 int argc, char * const argv[])
284{
285 struct mmc *mmc;
286 u32 blk, cnt, n;
287 void *addr;
288
289 if (argc != 4)
290 return CMD_RET_USAGE;
291
292 addr = (void *)simple_strtoul(argv[1], NULL, 16);
293 blk = simple_strtoul(argv[2], NULL, 16);
294 cnt = simple_strtoul(argv[3], NULL, 16);
295
Stephen Warren1ae24a52014-05-23 13:24:45 -0600296 mmc = init_mmc_device(curr_device, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200297 if (!mmc)
298 return CMD_RET_FAILURE;
299
300 printf("\nMMC read: dev # %d, block # %d, count %d ... ",
301 curr_device, blk, cnt);
302
Simon Glassc40fdca2016-05-01 13:52:35 -0600303 n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200304 printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR");
305
306 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
307}
Jean-Jacques Hiblote6fa5a52018-01-04 15:23:34 +0100308
309#if CONFIG_IS_ENABLED(MMC_WRITE)
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200310static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
311 int argc, char * const argv[])
312{
313 struct mmc *mmc;
314 u32 blk, cnt, n;
315 void *addr;
316
317 if (argc != 4)
318 return CMD_RET_USAGE;
319
320 addr = (void *)simple_strtoul(argv[1], NULL, 16);
321 blk = simple_strtoul(argv[2], NULL, 16);
322 cnt = simple_strtoul(argv[3], NULL, 16);
323
Stephen Warren1ae24a52014-05-23 13:24:45 -0600324 mmc = init_mmc_device(curr_device, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200325 if (!mmc)
326 return CMD_RET_FAILURE;
327
328 printf("\nMMC write: dev # %d, block # %d, count %d ... ",
329 curr_device, blk, cnt);
330
331 if (mmc_getwp(mmc) == 1) {
332 printf("Error: card is write protected!\n");
333 return CMD_RET_FAILURE;
334 }
Simon Glassc40fdca2016-05-01 13:52:35 -0600335 n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200336 printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR");
337
338 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
339}
340static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag,
341 int argc, char * const argv[])
342{
343 struct mmc *mmc;
344 u32 blk, cnt, n;
345
346 if (argc != 3)
347 return CMD_RET_USAGE;
348
349 blk = simple_strtoul(argv[1], NULL, 16);
350 cnt = simple_strtoul(argv[2], NULL, 16);
351
Stephen Warren1ae24a52014-05-23 13:24:45 -0600352 mmc = init_mmc_device(curr_device, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200353 if (!mmc)
354 return CMD_RET_FAILURE;
355
356 printf("\nMMC erase: dev # %d, block # %d, count %d ... ",
357 curr_device, blk, cnt);
358
359 if (mmc_getwp(mmc) == 1) {
360 printf("Error: card is write protected!\n");
361 return CMD_RET_FAILURE;
362 }
Simon Glassc40fdca2016-05-01 13:52:35 -0600363 n = blk_derase(mmc_get_blk_desc(mmc), blk, cnt);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200364 printf("%d blocks erased: %s\n", n, (n == cnt) ? "OK" : "ERROR");
365
366 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
367}
Jean-Jacques Hiblote6fa5a52018-01-04 15:23:34 +0100368#endif
369
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200370static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
371 int argc, char * const argv[])
372{
373 struct mmc *mmc;
374
Stephen Warren941944e2014-05-23 13:24:46 -0600375 mmc = init_mmc_device(curr_device, true);
376 if (!mmc)
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200377 return CMD_RET_FAILURE;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200378
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200379 return CMD_RET_SUCCESS;
380}
381static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
382 int argc, char * const argv[])
383{
Simon Glass4101f682016-02-29 15:25:34 -0700384 struct blk_desc *mmc_dev;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200385 struct mmc *mmc;
386
Stephen Warren1ae24a52014-05-23 13:24:45 -0600387 mmc = init_mmc_device(curr_device, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200388 if (!mmc)
389 return CMD_RET_FAILURE;
390
Simon Glass3c457f42016-05-01 11:36:15 -0600391 mmc_dev = blk_get_devnum_by_type(IF_TYPE_MMC, curr_device);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200392 if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
Simon Glass3e8bd462016-02-29 15:25:48 -0700393 part_print(mmc_dev);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200394 return CMD_RET_SUCCESS;
395 }
396
397 puts("get mmc type error!\n");
398 return CMD_RET_FAILURE;
399}
400static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
401 int argc, char * const argv[])
402{
Stephen Warren60dc58f2014-05-23 12:48:10 -0600403 int dev, part = 0, ret;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200404 struct mmc *mmc;
405
406 if (argc == 1) {
407 dev = curr_device;
408 } else if (argc == 2) {
409 dev = simple_strtoul(argv[1], NULL, 10);
410 } else if (argc == 3) {
411 dev = (int)simple_strtoul(argv[1], NULL, 10);
412 part = (int)simple_strtoul(argv[2], NULL, 10);
413 if (part > PART_ACCESS_MASK) {
414 printf("#part_num shouldn't be larger than %d\n",
415 PART_ACCESS_MASK);
416 return CMD_RET_FAILURE;
417 }
418 } else {
419 return CMD_RET_USAGE;
420 }
421
Stephen Warrena5710922014-05-23 13:24:47 -0600422 mmc = init_mmc_device(dev, true);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200423 if (!mmc)
424 return CMD_RET_FAILURE;
425
Simon Glass69f45cd2016-05-01 13:52:29 -0600426 ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part);
Stephen Warren60dc58f2014-05-23 12:48:10 -0600427 printf("switch to partitions #%d, %s\n",
428 part, (!ret) ? "OK" : "ERROR");
429 if (ret)
430 return 1;
431
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200432 curr_device = dev;
433 if (mmc->part_config == MMCPART_NOAVAILABLE)
434 printf("mmc%d is current device\n", curr_device);
435 else
436 printf("mmc%d(part %d) is current device\n",
Simon Glassc40fdca2016-05-01 13:52:35 -0600437 curr_device, mmc_get_blk_desc(mmc)->hwpart);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200438
439 return CMD_RET_SUCCESS;
440}
441static int do_mmc_list(cmd_tbl_t *cmdtp, int flag,
442 int argc, char * const argv[])
443{
444 print_mmc_devices('\n');
445 return CMD_RET_SUCCESS;
446}
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100447
Jean-Jacques Hiblotcf177892017-11-30 17:44:02 +0100448#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100449static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
450 int argc, char * const argv[])
451{
452 int i = 0;
453
454 memset(&pconf->user, 0, sizeof(pconf->user));
455
456 while (i < argc) {
457 if (!strcmp(argv[i], "enh")) {
458 if (i + 2 >= argc)
459 return -1;
460 pconf->user.enh_start =
461 simple_strtoul(argv[i+1], NULL, 10);
462 pconf->user.enh_size =
463 simple_strtoul(argv[i+2], NULL, 10);
464 i += 3;
465 } else if (!strcmp(argv[i], "wrrel")) {
466 if (i + 1 >= argc)
467 return -1;
468 pconf->user.wr_rel_change = 1;
469 if (!strcmp(argv[i+1], "on"))
470 pconf->user.wr_rel_set = 1;
471 else if (!strcmp(argv[i+1], "off"))
472 pconf->user.wr_rel_set = 0;
473 else
474 return -1;
475 i += 2;
476 } else {
477 break;
478 }
479 }
480 return i;
481}
482
483static int parse_hwpart_gp(struct mmc_hwpart_conf *pconf, int pidx,
484 int argc, char * const argv[])
485{
486 int i;
487
488 memset(&pconf->gp_part[pidx], 0, sizeof(pconf->gp_part[pidx]));
489
490 if (1 >= argc)
491 return -1;
492 pconf->gp_part[pidx].size = simple_strtoul(argv[0], NULL, 10);
493
494 i = 1;
495 while (i < argc) {
496 if (!strcmp(argv[i], "enh")) {
497 pconf->gp_part[pidx].enhanced = 1;
498 i += 1;
499 } else if (!strcmp(argv[i], "wrrel")) {
500 if (i + 1 >= argc)
501 return -1;
502 pconf->gp_part[pidx].wr_rel_change = 1;
503 if (!strcmp(argv[i+1], "on"))
504 pconf->gp_part[pidx].wr_rel_set = 1;
505 else if (!strcmp(argv[i+1], "off"))
506 pconf->gp_part[pidx].wr_rel_set = 0;
507 else
508 return -1;
509 i += 2;
510 } else {
511 break;
512 }
513 }
514 return i;
515}
516
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100517static int do_mmc_hwpartition(cmd_tbl_t *cmdtp, int flag,
518 int argc, char * const argv[])
519{
520 struct mmc *mmc;
521 struct mmc_hwpart_conf pconf = { };
522 enum mmc_hwpart_conf_mode mode = MMC_HWPART_CONF_CHECK;
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100523 int i, r, pidx;
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100524
525 mmc = init_mmc_device(curr_device, false);
526 if (!mmc)
527 return CMD_RET_FAILURE;
528
529 if (argc < 1)
530 return CMD_RET_USAGE;
531 i = 1;
532 while (i < argc) {
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100533 if (!strcmp(argv[i], "user")) {
534 i++;
535 r = parse_hwpart_user(&pconf, argc-i, &argv[i]);
536 if (r < 0)
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100537 return CMD_RET_USAGE;
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100538 i += r;
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100539 } else if (!strncmp(argv[i], "gp", 2) &&
540 strlen(argv[i]) == 3 &&
541 argv[i][2] >= '1' && argv[i][2] <= '4') {
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100542 pidx = argv[i][2] - '1';
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100543 i++;
544 r = parse_hwpart_gp(&pconf, pidx, argc-i, &argv[i]);
545 if (r < 0)
546 return CMD_RET_USAGE;
547 i += r;
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100548 } else if (!strcmp(argv[i], "check")) {
549 mode = MMC_HWPART_CONF_CHECK;
550 i++;
551 } else if (!strcmp(argv[i], "set")) {
552 mode = MMC_HWPART_CONF_SET;
553 i++;
554 } else if (!strcmp(argv[i], "complete")) {
555 mode = MMC_HWPART_CONF_COMPLETE;
556 i++;
557 } else {
558 return CMD_RET_USAGE;
559 }
560 }
561
562 puts("Partition configuration:\n");
563 if (pconf.user.enh_size) {
564 puts("\tUser Enhanced Start: ");
565 print_size(((u64)pconf.user.enh_start) << 9, "\n");
566 puts("\tUser Enhanced Size: ");
567 print_size(((u64)pconf.user.enh_size) << 9, "\n");
568 } else {
569 puts("\tNo enhanced user data area\n");
570 }
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100571 if (pconf.user.wr_rel_change)
572 printf("\tUser partition write reliability: %s\n",
573 pconf.user.wr_rel_set ? "on" : "off");
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100574 for (pidx = 0; pidx < 4; pidx++) {
575 if (pconf.gp_part[pidx].size) {
576 printf("\tGP%i Capacity: ", pidx+1);
577 print_size(((u64)pconf.gp_part[pidx].size) << 9,
578 pconf.gp_part[pidx].enhanced ?
579 " ENH\n" : "\n");
580 } else {
581 printf("\tNo GP%i partition\n", pidx+1);
582 }
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100583 if (pconf.gp_part[pidx].wr_rel_change)
584 printf("\tGP%i write reliability: %s\n", pidx+1,
585 pconf.gp_part[pidx].wr_rel_set ? "on" : "off");
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100586 }
587
588 if (!mmc_hwpart_config(mmc, &pconf, mode)) {
589 if (mode == MMC_HWPART_CONF_COMPLETE)
590 puts("Partitioning successful, "
591 "power-cycle to make effective\n");
592 return CMD_RET_SUCCESS;
593 } else {
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100594 puts("Failed!\n");
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100595 return CMD_RET_FAILURE;
596 }
597}
Jean-Jacques Hiblotcf177892017-11-30 17:44:02 +0100598#endif
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100599
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200600#ifdef CONFIG_SUPPORT_EMMC_BOOT
601static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag,
602 int argc, char * const argv[])
603{
604 int dev;
605 struct mmc *mmc;
606 u8 width, reset, mode;
607
608 if (argc != 5)
609 return CMD_RET_USAGE;
610 dev = simple_strtoul(argv[1], NULL, 10);
611 width = simple_strtoul(argv[2], NULL, 10);
612 reset = simple_strtoul(argv[3], NULL, 10);
613 mode = simple_strtoul(argv[4], NULL, 10);
614
Stephen Warren1ae24a52014-05-23 13:24:45 -0600615 mmc = init_mmc_device(dev, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200616 if (!mmc)
617 return CMD_RET_FAILURE;
618
619 if (IS_SD(mmc)) {
620 puts("BOOT_BUS_WIDTH only exists on eMMC\n");
621 return CMD_RET_FAILURE;
622 }
623
624 /* acknowledge to be sent during boot operation */
625 return mmc_set_boot_bus_width(mmc, width, reset, mode);
626}
627static int do_mmc_boot_resize(cmd_tbl_t *cmdtp, int flag,
628 int argc, char * const argv[])
629{
630 int dev;
631 struct mmc *mmc;
632 u32 bootsize, rpmbsize;
633
634 if (argc != 4)
635 return CMD_RET_USAGE;
636 dev = simple_strtoul(argv[1], NULL, 10);
637 bootsize = simple_strtoul(argv[2], NULL, 10);
638 rpmbsize = simple_strtoul(argv[3], NULL, 10);
639
Stephen Warren1ae24a52014-05-23 13:24:45 -0600640 mmc = init_mmc_device(dev, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200641 if (!mmc)
642 return CMD_RET_FAILURE;
643
644 if (IS_SD(mmc)) {
645 printf("It is not a EMMC device\n");
646 return CMD_RET_FAILURE;
647 }
648
649 if (mmc_boot_partition_size_change(mmc, bootsize, rpmbsize)) {
650 printf("EMMC boot partition Size change Failed.\n");
651 return CMD_RET_FAILURE;
652 }
653
654 printf("EMMC boot partition Size %d MB\n", bootsize);
655 printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
656 return CMD_RET_SUCCESS;
657}
Angelo Dureghellobdb60992017-08-01 14:27:10 +0200658
659static int mmc_partconf_print(struct mmc *mmc)
660{
661 u8 ack, access, part;
662
663 if (mmc->part_config == MMCPART_NOAVAILABLE) {
664 printf("No part_config info for ver. 0x%x\n", mmc->version);
665 return CMD_RET_FAILURE;
666 }
667
668 access = EXT_CSD_EXTRACT_PARTITION_ACCESS(mmc->part_config);
669 ack = EXT_CSD_EXTRACT_BOOT_ACK(mmc->part_config);
670 part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
671
672 printf("EXT_CSD[179], PARTITION_CONFIG:\n"
673 "BOOT_ACK: 0x%x\n"
674 "BOOT_PARTITION_ENABLE: 0x%x\n"
675 "PARTITION_ACCESS: 0x%x\n", ack, part, access);
676
677 return CMD_RET_SUCCESS;
678}
679
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200680static int do_mmc_partconf(cmd_tbl_t *cmdtp, int flag,
681 int argc, char * const argv[])
682{
683 int dev;
684 struct mmc *mmc;
685 u8 ack, part_num, access;
686
Angelo Dureghellobdb60992017-08-01 14:27:10 +0200687 if (argc != 2 && argc != 5)
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200688 return CMD_RET_USAGE;
689
690 dev = simple_strtoul(argv[1], NULL, 10);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200691
Stephen Warren1ae24a52014-05-23 13:24:45 -0600692 mmc = init_mmc_device(dev, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200693 if (!mmc)
694 return CMD_RET_FAILURE;
695
696 if (IS_SD(mmc)) {
697 puts("PARTITION_CONFIG only exists on eMMC\n");
698 return CMD_RET_FAILURE;
699 }
700
Angelo Dureghellobdb60992017-08-01 14:27:10 +0200701 if (argc == 2)
702 return mmc_partconf_print(mmc);
703
704 ack = simple_strtoul(argv[2], NULL, 10);
705 part_num = simple_strtoul(argv[3], NULL, 10);
706 access = simple_strtoul(argv[4], NULL, 10);
707
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200708 /* acknowledge to be sent during boot operation */
709 return mmc_set_part_conf(mmc, ack, part_num, access);
710}
711static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag,
712 int argc, char * const argv[])
713{
714 int dev;
715 struct mmc *mmc;
716 u8 enable;
717
718 /*
719 * Set the RST_n_ENABLE bit of RST_n_FUNCTION
720 * The only valid values are 0x0, 0x1 and 0x2 and writing
721 * a value of 0x1 or 0x2 sets the value permanently.
722 */
723 if (argc != 3)
724 return CMD_RET_USAGE;
725
726 dev = simple_strtoul(argv[1], NULL, 10);
727 enable = simple_strtoul(argv[2], NULL, 10);
728
Peng Fan678e9312015-11-25 17:16:21 +0800729 if (enable > 2) {
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200730 puts("Invalid RST_n_ENABLE value\n");
731 return CMD_RET_USAGE;
732 }
733
Stephen Warren1ae24a52014-05-23 13:24:45 -0600734 mmc = init_mmc_device(dev, false);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200735 if (!mmc)
736 return CMD_RET_FAILURE;
737
738 if (IS_SD(mmc)) {
739 puts("RST_n_FUNCTION only exists on eMMC\n");
740 return CMD_RET_FAILURE;
741 }
742
743 return mmc_set_rst_n_function(mmc, enable);
744}
745#endif
746static int do_mmc_setdsr(cmd_tbl_t *cmdtp, int flag,
747 int argc, char * const argv[])
748{
749 struct mmc *mmc;
750 u32 val;
751 int ret;
752
753 if (argc != 2)
754 return CMD_RET_USAGE;
Markus Niebel84c1dfe2017-02-03 15:26:36 +0100755 val = simple_strtoul(argv[1], NULL, 16);
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200756
757 mmc = find_mmc_device(curr_device);
758 if (!mmc) {
759 printf("no mmc device at slot %x\n", curr_device);
760 return CMD_RET_FAILURE;
761 }
762 ret = mmc_set_dsr(mmc, val);
763 printf("set dsr %s\n", (!ret) ? "OK, force rescan" : "ERROR");
764 if (!ret) {
765 mmc->has_init = 0;
766 if (mmc_init(mmc))
767 return CMD_RET_FAILURE;
768 else
769 return CMD_RET_SUCCESS;
770 }
771 return ret;
772}
773
Tomas Melincd3d4882016-11-25 11:01:03 +0200774#ifdef CONFIG_CMD_BKOPS_ENABLE
775static int do_mmc_bkops_enable(cmd_tbl_t *cmdtp, int flag,
776 int argc, char * const argv[])
777{
778 int dev;
779 struct mmc *mmc;
780
781 if (argc != 2)
782 return CMD_RET_USAGE;
783
784 dev = simple_strtoul(argv[1], NULL, 10);
785
786 mmc = init_mmc_device(dev, false);
787 if (!mmc)
788 return CMD_RET_FAILURE;
789
790 if (IS_SD(mmc)) {
791 puts("BKOPS_EN only exists on eMMC\n");
792 return CMD_RET_FAILURE;
793 }
794
795 return mmc_set_bkops_enable(mmc);
796}
797#endif
798
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200799static cmd_tbl_t cmd_mmc[] = {
800 U_BOOT_CMD_MKENT(info, 1, 0, do_mmcinfo, "", ""),
801 U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
Jean-Jacques Hiblote6fa5a52018-01-04 15:23:34 +0100802#if CONFIG_IS_ENABLED(MMC_WRITE)
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200803 U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
804 U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
Jean-Jacques Hiblote6fa5a52018-01-04 15:23:34 +0100805#endif
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200806 U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
807 U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
808 U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
809 U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
Jean-Jacques Hiblotcf177892017-11-30 17:44:02 +0100810#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100811 U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),
Jean-Jacques Hiblotcf177892017-11-30 17:44:02 +0100812#endif
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200813#ifdef CONFIG_SUPPORT_EMMC_BOOT
814 U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""),
Wally Yehfa7b8852014-09-25 23:00:16 +0800815 U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""),
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200816 U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
817 U_BOOT_CMD_MKENT(rst-function, 3, 0, do_mmc_rst_func, "", ""),
818#endif
819#ifdef CONFIG_SUPPORT_EMMC_RPMB
820 U_BOOT_CMD_MKENT(rpmb, CONFIG_SYS_MAXARGS, 1, do_mmcrpmb, "", ""),
821#endif
822 U_BOOT_CMD_MKENT(setdsr, 2, 0, do_mmc_setdsr, "", ""),
Tomas Melincd3d4882016-11-25 11:01:03 +0200823#ifdef CONFIG_CMD_BKOPS_ENABLE
824 U_BOOT_CMD_MKENT(bkops-enable, 2, 0, do_mmc_bkops_enable, "", ""),
825#endif
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200826};
Andy Fleming272cc702008-10-30 16:41:01 -0500827
Kim Phillips088f1b12012-10-29 13:34:31 +0000828static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Andy Fleming272cc702008-10-30 16:41:01 -0500829{
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200830 cmd_tbl_t *cp;
Lei Wen6be95cc2011-06-22 17:03:30 +0000831
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200832 cp = find_cmd_tbl(argv[1], cmd_mmc, ARRAY_SIZE(cmd_mmc));
833
834 /* Drop the mmc command */
835 argc--;
836 argv++;
837
838 if (cp == NULL || argc > cp->maxargs)
Simon Glass4c12eeb2011-12-10 08:44:01 +0000839 return CMD_RET_USAGE;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200840 if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
841 return CMD_RET_SUCCESS;
Andy Fleming272cc702008-10-30 16:41:01 -0500842
Lei Wenea6ebe22011-05-02 16:26:25 +0000843 if (curr_device < 0) {
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200844 if (get_mmc_num() > 0) {
Lei Wenea6ebe22011-05-02 16:26:25 +0000845 curr_device = 0;
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200846 } else {
Lei Wenea6ebe22011-05-02 16:26:25 +0000847 puts("No MMC device available\n");
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200848 return CMD_RET_FAILURE;
Lei Wenea6ebe22011-05-02 16:26:25 +0000849 }
850 }
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200851 return cp->cmd(cmdtp, flag, argc, argv);
Andy Fleming272cc702008-10-30 16:41:01 -0500852}
853
854U_BOOT_CMD(
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100855 mmc, 29, 1, do_mmcops,
Mike Frysinger852dbfd2009-03-23 22:27:34 -0400856 "MMC sub system",
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200857 "info - display info of the current MMC device\n"
858 "mmc read addr blk# cnt\n"
Lei Wenea6ebe22011-05-02 16:26:25 +0000859 "mmc write addr blk# cnt\n"
Lei Wene6f99a52011-06-22 17:03:31 +0000860 "mmc erase blk# cnt\n"
Lei Wenea6ebe22011-05-02 16:26:25 +0000861 "mmc rescan\n"
862 "mmc part - lists available partition on current mmc device\n"
Lei Wenbc897b12011-05-02 16:26:26 +0000863 "mmc dev [dev] [part] - show or set current mmc device [partition]\n"
Amar2a91c912013-04-27 11:43:00 +0530864 "mmc list - lists available devices\n"
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100865 "mmc hwpartition [args...] - does hardware partitioning\n"
866 " arguments (sizes in 512-byte blocks):\n"
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100867 " [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes\n"
868 " [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition\n"
Diego Santa Cruzc599f532014-12-23 10:50:30 +0100869 " [check|set|complete] - mode, complete set partitioning completed\n"
Diego Santa Cruz189f9632014-12-23 10:50:32 +0100870 " WARNING: Partitioning is a write-once setting once it is set to complete.\n"
871 " Power cycling is required to initialize partitions after set to complete.\n"
Amar2a91c912013-04-27 11:43:00 +0530872#ifdef CONFIG_SUPPORT_EMMC_BOOT
Tom Rini5a99b9d2014-02-05 10:24:22 -0500873 "mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n"
874 " - Set the BOOT_BUS_WIDTH field of the specified device\n"
Tom Rinif1fd9572014-02-05 10:24:20 -0500875 "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
876 " - Change sizes of boot and RPMB partitions of specified device\n"
Angelo Dureghellobdb60992017-08-01 14:27:10 +0200877 "mmc partconf dev [boot_ack boot_partition partition_access]\n"
878 " - Show or change the bits of the PARTITION_CONFIG field of the specified device\n"
Tom Rini33ace362014-02-07 14:15:20 -0500879 "mmc rst-function dev value\n"
880 " - Change the RST_n_FUNCTION field of the specified device\n"
881 " WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.\n"
Dirk Behme3511b4e2009-02-18 19:59:39 +0100882#endif
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200883#ifdef CONFIG_SUPPORT_EMMC_RPMB
884 "mmc rpmb read addr blk# cnt [address of auth-key] - block size is 256 bytes\n"
885 "mmc rpmb write addr blk# cnt <address of auth-key> - block size is 256 bytes\n"
886 "mmc rpmb key <address of auth-key> - program the RPMB authentication key.\n"
887 "mmc rpmb counter - read the value of the write counter\n"
888#endif
889 "mmc setdsr <value> - set DSR register value\n"
Tomas Melincd3d4882016-11-25 11:01:03 +0200890#ifdef CONFIG_CMD_BKOPS_ENABLE
891 "mmc bkops-enable <dev> - enable background operations handshake on device\n"
892 " WARNING: This is a write-once setting.\n"
893#endif
Amar2a91c912013-04-27 11:43:00 +0530894 );
Pierre Aubert1fd93c62014-04-24 10:30:08 +0200895
896/* Old command kept for compatibility. Same as 'mmc info' */
897U_BOOT_CMD(
898 mmcinfo, 1, 0, do_mmcinfo,
899 "display MMC info",
900 "- display info of the current MMC device"
901);