blob: 4e28c9d7a4d6541f0c1633ee494b77e476b5e776 [file] [log] [blame]
wdenk7a428cc2003-06-15 22:40:42 +00001/*
2 * (C) Copyright 2003
3 * Kyle Harris, kharris@nexus-tech.net
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk7a428cc2003-06-15 22:40:42 +00006 */
7
8#include <common.h>
9#include <command.h>
wdenk7a428cc2003-06-15 22:40:42 +000010#include <mmc.h>
11
Mike Frysinger0289fe62009-06-14 21:35:21 -040012static int curr_device = -1;
Lei Wend430d7c2011-05-02 16:26:25 +000013#ifndef CONFIG_GENERIC_MMC
Wolfgang Denk6262d0212010-06-28 22:00:46 +020014int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk7a428cc2003-06-15 22:40:42 +000015{
Minkyu Kang0f922902009-03-30 14:55:51 +090016 int dev;
17
Wolfgang Denk3b683112010-07-17 01:06:04 +020018 if (argc < 2)
Simon Glassa06dfc72011-12-10 08:44:01 +000019 return CMD_RET_USAGE;
Minkyu Kang0f922902009-03-30 14:55:51 +090020
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 {
Simon Glassa06dfc72011-12-10 08:44:01 +000030 return CMD_RET_USAGE;
Minkyu Kang0f922902009-03-30 14:55:51 +090031 }
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 {
Simon Glassa06dfc72011-12-10 08:44:01 +000055 return CMD_RET_USAGE;
Minkyu Kang0f922902009-03-30 14:55:51 +090056 }
57
58 printf("mmc%d is current device\n", curr_device);
59 } else {
Simon Glassa06dfc72011-12-10 08:44:01 +000060 return CMD_RET_USAGE;
wdenk7a428cc2003-06-15 22:40:42 +000061 }
Minkyu Kang0f922902009-03-30 14:55:51 +090062
wdenk7a428cc2003-06-15 22:40:42 +000063 return 0;
64}
65
wdenkf287a242003-07-01 21:06:45 +000066U_BOOT_CMD(
Minkyu Kang0f922902009-03-30 14:55:51 +090067 mmc, 3, 1, do_mmc,
68 "MMC sub-system",
69 "init [dev] - init MMC sub system\n"
Wolfgang Denkc54781c2009-05-24 17:06:54 +020070 "mmc device [dev] - show or set current device"
wdenkf12e3962003-06-29 21:03:46 +000071);
Dirk Behmedf8852a2009-02-18 19:59:39 +010072#else /* !CONFIG_GENERIC_MMC */
Andy Flemingad347bb2008-10-30 16:41:01 -050073
74static void print_mmcinfo(struct mmc *mmc)
75{
Diego Santa Cruz99ca0282014-12-23 10:50:16 +010076 int i;
77
Pantelis Antoniou2c850462014-03-11 19:34:20 +020078 printf("Device: %s\n", mmc->cfg->name);
Andy Flemingad347bb2008-10-30 16:41:01 -050079 printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24);
80 printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff);
81 printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff,
82 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff,
83 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
84
85 printf("Tran Speed: %d\n", mmc->tran_speed);
86 printf("Rd Block Len: %d\n", mmc->read_bl_len);
87
88 printf("%s version %d.%d\n", IS_SD(mmc) ? "SD" : "MMC",
Jaehoon Chung6108ef62013-01-29 19:31:16 +000089 (mmc->version >> 8) & 0xf, mmc->version & 0xff);
Andy Flemingad347bb2008-10-30 16:41:01 -050090
91 printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No");
Minkyu Kang316f81a2011-01-04 01:04:19 +000092 puts("Capacity: ");
93 print_size(mmc->capacity, "\n");
Andy Flemingad347bb2008-10-30 16:41:01 -050094
Andrew Gabbasov9fc2a412014-12-01 06:59:09 -060095 printf("Bus Width: %d-bit%s\n", mmc->bus_width,
96 mmc->ddr_mode ? " DDR" : "");
Diego Santa Cruz99ca0282014-12-23 10:50:16 +010097
Diego Santa Cruz173c79e2014-12-23 10:50:26 +010098 puts("Erase Group Size: ");
99 print_size(((u64)mmc->erase_grp_size) << 9, "\n");
100
Diego Santa Cruz1f69e222014-12-23 10:50:19 +0100101 if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4_41) {
Diego Santa Cruzc145f9e2014-12-23 10:50:17 +0100102 bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0;
Diego Santa Cruz2b45f582014-12-23 10:50:23 +0100103 bool usr_enh = has_enh && (mmc->part_attr & EXT_CSD_ENH_USR);
Diego Santa Cruz173c79e2014-12-23 10:50:26 +0100104
105 puts("HC WP Group Size: ");
106 print_size(((u64)mmc->hc_wp_grp_size) << 9, "\n");
107
Diego Santa Cruz99ca0282014-12-23 10:50:16 +0100108 puts("User Capacity: ");
Diego Santa Cruz37a50b92014-12-23 10:50:33 +0100109 print_size(mmc->capacity_user, usr_enh ? " ENH" : "");
110 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_USR)
111 puts(" WRREL\n");
112 else
113 putc('\n');
Diego Santa Cruz2b45f582014-12-23 10:50:23 +0100114 if (usr_enh) {
115 puts("User Enhanced Start: ");
116 print_size(mmc->enh_user_start, "\n");
117 puts("User Enhanced Size: ");
118 print_size(mmc->enh_user_size, "\n");
119 }
Diego Santa Cruz99ca0282014-12-23 10:50:16 +0100120 puts("Boot Capacity: ");
Diego Santa Cruzc145f9e2014-12-23 10:50:17 +0100121 print_size(mmc->capacity_boot, has_enh ? " ENH\n" : "\n");
Diego Santa Cruz99ca0282014-12-23 10:50:16 +0100122 puts("RPMB Capacity: ");
Diego Santa Cruzc145f9e2014-12-23 10:50:17 +0100123 print_size(mmc->capacity_rpmb, has_enh ? " ENH\n" : "\n");
Diego Santa Cruz173c79e2014-12-23 10:50:26 +0100124
Diego Santa Cruz99ca0282014-12-23 10:50:16 +0100125 for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) {
Diego Santa Cruzc145f9e2014-12-23 10:50:17 +0100126 bool is_enh = has_enh &&
127 (mmc->part_attr & EXT_CSD_ENH_GP(i));
Diego Santa Cruz99ca0282014-12-23 10:50:16 +0100128 if (mmc->capacity_gp[i]) {
Diego Santa Cruzd8358432014-12-23 10:50:18 +0100129 printf("GP%i Capacity: ", i+1);
Diego Santa Cruzc145f9e2014-12-23 10:50:17 +0100130 print_size(mmc->capacity_gp[i],
Diego Santa Cruz37a50b92014-12-23 10:50:33 +0100131 is_enh ? " ENH" : "");
132 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_GP(i))
133 puts(" WRREL\n");
134 else
135 putc('\n');
Diego Santa Cruz99ca0282014-12-23 10:50:16 +0100136 }
137 }
138 }
Andy Flemingad347bb2008-10-30 16:41:01 -0500139}
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600140static struct mmc *init_mmc_device(int dev, bool force_init)
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200141{
142 struct mmc *mmc;
143 mmc = find_mmc_device(dev);
144 if (!mmc) {
145 printf("no mmc device at slot %x\n", dev);
146 return NULL;
147 }
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600148 if (force_init)
149 mmc->has_init = 0;
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200150 if (mmc_init(mmc))
151 return NULL;
152 return mmc;
153}
Kim Phillipsdc00a682012-10-29 13:34:31 +0000154static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Andy Flemingad347bb2008-10-30 16:41:01 -0500155{
156 struct mmc *mmc;
Andy Flemingad347bb2008-10-30 16:41:01 -0500157
Lei Wend430d7c2011-05-02 16:26:25 +0000158 if (curr_device < 0) {
159 if (get_mmc_num() > 0)
160 curr_device = 0;
161 else {
162 puts("No MMC device available\n");
163 return 1;
164 }
165 }
Andy Flemingad347bb2008-10-30 16:41:01 -0500166
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600167 mmc = init_mmc_device(curr_device, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200168 if (!mmc)
169 return CMD_RET_FAILURE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500170
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200171 print_mmcinfo(mmc);
172 return CMD_RET_SUCCESS;
173}
Andy Flemingad347bb2008-10-30 16:41:01 -0500174
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200175#ifdef CONFIG_SUPPORT_EMMC_RPMB
176static int confirm_key_prog(void)
177{
178 puts("Warning: Programming authentication key can be done only once !\n"
179 " Use this command only if you are sure of what you are doing,\n"
180 "Really perform the key programming? <y/N> ");
181 if (confirm_yesno())
Lei Wend430d7c2011-05-02 16:26:25 +0000182 return 1;
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200183
184 puts("Authentication key programming aborted\n");
185 return 0;
186}
187static int do_mmcrpmb_key(cmd_tbl_t *cmdtp, int flag,
188 int argc, char * const argv[])
189{
190 void *key_addr;
191 struct mmc *mmc = find_mmc_device(curr_device);
192
193 if (argc != 2)
194 return CMD_RET_USAGE;
195
196 key_addr = (void *)simple_strtoul(argv[1], NULL, 16);
197 if (!confirm_key_prog())
198 return CMD_RET_FAILURE;
199 if (mmc_rpmb_set_key(mmc, key_addr)) {
200 printf("ERROR - Key already programmed ?\n");
201 return CMD_RET_FAILURE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500202 }
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200203 return CMD_RET_SUCCESS;
Andy Flemingad347bb2008-10-30 16:41:01 -0500204}
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200205static int do_mmcrpmb_read(cmd_tbl_t *cmdtp, int flag,
206 int argc, char * const argv[])
207{
208 u16 blk, cnt;
209 void *addr;
210 int n;
211 void *key_addr = NULL;
212 struct mmc *mmc = find_mmc_device(curr_device);
Andy Flemingad347bb2008-10-30 16:41:01 -0500213
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200214 if (argc < 4)
215 return CMD_RET_USAGE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500216
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200217 addr = (void *)simple_strtoul(argv[1], NULL, 16);
218 blk = simple_strtoul(argv[2], NULL, 16);
219 cnt = simple_strtoul(argv[3], NULL, 16);
220
221 if (argc == 5)
222 key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
223
224 printf("\nMMC RPMB read: dev # %d, block # %d, count %d ... ",
225 curr_device, blk, cnt);
226 n = mmc_rpmb_read(mmc, addr, blk, cnt, key_addr);
227
228 printf("%d RPMB blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR");
229 if (n != cnt)
230 return CMD_RET_FAILURE;
231 return CMD_RET_SUCCESS;
232}
233static int do_mmcrpmb_write(cmd_tbl_t *cmdtp, int flag,
234 int argc, char * const argv[])
Andy Flemingad347bb2008-10-30 16:41:01 -0500235{
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200236 u16 blk, cnt;
237 void *addr;
238 int n;
239 void *key_addr;
240 struct mmc *mmc = find_mmc_device(curr_device);
Lei Wen64b2b1e2011-06-22 17:03:30 +0000241
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200242 if (argc != 5)
Simon Glassa06dfc72011-12-10 08:44:01 +0000243 return CMD_RET_USAGE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500244
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200245 addr = (void *)simple_strtoul(argv[1], NULL, 16);
246 blk = simple_strtoul(argv[2], NULL, 16);
247 cnt = simple_strtoul(argv[3], NULL, 16);
248 key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
249
250 printf("\nMMC RPMB write: dev # %d, block # %d, count %d ... ",
251 curr_device, blk, cnt);
252 n = mmc_rpmb_write(mmc, addr, blk, cnt, key_addr);
253
254 printf("%d RPMB blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR");
255 if (n != cnt)
256 return CMD_RET_FAILURE;
257 return CMD_RET_SUCCESS;
258}
259static int do_mmcrpmb_counter(cmd_tbl_t *cmdtp, int flag,
260 int argc, char * const argv[])
261{
262 unsigned long counter;
263 struct mmc *mmc = find_mmc_device(curr_device);
264
265 if (mmc_rpmb_get_counter(mmc, &counter))
266 return CMD_RET_FAILURE;
267 printf("RPMB Write counter= %lx\n", counter);
268 return CMD_RET_SUCCESS;
269}
270
271static cmd_tbl_t cmd_rpmb[] = {
272 U_BOOT_CMD_MKENT(key, 2, 0, do_mmcrpmb_key, "", ""),
273 U_BOOT_CMD_MKENT(read, 5, 1, do_mmcrpmb_read, "", ""),
274 U_BOOT_CMD_MKENT(write, 5, 0, do_mmcrpmb_write, "", ""),
275 U_BOOT_CMD_MKENT(counter, 1, 1, do_mmcrpmb_counter, "", ""),
276};
277
278static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
279 int argc, char * const argv[])
280{
281 cmd_tbl_t *cp;
282 struct mmc *mmc;
283 char original_part;
284 int ret;
285
286 cp = find_cmd_tbl(argv[1], cmd_rpmb, ARRAY_SIZE(cmd_rpmb));
287
288 /* Drop the rpmb subcommand */
289 argc--;
290 argv++;
291
292 if (cp == NULL || argc > cp->maxargs)
293 return CMD_RET_USAGE;
294 if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
295 return CMD_RET_SUCCESS;
296
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600297 mmc = init_mmc_device(curr_device, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200298 if (!mmc)
299 return CMD_RET_FAILURE;
300
301 if (!(mmc->version & MMC_VERSION_MMC)) {
302 printf("It is not a EMMC device\n");
303 return CMD_RET_FAILURE;
Lei Wend430d7c2011-05-02 16:26:25 +0000304 }
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200305 if (mmc->version < MMC_VERSION_4_41) {
306 printf("RPMB not supported before version 4.41\n");
307 return CMD_RET_FAILURE;
308 }
309 /* Switch to the RPMB partition */
310 original_part = mmc->part_num;
311 if (mmc->part_num != MMC_PART_RPMB) {
312 if (mmc_switch_part(curr_device, MMC_PART_RPMB) != 0)
313 return CMD_RET_FAILURE;
314 mmc->part_num = MMC_PART_RPMB;
315 }
316 ret = cp->cmd(cmdtp, flag, argc, argv);
Andy Flemingad347bb2008-10-30 16:41:01 -0500317
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200318 /* Return to original partition */
319 if (mmc->part_num != original_part) {
320 if (mmc_switch_part(curr_device, original_part) != 0)
321 return CMD_RET_FAILURE;
322 mmc->part_num = original_part;
323 }
324 return ret;
325}
326#endif
Rabin Vincent3e448aa2009-04-05 13:30:53 +0530327
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200328static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
329 int argc, char * const argv[])
330{
331 struct mmc *mmc;
332 u32 blk, cnt, n;
333 void *addr;
Stephen Warren18faca72013-04-01 11:50:28 +0000334
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200335 if (argc != 4)
336 return CMD_RET_USAGE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500337
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200338 addr = (void *)simple_strtoul(argv[1], NULL, 16);
339 blk = simple_strtoul(argv[2], NULL, 16);
340 cnt = simple_strtoul(argv[3], NULL, 16);
Lei Wen61dba932010-09-13 22:07:28 +0800341
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600342 mmc = init_mmc_device(curr_device, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200343 if (!mmc)
344 return CMD_RET_FAILURE;
Lei Wen61dba932010-09-13 22:07:28 +0800345
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200346 printf("\nMMC read: dev # %d, block # %d, count %d ... ",
347 curr_device, blk, cnt);
Stephen Warren18faca72013-04-01 11:50:28 +0000348
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200349 n = mmc->block_dev.block_read(curr_device, blk, cnt, addr);
350 /* flush cache after read */
351 flush_cache((ulong)addr, cnt * 512); /* FIXME */
352 printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR");
Lei Wend430d7c2011-05-02 16:26:25 +0000353
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200354 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
355}
356static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
357 int argc, char * const argv[])
358{
359 struct mmc *mmc;
360 u32 blk, cnt, n;
361 void *addr;
Andy Flemingad347bb2008-10-30 16:41:01 -0500362
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200363 if (argc != 4)
364 return CMD_RET_USAGE;
Lei Wend430d7c2011-05-02 16:26:25 +0000365
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200366 addr = (void *)simple_strtoul(argv[1], NULL, 16);
367 blk = simple_strtoul(argv[2], NULL, 16);
368 cnt = simple_strtoul(argv[3], NULL, 16);
Lei Wend430d7c2011-05-02 16:26:25 +0000369
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600370 mmc = init_mmc_device(curr_device, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200371 if (!mmc)
372 return CMD_RET_FAILURE;
Lei Wen31b99802011-05-02 16:26:26 +0000373
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200374 printf("\nMMC write: dev # %d, block # %d, count %d ... ",
375 curr_device, blk, cnt);
Lei Wen31b99802011-05-02 16:26:26 +0000376
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200377 if (mmc_getwp(mmc) == 1) {
378 printf("Error: card is write protected!\n");
379 return CMD_RET_FAILURE;
380 }
381 n = mmc->block_dev.block_write(curr_device, blk, cnt, addr);
382 printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR");
Lei Wend430d7c2011-05-02 16:26:25 +0000383
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200384 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
385}
386static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag,
387 int argc, char * const argv[])
388{
389 struct mmc *mmc;
390 u32 blk, cnt, n;
Tom Rinif8c6f792014-02-05 10:24:21 -0500391
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200392 if (argc != 3)
393 return CMD_RET_USAGE;
Tom Rinif8c6f792014-02-05 10:24:21 -0500394
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200395 blk = simple_strtoul(argv[1], NULL, 16);
396 cnt = simple_strtoul(argv[2], NULL, 16);
Amar3ccad532013-04-27 11:43:00 +0530397
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600398 mmc = init_mmc_device(curr_device, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200399 if (!mmc)
400 return CMD_RET_FAILURE;
Tom Rinif8c6f792014-02-05 10:24:21 -0500401
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200402 printf("\nMMC erase: dev # %d, block # %d, count %d ... ",
403 curr_device, blk, cnt);
Tom Rini4cf854c2014-02-05 10:24:22 -0500404
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200405 if (mmc_getwp(mmc) == 1) {
406 printf("Error: card is write protected!\n");
407 return CMD_RET_FAILURE;
408 }
409 n = mmc->block_dev.block_erase(curr_device, blk, cnt);
410 printf("%d blocks erased: %s\n", n, (n == cnt) ? "OK" : "ERROR");
Tom Rini4cf854c2014-02-05 10:24:22 -0500411
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200412 return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
413}
414static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
415 int argc, char * const argv[])
416{
417 struct mmc *mmc;
Tom Rini4cf854c2014-02-05 10:24:22 -0500418
Stephen Warren07ec4e72014-05-23 13:24:46 -0600419 mmc = init_mmc_device(curr_device, true);
420 if (!mmc)
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200421 return CMD_RET_FAILURE;
Tom Rini4cf854c2014-02-05 10:24:22 -0500422
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200423 return CMD_RET_SUCCESS;
424}
425static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
426 int argc, char * const argv[])
427{
428 block_dev_desc_t *mmc_dev;
429 struct mmc *mmc;
Amar3ccad532013-04-27 11:43:00 +0530430
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600431 mmc = init_mmc_device(curr_device, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200432 if (!mmc)
433 return CMD_RET_FAILURE;
Amar3ccad532013-04-27 11:43:00 +0530434
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200435 mmc_dev = mmc_get_dev(curr_device);
436 if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
437 print_part(mmc_dev);
438 return CMD_RET_SUCCESS;
439 }
Amar3ccad532013-04-27 11:43:00 +0530440
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200441 puts("get mmc type error!\n");
442 return CMD_RET_FAILURE;
443}
444static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
445 int argc, char * const argv[])
446{
Stephen Warren18549802014-05-23 12:48:10 -0600447 int dev, part = 0, ret;
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200448 struct mmc *mmc;
Tom Rini35a3ea12014-02-07 14:15:20 -0500449
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200450 if (argc == 1) {
451 dev = curr_device;
452 } else if (argc == 2) {
453 dev = simple_strtoul(argv[1], NULL, 10);
454 } else if (argc == 3) {
455 dev = (int)simple_strtoul(argv[1], NULL, 10);
456 part = (int)simple_strtoul(argv[2], NULL, 10);
457 if (part > PART_ACCESS_MASK) {
458 printf("#part_num shouldn't be larger than %d\n",
459 PART_ACCESS_MASK);
460 return CMD_RET_FAILURE;
Tom Rini35a3ea12014-02-07 14:15:20 -0500461 }
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200462 } else {
463 return CMD_RET_USAGE;
464 }
Tom Rini35a3ea12014-02-07 14:15:20 -0500465
Stephen Warrencf66e6f2014-05-23 13:24:47 -0600466 mmc = init_mmc_device(dev, true);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200467 if (!mmc)
468 return CMD_RET_FAILURE;
Tom Rini35a3ea12014-02-07 14:15:20 -0500469
Stephen Warren18549802014-05-23 12:48:10 -0600470 ret = mmc_select_hwpart(dev, part);
471 printf("switch to partitions #%d, %s\n",
472 part, (!ret) ? "OK" : "ERROR");
473 if (ret)
474 return 1;
475
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200476 curr_device = dev;
477 if (mmc->part_config == MMCPART_NOAVAILABLE)
478 printf("mmc%d is current device\n", curr_device);
479 else
480 printf("mmc%d(part %d) is current device\n",
481 curr_device, mmc->part_num);
Tom Rini35a3ea12014-02-07 14:15:20 -0500482
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200483 return CMD_RET_SUCCESS;
484}
485static int do_mmc_list(cmd_tbl_t *cmdtp, int flag,
486 int argc, char * const argv[])
487{
488 print_mmc_devices('\n');
489 return CMD_RET_SUCCESS;
490}
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100491
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100492static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
493 int argc, char * const argv[])
494{
495 int i = 0;
496
497 memset(&pconf->user, 0, sizeof(pconf->user));
498
499 while (i < argc) {
500 if (!strcmp(argv[i], "enh")) {
501 if (i + 2 >= argc)
502 return -1;
503 pconf->user.enh_start =
504 simple_strtoul(argv[i+1], NULL, 10);
505 pconf->user.enh_size =
506 simple_strtoul(argv[i+2], NULL, 10);
507 i += 3;
508 } else if (!strcmp(argv[i], "wrrel")) {
509 if (i + 1 >= argc)
510 return -1;
511 pconf->user.wr_rel_change = 1;
512 if (!strcmp(argv[i+1], "on"))
513 pconf->user.wr_rel_set = 1;
514 else if (!strcmp(argv[i+1], "off"))
515 pconf->user.wr_rel_set = 0;
516 else
517 return -1;
518 i += 2;
519 } else {
520 break;
521 }
522 }
523 return i;
524}
525
526static int parse_hwpart_gp(struct mmc_hwpart_conf *pconf, int pidx,
527 int argc, char * const argv[])
528{
529 int i;
530
531 memset(&pconf->gp_part[pidx], 0, sizeof(pconf->gp_part[pidx]));
532
533 if (1 >= argc)
534 return -1;
535 pconf->gp_part[pidx].size = simple_strtoul(argv[0], NULL, 10);
536
537 i = 1;
538 while (i < argc) {
539 if (!strcmp(argv[i], "enh")) {
540 pconf->gp_part[pidx].enhanced = 1;
541 i += 1;
542 } else if (!strcmp(argv[i], "wrrel")) {
543 if (i + 1 >= argc)
544 return -1;
545 pconf->gp_part[pidx].wr_rel_change = 1;
546 if (!strcmp(argv[i+1], "on"))
547 pconf->gp_part[pidx].wr_rel_set = 1;
548 else if (!strcmp(argv[i+1], "off"))
549 pconf->gp_part[pidx].wr_rel_set = 0;
550 else
551 return -1;
552 i += 2;
553 } else {
554 break;
555 }
556 }
557 return i;
558}
559
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100560static int do_mmc_hwpartition(cmd_tbl_t *cmdtp, int flag,
561 int argc, char * const argv[])
562{
563 struct mmc *mmc;
564 struct mmc_hwpart_conf pconf = { };
565 enum mmc_hwpart_conf_mode mode = MMC_HWPART_CONF_CHECK;
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100566 int i, r, pidx;
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100567
568 mmc = init_mmc_device(curr_device, false);
569 if (!mmc)
570 return CMD_RET_FAILURE;
571
572 if (argc < 1)
573 return CMD_RET_USAGE;
574 i = 1;
575 while (i < argc) {
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100576 if (!strcmp(argv[i], "user")) {
577 i++;
578 r = parse_hwpart_user(&pconf, argc-i, &argv[i]);
579 if (r < 0)
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100580 return CMD_RET_USAGE;
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100581 i += r;
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100582 } else if (!strncmp(argv[i], "gp", 2) &&
583 strlen(argv[i]) == 3 &&
584 argv[i][2] >= '1' && argv[i][2] <= '4') {
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100585 pidx = argv[i][2] - '1';
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100586 i++;
587 r = parse_hwpart_gp(&pconf, pidx, argc-i, &argv[i]);
588 if (r < 0)
589 return CMD_RET_USAGE;
590 i += r;
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100591 } else if (!strcmp(argv[i], "check")) {
592 mode = MMC_HWPART_CONF_CHECK;
593 i++;
594 } else if (!strcmp(argv[i], "set")) {
595 mode = MMC_HWPART_CONF_SET;
596 i++;
597 } else if (!strcmp(argv[i], "complete")) {
598 mode = MMC_HWPART_CONF_COMPLETE;
599 i++;
600 } else {
601 return CMD_RET_USAGE;
602 }
603 }
604
605 puts("Partition configuration:\n");
606 if (pconf.user.enh_size) {
607 puts("\tUser Enhanced Start: ");
608 print_size(((u64)pconf.user.enh_start) << 9, "\n");
609 puts("\tUser Enhanced Size: ");
610 print_size(((u64)pconf.user.enh_size) << 9, "\n");
611 } else {
612 puts("\tNo enhanced user data area\n");
613 }
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100614 if (pconf.user.wr_rel_change)
615 printf("\tUser partition write reliability: %s\n",
616 pconf.user.wr_rel_set ? "on" : "off");
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100617 for (pidx = 0; pidx < 4; pidx++) {
618 if (pconf.gp_part[pidx].size) {
619 printf("\tGP%i Capacity: ", pidx+1);
620 print_size(((u64)pconf.gp_part[pidx].size) << 9,
621 pconf.gp_part[pidx].enhanced ?
622 " ENH\n" : "\n");
623 } else {
624 printf("\tNo GP%i partition\n", pidx+1);
625 }
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100626 if (pconf.gp_part[pidx].wr_rel_change)
627 printf("\tGP%i write reliability: %s\n", pidx+1,
628 pconf.gp_part[pidx].wr_rel_set ? "on" : "off");
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100629 }
630
631 if (!mmc_hwpart_config(mmc, &pconf, mode)) {
632 if (mode == MMC_HWPART_CONF_COMPLETE)
633 puts("Partitioning successful, "
634 "power-cycle to make effective\n");
635 return CMD_RET_SUCCESS;
636 } else {
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100637 puts("Failed!\n");
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100638 return CMD_RET_FAILURE;
639 }
640}
641
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200642#ifdef CONFIG_SUPPORT_EMMC_BOOT
643static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag,
644 int argc, char * const argv[])
645{
646 int dev;
647 struct mmc *mmc;
648 u8 width, reset, mode;
649
650 if (argc != 5)
651 return CMD_RET_USAGE;
652 dev = simple_strtoul(argv[1], NULL, 10);
653 width = simple_strtoul(argv[2], NULL, 10);
654 reset = simple_strtoul(argv[3], NULL, 10);
655 mode = simple_strtoul(argv[4], NULL, 10);
656
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600657 mmc = init_mmc_device(dev, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200658 if (!mmc)
659 return CMD_RET_FAILURE;
660
661 if (IS_SD(mmc)) {
662 puts("BOOT_BUS_WIDTH only exists on eMMC\n");
663 return CMD_RET_FAILURE;
Amar3ccad532013-04-27 11:43:00 +0530664 }
Markus Niebel03951412013-12-16 13:40:46 +0100665
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200666 /* acknowledge to be sent during boot operation */
667 return mmc_set_boot_bus_width(mmc, width, reset, mode);
668}
669static int do_mmc_boot_resize(cmd_tbl_t *cmdtp, int flag,
670 int argc, char * const argv[])
671{
672 int dev;
673 struct mmc *mmc;
674 u32 bootsize, rpmbsize;
Markus Niebel03951412013-12-16 13:40:46 +0100675
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200676 if (argc != 4)
677 return CMD_RET_USAGE;
678 dev = simple_strtoul(argv[1], NULL, 10);
679 bootsize = simple_strtoul(argv[2], NULL, 10);
680 rpmbsize = simple_strtoul(argv[3], NULL, 10);
681
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600682 mmc = init_mmc_device(dev, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200683 if (!mmc)
684 return CMD_RET_FAILURE;
685
686 if (IS_SD(mmc)) {
687 printf("It is not a EMMC device\n");
688 return CMD_RET_FAILURE;
Markus Niebel03951412013-12-16 13:40:46 +0100689 }
690
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200691 if (mmc_boot_partition_size_change(mmc, bootsize, rpmbsize)) {
692 printf("EMMC boot partition Size change Failed.\n");
693 return CMD_RET_FAILURE;
694 }
Andy Flemingad347bb2008-10-30 16:41:01 -0500695
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200696 printf("EMMC boot partition Size %d MB\n", bootsize);
697 printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
698 return CMD_RET_SUCCESS;
699}
700static int do_mmc_partconf(cmd_tbl_t *cmdtp, int flag,
701 int argc, char * const argv[])
702{
703 int dev;
704 struct mmc *mmc;
705 u8 ack, part_num, access;
Lei Wenea526762011-06-22 17:03:31 +0000706
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200707 if (argc != 5)
708 return CMD_RET_USAGE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500709
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200710 dev = simple_strtoul(argv[1], NULL, 10);
711 ack = simple_strtoul(argv[2], NULL, 10);
712 part_num = simple_strtoul(argv[3], NULL, 10);
713 access = simple_strtoul(argv[4], NULL, 10);
Rabin Vincent3e448aa2009-04-05 13:30:53 +0530714
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600715 mmc = init_mmc_device(dev, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200716 if (!mmc)
717 return CMD_RET_FAILURE;
Andy Flemingad347bb2008-10-30 16:41:01 -0500718
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200719 if (IS_SD(mmc)) {
720 puts("PARTITION_CONFIG only exists on eMMC\n");
721 return CMD_RET_FAILURE;
722 }
Andy Flemingad347bb2008-10-30 16:41:01 -0500723
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200724 /* acknowledge to be sent during boot operation */
725 return mmc_set_part_conf(mmc, ack, part_num, access);
726}
727static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag,
728 int argc, char * const argv[])
729{
730 int dev;
731 struct mmc *mmc;
732 u8 enable;
Nikita Kiryanov020f2612012-12-03 02:19:46 +0000733
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200734 /*
735 * Set the RST_n_ENABLE bit of RST_n_FUNCTION
736 * The only valid values are 0x0, 0x1 and 0x2 and writing
737 * a value of 0x1 or 0x2 sets the value permanently.
738 */
739 if (argc != 3)
740 return CMD_RET_USAGE;
741
742 dev = simple_strtoul(argv[1], NULL, 10);
743 enable = simple_strtoul(argv[2], NULL, 10);
744
745 if (enable > 2 || enable < 0) {
746 puts("Invalid RST_n_ENABLE value\n");
747 return CMD_RET_USAGE;
748 }
749
Stephen Warrenb627f4b2014-05-23 13:24:45 -0600750 mmc = init_mmc_device(dev, false);
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200751 if (!mmc)
752 return CMD_RET_FAILURE;
753
754 if (IS_SD(mmc)) {
755 puts("RST_n_FUNCTION only exists on eMMC\n");
756 return CMD_RET_FAILURE;
757 }
758
759 return mmc_set_rst_n_function(mmc, enable);
760}
761#endif
762static int do_mmc_setdsr(cmd_tbl_t *cmdtp, int flag,
763 int argc, char * const argv[])
764{
765 struct mmc *mmc;
766 u32 val;
767 int ret;
Andy Flemingad347bb2008-10-30 16:41:01 -0500768
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200769 if (argc != 2)
770 return CMD_RET_USAGE;
771 val = simple_strtoul(argv[2], NULL, 16);
772
773 mmc = find_mmc_device(curr_device);
774 if (!mmc) {
775 printf("no mmc device at slot %x\n", curr_device);
776 return CMD_RET_FAILURE;
777 }
778 ret = mmc_set_dsr(mmc, val);
779 printf("set dsr %s\n", (!ret) ? "OK, force rescan" : "ERROR");
780 if (!ret) {
781 mmc->has_init = 0;
782 if (mmc_init(mmc))
783 return CMD_RET_FAILURE;
784 else
785 return CMD_RET_SUCCESS;
Andy Flemingad347bb2008-10-30 16:41:01 -0500786 }
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200787 return ret;
788}
Lei Wend430d7c2011-05-02 16:26:25 +0000789
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200790static cmd_tbl_t cmd_mmc[] = {
791 U_BOOT_CMD_MKENT(info, 1, 0, do_mmcinfo, "", ""),
792 U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
793 U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
794 U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
795 U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
796 U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
797 U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
798 U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100799 U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200800#ifdef CONFIG_SUPPORT_EMMC_BOOT
801 U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""),
Wally Yehd49c4aa2014-09-25 23:00:16 +0800802 U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""),
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200803 U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
804 U_BOOT_CMD_MKENT(rst-function, 3, 0, do_mmc_rst_func, "", ""),
805#endif
806#ifdef CONFIG_SUPPORT_EMMC_RPMB
807 U_BOOT_CMD_MKENT(rpmb, CONFIG_SYS_MAXARGS, 1, do_mmcrpmb, "", ""),
808#endif
809 U_BOOT_CMD_MKENT(setdsr, 2, 0, do_mmc_setdsr, "", ""),
810};
811
812static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
813{
814 cmd_tbl_t *cp;
815
816 cp = find_cmd_tbl(argv[1], cmd_mmc, ARRAY_SIZE(cmd_mmc));
817
818 /* Drop the mmc command */
819 argc--;
820 argv++;
821
822 if (cp == NULL || argc > cp->maxargs)
823 return CMD_RET_USAGE;
824 if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
825 return CMD_RET_SUCCESS;
826
827 if (curr_device < 0) {
828 if (get_mmc_num() > 0) {
829 curr_device = 0;
830 } else {
831 puts("No MMC device available\n");
832 return CMD_RET_FAILURE;
833 }
834 }
835 return cp->cmd(cmdtp, flag, argc, argv);
Andy Flemingad347bb2008-10-30 16:41:01 -0500836}
837
838U_BOOT_CMD(
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100839 mmc, 29, 1, do_mmcops,
Mike Frysinger27e1e622009-03-23 22:27:34 -0400840 "MMC sub system",
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200841 "info - display info of the current MMC device\n"
842 "mmc read addr blk# cnt\n"
Lei Wend430d7c2011-05-02 16:26:25 +0000843 "mmc write addr blk# cnt\n"
Lei Wenea526762011-06-22 17:03:31 +0000844 "mmc erase blk# cnt\n"
Lei Wend430d7c2011-05-02 16:26:25 +0000845 "mmc rescan\n"
846 "mmc part - lists available partition on current mmc device\n"
Lei Wen31b99802011-05-02 16:26:26 +0000847 "mmc dev [dev] [part] - show or set current mmc device [partition]\n"
Amar3ccad532013-04-27 11:43:00 +0530848 "mmc list - lists available devices\n"
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100849 "mmc hwpartition [args...] - does hardware partitioning\n"
850 " arguments (sizes in 512-byte blocks):\n"
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100851 " [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes\n"
852 " [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition\n"
Diego Santa Cruz420fc162014-12-23 10:50:30 +0100853 " [check|set|complete] - mode, complete set partitioning completed\n"
Diego Santa Cruz58bda792014-12-23 10:50:32 +0100854 " WARNING: Partitioning is a write-once setting once it is set to complete.\n"
855 " Power cycling is required to initialize partitions after set to complete.\n"
Amar3ccad532013-04-27 11:43:00 +0530856#ifdef CONFIG_SUPPORT_EMMC_BOOT
Tom Rini4cf854c2014-02-05 10:24:22 -0500857 "mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n"
858 " - Set the BOOT_BUS_WIDTH field of the specified device\n"
Tom Rini79919462014-02-05 10:24:20 -0500859 "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
860 " - Change sizes of boot and RPMB partitions of specified device\n"
Tom Rinif8c6f792014-02-05 10:24:21 -0500861 "mmc partconf dev boot_ack boot_partition partition_access\n"
862 " - Change the bits of the PARTITION_CONFIG field of the specified device\n"
Tom Rini35a3ea12014-02-07 14:15:20 -0500863 "mmc rst-function dev value\n"
864 " - Change the RST_n_FUNCTION field of the specified device\n"
865 " WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.\n"
Dirk Behmedf8852a2009-02-18 19:59:39 +0100866#endif
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200867#ifdef CONFIG_SUPPORT_EMMC_RPMB
868 "mmc rpmb read addr blk# cnt [address of auth-key] - block size is 256 bytes\n"
869 "mmc rpmb write addr blk# cnt <address of auth-key> - block size is 256 bytes\n"
870 "mmc rpmb key <address of auth-key> - program the RPMB authentication key.\n"
871 "mmc rpmb counter - read the value of the write counter\n"
872#endif
873 "mmc setdsr <value> - set DSR register value\n"
Amar3ccad532013-04-27 11:43:00 +0530874 );
Pierre Aubertbcc302c2014-04-24 10:30:08 +0200875
876/* Old command kept for compatibility. Same as 'mmc info' */
877U_BOOT_CMD(
878 mmcinfo, 1, 0, do_mmcinfo,
879 "display MMC info",
880 "- display info of the current MMC device"
881);
882
Amar3ccad532013-04-27 11:43:00 +0530883#endif /* !CONFIG_GENERIC_MMC */