]> git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_mmc.c
Merge branch 'master' of git://git.denx.de/u-boot-usb
[people/ms/u-boot.git] / common / cmd_mmc.c
1 /*
2 * (C) Copyright 2003
3 * Kyle Harris, kharris@nexus-tech.net
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9 #include <command.h>
10 #include <mmc.h>
11
12 static int curr_device = -1;
13 #ifndef CONFIG_GENERIC_MMC
14 int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
15 {
16 int dev;
17
18 if (argc < 2)
19 return CMD_RET_USAGE;
20
21 if (strcmp(argv[1], "init") == 0) {
22 if (argc == 2) {
23 if (curr_device < 0)
24 dev = 1;
25 else
26 dev = curr_device;
27 } else if (argc == 3) {
28 dev = (int)simple_strtoul(argv[2], NULL, 10);
29 } else {
30 return CMD_RET_USAGE;
31 }
32
33 if (mmc_legacy_init(dev) != 0) {
34 puts("No MMC card found\n");
35 return 1;
36 }
37
38 curr_device = dev;
39 printf("mmc%d is available\n", curr_device);
40 } else if (strcmp(argv[1], "device") == 0) {
41 if (argc == 2) {
42 if (curr_device < 0) {
43 puts("No MMC device available\n");
44 return 1;
45 }
46 } else if (argc == 3) {
47 dev = (int)simple_strtoul(argv[2], NULL, 10);
48
49 #ifdef CONFIG_SYS_MMC_SET_DEV
50 if (mmc_set_dev(dev) != 0)
51 return 1;
52 #endif
53 curr_device = dev;
54 } else {
55 return CMD_RET_USAGE;
56 }
57
58 printf("mmc%d is current device\n", curr_device);
59 } else {
60 return CMD_RET_USAGE;
61 }
62
63 return 0;
64 }
65
66 U_BOOT_CMD(
67 mmc, 3, 1, do_mmc,
68 "MMC sub-system",
69 "init [dev] - init MMC sub system\n"
70 "mmc device [dev] - show or set current device"
71 );
72 #else /* !CONFIG_GENERIC_MMC */
73
74 static void print_mmcinfo(struct mmc *mmc)
75 {
76 printf("Device: %s\n", mmc->cfg->name);
77 printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24);
78 printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff);
79 printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff,
80 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff,
81 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
82
83 printf("Tran Speed: %d\n", mmc->tran_speed);
84 printf("Rd Block Len: %d\n", mmc->read_bl_len);
85
86 printf("%s version %d.%d\n", IS_SD(mmc) ? "SD" : "MMC",
87 (mmc->version >> 8) & 0xf, mmc->version & 0xff);
88
89 printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No");
90 puts("Capacity: ");
91 print_size(mmc->capacity, "\n");
92
93 printf("Bus Width: %d-bit%s\n", mmc->bus_width,
94 mmc->ddr_mode ? " DDR" : "");
95 }
96 static struct mmc *init_mmc_device(int dev, bool force_init)
97 {
98 struct mmc *mmc;
99 mmc = find_mmc_device(dev);
100 if (!mmc) {
101 printf("no mmc device at slot %x\n", dev);
102 return NULL;
103 }
104 if (force_init)
105 mmc->has_init = 0;
106 if (mmc_init(mmc))
107 return NULL;
108 return mmc;
109 }
110 static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
111 {
112 struct mmc *mmc;
113
114 if (curr_device < 0) {
115 if (get_mmc_num() > 0)
116 curr_device = 0;
117 else {
118 puts("No MMC device available\n");
119 return 1;
120 }
121 }
122
123 mmc = init_mmc_device(curr_device, false);
124 if (!mmc)
125 return CMD_RET_FAILURE;
126
127 print_mmcinfo(mmc);
128 return CMD_RET_SUCCESS;
129 }
130
131 #ifdef CONFIG_SUPPORT_EMMC_RPMB
132 static int confirm_key_prog(void)
133 {
134 puts("Warning: Programming authentication key can be done only once !\n"
135 " Use this command only if you are sure of what you are doing,\n"
136 "Really perform the key programming? <y/N> ");
137 if (confirm_yesno())
138 return 1;
139
140 puts("Authentication key programming aborted\n");
141 return 0;
142 }
143 static int do_mmcrpmb_key(cmd_tbl_t *cmdtp, int flag,
144 int argc, char * const argv[])
145 {
146 void *key_addr;
147 struct mmc *mmc = find_mmc_device(curr_device);
148
149 if (argc != 2)
150 return CMD_RET_USAGE;
151
152 key_addr = (void *)simple_strtoul(argv[1], NULL, 16);
153 if (!confirm_key_prog())
154 return CMD_RET_FAILURE;
155 if (mmc_rpmb_set_key(mmc, key_addr)) {
156 printf("ERROR - Key already programmed ?\n");
157 return CMD_RET_FAILURE;
158 }
159 return CMD_RET_SUCCESS;
160 }
161 static int do_mmcrpmb_read(cmd_tbl_t *cmdtp, int flag,
162 int argc, char * const argv[])
163 {
164 u16 blk, cnt;
165 void *addr;
166 int n;
167 void *key_addr = NULL;
168 struct mmc *mmc = find_mmc_device(curr_device);
169
170 if (argc < 4)
171 return CMD_RET_USAGE;
172
173 addr = (void *)simple_strtoul(argv[1], NULL, 16);
174 blk = simple_strtoul(argv[2], NULL, 16);
175 cnt = simple_strtoul(argv[3], NULL, 16);
176
177 if (argc == 5)
178 key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
179
180 printf("\nMMC RPMB read: dev # %d, block # %d, count %d ... ",
181 curr_device, blk, cnt);
182 n = mmc_rpmb_read(mmc, addr, blk, cnt, key_addr);
183
184 printf("%d RPMB blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR");
185 if (n != cnt)
186 return CMD_RET_FAILURE;
187 return CMD_RET_SUCCESS;
188 }
189 static int do_mmcrpmb_write(cmd_tbl_t *cmdtp, int flag,
190 int argc, char * const argv[])
191 {
192 u16 blk, cnt;
193 void *addr;
194 int n;
195 void *key_addr;
196 struct mmc *mmc = find_mmc_device(curr_device);
197
198 if (argc != 5)
199 return CMD_RET_USAGE;
200
201 addr = (void *)simple_strtoul(argv[1], NULL, 16);
202 blk = simple_strtoul(argv[2], NULL, 16);
203 cnt = simple_strtoul(argv[3], NULL, 16);
204 key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
205
206 printf("\nMMC RPMB write: dev # %d, block # %d, count %d ... ",
207 curr_device, blk, cnt);
208 n = mmc_rpmb_write(mmc, addr, blk, cnt, key_addr);
209
210 printf("%d RPMB blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR");
211 if (n != cnt)
212 return CMD_RET_FAILURE;
213 return CMD_RET_SUCCESS;
214 }
215 static int do_mmcrpmb_counter(cmd_tbl_t *cmdtp, int flag,
216 int argc, char * const argv[])
217 {
218 unsigned long counter;
219 struct mmc *mmc = find_mmc_device(curr_device);
220
221 if (mmc_rpmb_get_counter(mmc, &counter))
222 return CMD_RET_FAILURE;
223 printf("RPMB Write counter= %lx\n", counter);
224 return CMD_RET_SUCCESS;
225 }
226
227 static cmd_tbl_t cmd_rpmb[] = {
228 U_BOOT_CMD_MKENT(key, 2, 0, do_mmcrpmb_key, "", ""),
229 U_BOOT_CMD_MKENT(read, 5, 1, do_mmcrpmb_read, "", ""),
230 U_BOOT_CMD_MKENT(write, 5, 0, do_mmcrpmb_write, "", ""),
231 U_BOOT_CMD_MKENT(counter, 1, 1, do_mmcrpmb_counter, "", ""),
232 };
233
234 static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
235 int argc, char * const argv[])
236 {
237 cmd_tbl_t *cp;
238 struct mmc *mmc;
239 char original_part;
240 int ret;
241
242 cp = find_cmd_tbl(argv[1], cmd_rpmb, ARRAY_SIZE(cmd_rpmb));
243
244 /* Drop the rpmb subcommand */
245 argc--;
246 argv++;
247
248 if (cp == NULL || argc > cp->maxargs)
249 return CMD_RET_USAGE;
250 if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
251 return CMD_RET_SUCCESS;
252
253 mmc = init_mmc_device(curr_device, false);
254 if (!mmc)
255 return CMD_RET_FAILURE;
256
257 if (!(mmc->version & MMC_VERSION_MMC)) {
258 printf("It is not a EMMC device\n");
259 return CMD_RET_FAILURE;
260 }
261 if (mmc->version < MMC_VERSION_4_41) {
262 printf("RPMB not supported before version 4.41\n");
263 return CMD_RET_FAILURE;
264 }
265 /* Switch to the RPMB partition */
266 original_part = mmc->part_num;
267 if (mmc->part_num != MMC_PART_RPMB) {
268 if (mmc_switch_part(curr_device, MMC_PART_RPMB) != 0)
269 return CMD_RET_FAILURE;
270 mmc->part_num = MMC_PART_RPMB;
271 }
272 ret = cp->cmd(cmdtp, flag, argc, argv);
273
274 /* Return to original partition */
275 if (mmc->part_num != original_part) {
276 if (mmc_switch_part(curr_device, original_part) != 0)
277 return CMD_RET_FAILURE;
278 mmc->part_num = original_part;
279 }
280 return ret;
281 }
282 #endif
283
284 static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
285 int argc, char * const argv[])
286 {
287 struct mmc *mmc;
288 u32 blk, cnt, n;
289 void *addr;
290
291 if (argc != 4)
292 return CMD_RET_USAGE;
293
294 addr = (void *)simple_strtoul(argv[1], NULL, 16);
295 blk = simple_strtoul(argv[2], NULL, 16);
296 cnt = simple_strtoul(argv[3], NULL, 16);
297
298 mmc = init_mmc_device(curr_device, false);
299 if (!mmc)
300 return CMD_RET_FAILURE;
301
302 printf("\nMMC read: dev # %d, block # %d, count %d ... ",
303 curr_device, blk, cnt);
304
305 n = mmc->block_dev.block_read(curr_device, blk, cnt, addr);
306 /* flush cache after read */
307 flush_cache((ulong)addr, cnt * 512); /* FIXME */
308 printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR");
309
310 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
311 }
312 static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
313 int argc, char * const argv[])
314 {
315 struct mmc *mmc;
316 u32 blk, cnt, n;
317 void *addr;
318
319 if (argc != 4)
320 return CMD_RET_USAGE;
321
322 addr = (void *)simple_strtoul(argv[1], NULL, 16);
323 blk = simple_strtoul(argv[2], NULL, 16);
324 cnt = simple_strtoul(argv[3], NULL, 16);
325
326 mmc = init_mmc_device(curr_device, false);
327 if (!mmc)
328 return CMD_RET_FAILURE;
329
330 printf("\nMMC write: dev # %d, block # %d, count %d ... ",
331 curr_device, blk, cnt);
332
333 if (mmc_getwp(mmc) == 1) {
334 printf("Error: card is write protected!\n");
335 return CMD_RET_FAILURE;
336 }
337 n = mmc->block_dev.block_write(curr_device, blk, cnt, addr);
338 printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR");
339
340 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
341 }
342 static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag,
343 int argc, char * const argv[])
344 {
345 struct mmc *mmc;
346 u32 blk, cnt, n;
347
348 if (argc != 3)
349 return CMD_RET_USAGE;
350
351 blk = simple_strtoul(argv[1], NULL, 16);
352 cnt = simple_strtoul(argv[2], NULL, 16);
353
354 mmc = init_mmc_device(curr_device, false);
355 if (!mmc)
356 return CMD_RET_FAILURE;
357
358 printf("\nMMC erase: dev # %d, block # %d, count %d ... ",
359 curr_device, blk, cnt);
360
361 if (mmc_getwp(mmc) == 1) {
362 printf("Error: card is write protected!\n");
363 return CMD_RET_FAILURE;
364 }
365 n = mmc->block_dev.block_erase(curr_device, blk, cnt);
366 printf("%d blocks erased: %s\n", n, (n == cnt) ? "OK" : "ERROR");
367
368 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
369 }
370 static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
371 int argc, char * const argv[])
372 {
373 struct mmc *mmc;
374
375 mmc = init_mmc_device(curr_device, true);
376 if (!mmc)
377 return CMD_RET_FAILURE;
378
379 return CMD_RET_SUCCESS;
380 }
381 static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
382 int argc, char * const argv[])
383 {
384 block_dev_desc_t *mmc_dev;
385 struct mmc *mmc;
386
387 mmc = init_mmc_device(curr_device, false);
388 if (!mmc)
389 return CMD_RET_FAILURE;
390
391 mmc_dev = mmc_get_dev(curr_device);
392 if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
393 print_part(mmc_dev);
394 return CMD_RET_SUCCESS;
395 }
396
397 puts("get mmc type error!\n");
398 return CMD_RET_FAILURE;
399 }
400 static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
401 int argc, char * const argv[])
402 {
403 int dev, part = 0, ret;
404 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
422 mmc = init_mmc_device(dev, true);
423 if (!mmc)
424 return CMD_RET_FAILURE;
425
426 ret = mmc_select_hwpart(dev, part);
427 printf("switch to partitions #%d, %s\n",
428 part, (!ret) ? "OK" : "ERROR");
429 if (ret)
430 return 1;
431
432 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",
437 curr_device, mmc->part_num);
438
439 return CMD_RET_SUCCESS;
440 }
441 static 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 }
447 #ifdef CONFIG_SUPPORT_EMMC_BOOT
448 static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag,
449 int argc, char * const argv[])
450 {
451 int dev;
452 struct mmc *mmc;
453 u8 width, reset, mode;
454
455 if (argc != 5)
456 return CMD_RET_USAGE;
457 dev = simple_strtoul(argv[1], NULL, 10);
458 width = simple_strtoul(argv[2], NULL, 10);
459 reset = simple_strtoul(argv[3], NULL, 10);
460 mode = simple_strtoul(argv[4], NULL, 10);
461
462 mmc = init_mmc_device(dev, false);
463 if (!mmc)
464 return CMD_RET_FAILURE;
465
466 if (IS_SD(mmc)) {
467 puts("BOOT_BUS_WIDTH only exists on eMMC\n");
468 return CMD_RET_FAILURE;
469 }
470
471 /* acknowledge to be sent during boot operation */
472 return mmc_set_boot_bus_width(mmc, width, reset, mode);
473 }
474 static int do_mmc_boot_resize(cmd_tbl_t *cmdtp, int flag,
475 int argc, char * const argv[])
476 {
477 int dev;
478 struct mmc *mmc;
479 u32 bootsize, rpmbsize;
480
481 if (argc != 4)
482 return CMD_RET_USAGE;
483 dev = simple_strtoul(argv[1], NULL, 10);
484 bootsize = simple_strtoul(argv[2], NULL, 10);
485 rpmbsize = simple_strtoul(argv[3], NULL, 10);
486
487 mmc = init_mmc_device(dev, false);
488 if (!mmc)
489 return CMD_RET_FAILURE;
490
491 if (IS_SD(mmc)) {
492 printf("It is not a EMMC device\n");
493 return CMD_RET_FAILURE;
494 }
495
496 if (mmc_boot_partition_size_change(mmc, bootsize, rpmbsize)) {
497 printf("EMMC boot partition Size change Failed.\n");
498 return CMD_RET_FAILURE;
499 }
500
501 printf("EMMC boot partition Size %d MB\n", bootsize);
502 printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
503 return CMD_RET_SUCCESS;
504 }
505 static int do_mmc_partconf(cmd_tbl_t *cmdtp, int flag,
506 int argc, char * const argv[])
507 {
508 int dev;
509 struct mmc *mmc;
510 u8 ack, part_num, access;
511
512 if (argc != 5)
513 return CMD_RET_USAGE;
514
515 dev = simple_strtoul(argv[1], NULL, 10);
516 ack = simple_strtoul(argv[2], NULL, 10);
517 part_num = simple_strtoul(argv[3], NULL, 10);
518 access = simple_strtoul(argv[4], NULL, 10);
519
520 mmc = init_mmc_device(dev, false);
521 if (!mmc)
522 return CMD_RET_FAILURE;
523
524 if (IS_SD(mmc)) {
525 puts("PARTITION_CONFIG only exists on eMMC\n");
526 return CMD_RET_FAILURE;
527 }
528
529 /* acknowledge to be sent during boot operation */
530 return mmc_set_part_conf(mmc, ack, part_num, access);
531 }
532 static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag,
533 int argc, char * const argv[])
534 {
535 int dev;
536 struct mmc *mmc;
537 u8 enable;
538
539 /*
540 * Set the RST_n_ENABLE bit of RST_n_FUNCTION
541 * The only valid values are 0x0, 0x1 and 0x2 and writing
542 * a value of 0x1 or 0x2 sets the value permanently.
543 */
544 if (argc != 3)
545 return CMD_RET_USAGE;
546
547 dev = simple_strtoul(argv[1], NULL, 10);
548 enable = simple_strtoul(argv[2], NULL, 10);
549
550 if (enable > 2 || enable < 0) {
551 puts("Invalid RST_n_ENABLE value\n");
552 return CMD_RET_USAGE;
553 }
554
555 mmc = init_mmc_device(dev, false);
556 if (!mmc)
557 return CMD_RET_FAILURE;
558
559 if (IS_SD(mmc)) {
560 puts("RST_n_FUNCTION only exists on eMMC\n");
561 return CMD_RET_FAILURE;
562 }
563
564 return mmc_set_rst_n_function(mmc, enable);
565 }
566 #endif
567 static int do_mmc_setdsr(cmd_tbl_t *cmdtp, int flag,
568 int argc, char * const argv[])
569 {
570 struct mmc *mmc;
571 u32 val;
572 int ret;
573
574 if (argc != 2)
575 return CMD_RET_USAGE;
576 val = simple_strtoul(argv[2], NULL, 16);
577
578 mmc = find_mmc_device(curr_device);
579 if (!mmc) {
580 printf("no mmc device at slot %x\n", curr_device);
581 return CMD_RET_FAILURE;
582 }
583 ret = mmc_set_dsr(mmc, val);
584 printf("set dsr %s\n", (!ret) ? "OK, force rescan" : "ERROR");
585 if (!ret) {
586 mmc->has_init = 0;
587 if (mmc_init(mmc))
588 return CMD_RET_FAILURE;
589 else
590 return CMD_RET_SUCCESS;
591 }
592 return ret;
593 }
594
595 static cmd_tbl_t cmd_mmc[] = {
596 U_BOOT_CMD_MKENT(info, 1, 0, do_mmcinfo, "", ""),
597 U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
598 U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
599 U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
600 U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
601 U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
602 U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
603 U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
604 #ifdef CONFIG_SUPPORT_EMMC_BOOT
605 U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""),
606 U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""),
607 U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
608 U_BOOT_CMD_MKENT(rst-function, 3, 0, do_mmc_rst_func, "", ""),
609 #endif
610 #ifdef CONFIG_SUPPORT_EMMC_RPMB
611 U_BOOT_CMD_MKENT(rpmb, CONFIG_SYS_MAXARGS, 1, do_mmcrpmb, "", ""),
612 #endif
613 U_BOOT_CMD_MKENT(setdsr, 2, 0, do_mmc_setdsr, "", ""),
614 };
615
616 static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
617 {
618 cmd_tbl_t *cp;
619
620 cp = find_cmd_tbl(argv[1], cmd_mmc, ARRAY_SIZE(cmd_mmc));
621
622 /* Drop the mmc command */
623 argc--;
624 argv++;
625
626 if (cp == NULL || argc > cp->maxargs)
627 return CMD_RET_USAGE;
628 if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
629 return CMD_RET_SUCCESS;
630
631 if (curr_device < 0) {
632 if (get_mmc_num() > 0) {
633 curr_device = 0;
634 } else {
635 puts("No MMC device available\n");
636 return CMD_RET_FAILURE;
637 }
638 }
639 return cp->cmd(cmdtp, flag, argc, argv);
640 }
641
642 U_BOOT_CMD(
643 mmc, 7, 1, do_mmcops,
644 "MMC sub system",
645 "info - display info of the current MMC device\n"
646 "mmc read addr blk# cnt\n"
647 "mmc write addr blk# cnt\n"
648 "mmc erase blk# cnt\n"
649 "mmc rescan\n"
650 "mmc part - lists available partition on current mmc device\n"
651 "mmc dev [dev] [part] - show or set current mmc device [partition]\n"
652 "mmc list - lists available devices\n"
653 #ifdef CONFIG_SUPPORT_EMMC_BOOT
654 "mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n"
655 " - Set the BOOT_BUS_WIDTH field of the specified device\n"
656 "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
657 " - Change sizes of boot and RPMB partitions of specified device\n"
658 "mmc partconf dev boot_ack boot_partition partition_access\n"
659 " - Change the bits of the PARTITION_CONFIG field of the specified device\n"
660 "mmc rst-function dev value\n"
661 " - Change the RST_n_FUNCTION field of the specified device\n"
662 " WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.\n"
663 #endif
664 #ifdef CONFIG_SUPPORT_EMMC_RPMB
665 "mmc rpmb read addr blk# cnt [address of auth-key] - block size is 256 bytes\n"
666 "mmc rpmb write addr blk# cnt <address of auth-key> - block size is 256 bytes\n"
667 "mmc rpmb key <address of auth-key> - program the RPMB authentication key.\n"
668 "mmc rpmb counter - read the value of the write counter\n"
669 #endif
670 "mmc setdsr <value> - set DSR register value\n"
671 );
672
673 /* Old command kept for compatibility. Same as 'mmc info' */
674 U_BOOT_CMD(
675 mmcinfo, 1, 0, do_mmcinfo,
676 "display MMC info",
677 "- display info of the current MMC device"
678 );
679
680 #endif /* !CONFIG_GENERIC_MMC */