summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-02-03 09:13:43 -0600
committerTom Rini <[email protected]>2026-02-03 12:46:30 -0600
commit71f2564b178f3986dc89cdaa4558f0caa74fd88c (patch)
tree72425510b485afed47d9c78e5fcd31c3c08151e2 /cmd
parentb3d5e06b4b1062b2966ac7fadd90ebec74fa5cac (diff)
parentb4f0479e076014f403319fdce53c5c1ac278f8ae (diff)
Merge tag 'mmc-for-2026.04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-mmc
- Add DMA support for mediatek mmc - Cleanup mmc cmd - Fix typos in mmc [trini: Fix "quoted string split across lines" checkpatch warning] Signed-off-by: Tom Rini <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mmc.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/cmd/mmc.c b/cmd/mmc.c
index 5340a58be8e..6cb1ef5dc23 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -16,6 +16,7 @@
#include <sparse_format.h>
#include <image-sparse.h>
#include <vsprintf.h>
+#include <linux/compiler_attributes.h>
#include <linux/ctype.h>
static int curr_device = -1;
@@ -556,37 +557,45 @@ static int do_mmc_part(struct cmd_tbl *cmdtp, int flag,
static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
{
- int dev, part = 0, ret;
+ enum bus_mode speed_mode = MMC_MODES_END;
+ int dev = curr_device, part = 0, ret;
+ char *endp;
struct mmc *mmc;
- if (argc == 1) {
- dev = curr_device;
- mmc = init_mmc_device(dev, true);
- } else if (argc == 2) {
- dev = (int)dectoul(argv[1], NULL);
- mmc = init_mmc_device(dev, true);
- } else if (argc == 3) {
- dev = (int)dectoul(argv[1], NULL);
- part = (int)dectoul(argv[2], NULL);
- if (part > PART_ACCESS_MASK) {
- printf("#part_num shouldn't be larger than %d\n",
- PART_ACCESS_MASK);
- return CMD_RET_FAILURE;
+ switch (argc) {
+ case 4:
+ speed_mode = (int)dectoul(argv[3], &endp);
+ if (*endp) {
+ printf("Invalid speed mode index '%s', did you specify a mode name?\n",
+ argv[3]);
+ return CMD_RET_USAGE;
}
- mmc = init_mmc_device(dev, true);
- } else if (argc == 4) {
- enum bus_mode speed_mode;
- dev = (int)dectoul(argv[1], NULL);
- part = (int)dectoul(argv[2], NULL);
- if (part > PART_ACCESS_MASK) {
+ fallthrough;
+ case 3:
+ part = (int)dectoul(argv[2], &endp);
+ if (*endp) {
+ printf("Invalid part number '%s'\n", argv[2]);
+ return CMD_RET_USAGE;
+ } else if (part > PART_ACCESS_MASK) {
printf("#part_num shouldn't be larger than %d\n",
PART_ACCESS_MASK);
return CMD_RET_FAILURE;
}
- speed_mode = (int)dectoul(argv[3], NULL);
+
+ fallthrough;
+ case 2:
+ dev = (int)dectoul(argv[1], &endp);
+ if (*endp) {
+ printf("Invalid device number '%s'\n", argv[1]);
+ return CMD_RET_USAGE;
+ }
+
+ fallthrough;
+ case 1:
mmc = __init_mmc_device(dev, true, speed_mode);
- } else {
+ break;
+ default:
return CMD_RET_USAGE;
}
@@ -597,7 +606,7 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
printf("switch to partitions #%d, %s\n",
part, (!ret) ? "OK" : "ERROR");
if (ret)
- return 1;
+ return CMD_RET_FAILURE;
curr_device = dev;
if (mmc->part_config == MMCPART_NOAVAILABLE)