diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-07-09 08:21:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-07-09 08:21:18 +0200 |
commit | 6af0422208def55bb4eb5a5a0235b48a7c815c8e (patch) | |
tree | 6325f157fd7ad908835593862ef8a80043b3bcce /commands | |
parent | 1f3af633e28876c2a9649bce59747b3b23990e16 (diff) | |
parent | 36260f162defe41fe144d69756990519c4188c83 (diff) | |
download | barebox-6af0422208def55bb4eb5a5a0235b48a7c815c8e.tar.gz barebox-6af0422208def55bb4eb5a5a0235b48a7c815c8e.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'commands')
-rw-r--r-- | commands/mmc_extcsd.c | 31 | ||||
-rw-r--r-- | commands/mount.c | 5 |
2 files changed, 26 insertions, 10 deletions
diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c index 82e0600eaf..889a6c614a 100644 --- a/commands/mmc_extcsd.c +++ b/commands/mmc_extcsd.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <mci.h> #include <getopt.h> +#include <fs.h> #define EXT_CSD_BLOCKSIZE 512 @@ -1482,7 +1483,7 @@ static int print_field(u8 *reg, int index) str = "may"; else str = "shall not"; - printf("\t[1] AUTO_EN: Device %s perform background ops while" + printf("\t[1] AUTO_EN: Device %s perform background ops while\n" "\t not servicing the host\n", str); return 1; @@ -2371,11 +2372,12 @@ static int do_mmc_extcsd(int argc, char *argv[]) int write_operation = 0; int always_write = 0; int print_as_raw = 0; + int set_bkops_en = 0; if (argc < 2) return COMMAND_ERROR_USAGE; - while ((opt = getopt(argc, argv, "i:v:yr")) > 0) + while ((opt = getopt(argc, argv, "i:v:yrb")) > 0) switch (opt) { case 'i': index = simple_strtoul(optarg, NULL, 0); @@ -2390,16 +2392,21 @@ static int do_mmc_extcsd(int argc, char *argv[]) case 'r': print_as_raw = 1; break; + case 'b': + set_bkops_en = 1; + index = EXT_CSD_BKOPS_EN; + value = BIT(0); + write_operation = 1; + always_write = 1; + break; } if (optind == argc) return COMMAND_ERROR_USAGE; devname = argv[optind]; - if (!strncmp(devname, "/dev/", 5)) - devname += 5; - mci = mci_get_device_by_name(devname); + mci = mci_get_device_by_name(devpath_to_name(devname)); if (mci == NULL) { retval = -ENOENT; goto error; @@ -2421,6 +2428,16 @@ static int do_mmc_extcsd(int argc, char *argv[]) goto error_with_mem; } + if (set_bkops_en) { + if (dst[index]) { + printf("Abort: EXT_CSD [%u] already set to %#02x!\n", + index, dst[index]); + goto error_with_mem; + } + if (dst[EXT_CSD_REV] >= 7) + value |= BIT(1); /* set AUTO_EN bit too */ + } + if (write_operation) if (!print_field(dst, index)) { printf("No field with this index found. Abort write operation!\n"); @@ -2466,12 +2483,14 @@ BAREBOX_CMD_HELP_OPT("-r", "print the register as raw data") BAREBOX_CMD_HELP_OPT("-v", "value which will be written") BAREBOX_CMD_HELP_OPT("-y", "don't request when writing to one time programmable fields") BAREBOX_CMD_HELP_OPT("", "__CAUTION__: this could damage the device!") +BAREBOX_CMD_HELP_OPT("-b", "set bkops-enable (EXT_CSD_BKOPS_EN[163])") +BAREBOX_CMD_HELP_OPT("", "__WARNING__: this is a write-once setting!") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(mmc_extcsd) .cmd = do_mmc_extcsd, BAREBOX_CMD_DESC("Read/write the extended CSD register.") - BAREBOX_CMD_OPTS("dev [-r | -i index [-r | -v value [-y]]]") + BAREBOX_CMD_OPTS("dev [-r | -b | -i index [-r | -v value [-y]]]") BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE) BAREBOX_CMD_HELP(cmd_mmc_extcsd_help) BAREBOX_CMD_END diff --git a/commands/mount.c b/commands/mount.c index 4cf1179b7b..834b06386b 100644 --- a/commands/mount.c +++ b/commands/mount.c @@ -76,10 +76,7 @@ static int do_mount(int argc, char *argv[]) struct cdev *cdev; const char *path; - if (!strncmp(devstr, "/dev/", 5)) - devstr += 5; - - device_detect_by_name(devstr); + device_detect_by_name(devpath_to_name(devstr)); cdev = cdev_by_name(devstr); if (!cdev) |