From: Sascha Hauer <s.hauer@pengutronix.de>
To: Christoph Fritz <chf.fritz@googlemail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mmc_extcsd command: Add cmd option to set bkops-enable
Date: Tue, 19 Jun 2018 15:25:22 +0200 [thread overview]
Message-ID: <20180619132522.zisos7vvvjbet3s5@pengutronix.de> (raw)
In-Reply-To: <1529316238.3364.3.camel@googlemail.com>
On Mon, Jun 18, 2018 at 12:03:58PM +0200, Christoph Fritz wrote:
> This patch is for convenience to set bkops-enable (EXT_CSD_BKOPS_EN[163])
> on devices which have it not yet activated.
>
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
Applied, thanks
Sascha
> commands/mmc_extcsd.c | 26 +++++++++++++++++++++++---
> 1 file changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
> index 82e0600..3a418ea 100644
> --- a/commands/mmc_extcsd.c
> +++ b/commands/mmc_extcsd.c
> @@ -1482,7 +1482,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 +2371,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,6 +2391,13 @@ 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)
> @@ -2421,6 +2429,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 +2484,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
> --
> 2.1.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2018-06-19 13:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 10:03 Christoph Fritz
2018-06-19 13:25 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180619132522.zisos7vvvjbet3s5@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=chf.fritz@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox