mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Daniel Schultz <d.schultz@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v3 4/4] commands: Add MMC ext. CSD register tool
Date: Mon, 7 Sep 2015 09:00:53 +0200	[thread overview]
Message-ID: <20150907070053.GY18700@pengutronix.de> (raw)
In-Reply-To: <1441175333-26759-4-git-send-email-d.schultz@phytec.de>

On Wed, Sep 02, 2015 at 08:28:53AM +0200, Daniel Schultz wrote:
> +#define EXT_CSD_BLOCKSIZE	512
> +
> +/* Access types */
> +#define R		"R"
> +#define RW		"R/W"
> +#define RWaR		"R/W & R"
> +#define RWaRWE		"R/W & R/W/E"
> +#define RWaRWC_P	"R/W & R/W/C_P"
> +#define RWaRWC_PaRWE_P	"R/W, R/W/C_P & R/W/E_P"
> +#define WE		"W/E"
> +#define RWE		"R/W/E"
> +#define RWEaR		"R/W/E & R"
> +#define RWEaRWE_P	"R/W/E & R/W/E_P"
> +#define RWC_P		"R/W/C_P"
> +#define RWE_P		"R/W/E_P"
> +#define WE_P		"W/E_P"
> +
> +#define print_field_caption(reg_name, access_mode)			       \
> +	do {								       \
> +		printf(#reg_name"[%u]:\n", EXT_CSD_##reg_name);		       \
> +		printf("\tValue: %#02x\n", reg[index]);			       \
> +		printf("\tAccess: "access_mode"\n");			       \
> +	} while (false);
> +
> +#define print_field_caption_with_offset(reg_name, offset, access_mode)	       \
> +	do {								       \
> +		printf(#reg_name"[%u]:\n", EXT_CSD_##reg_name + offset);       \
> +		printf("\tValue: %#02x\n", reg[index]);			       \
> +		printf("\tAccess: "access_mode"\n");			       \
> +	} while (false);
> +
> +#define get_field_val(reg_name, offset, mask)				       \
> +	((reg[EXT_CSD_##reg_name] >> offset) & mask)
> +
> +#define get_field_val_with_index(index, offset, mask)			       \
> +	((reg[index] >> offset) & mask)
> +
> +static void print_access_type_key(void)
> +{
> +	printf("\nR:       Read only.\n");
> +	printf("W:       One time programmable and not readable.\n");
> +	printf("R/W:     One time programmable and readable.\n");
> +	printf("W/E:     Multiple writable with value kept after power failure, H/W reset assertion and any CMD0 reset and not readable.\n");
> +	printf("R/W/E:   Multiple writable with value kept after power failure, H/W reset assertion and any CMD0 reset and readable.\n");
> +	printf("R/W/C_P: Writable after value cleared by power failure and HW/rest assertion (the value not cleared by CMD0 reset) and readable.\n");
> +	printf("R/W/E_P: Multiple writable with value reset after power failure, H/W reset assertion and any CMD0 reset and readable.\n");
> +	printf("W/E_P:   Multiple writable with value reset after power failure, H/W reset assertion and any CMD0 reset and not readable.\n\n");

Wouldn't it make sense to explain the meaning of the individual flags
rather than all possible combinations? i.e.:

R: readable
W: One time writable
E: Multiple writable
C_P: Value cleared by power failure
E_P: Value cleared by power failure and CMD0

Also please add some linebreaks in the printfs. You can do multiline
printf like this:

	printf("permanently disable the use of permanent write protection\n"
		"for write protection groups within all the partitions in the\n"
		"user area from the point this bit is set forward. Setting this\n"
		"bit does not impact areas that are already protected\n"

Even better, shorten the descriptions. "permanently disable the use of
permanent write protection\n" should be enough in this case.

s/optimzed/optimized/
s/disbale/disable/

Sascha


-- 
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

      reply	other threads:[~2015-09-07  7:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02  6:28 [PATCH v3 1/4] drivers: mci: Make two functions public Daniel Schultz
2015-09-02  6:28 ` [PATCH v3 2/4] include: mci: Add new ext. CSD field defines Daniel Schultz
2015-09-02  6:28 ` [PATCH v3 3/4] drivers: mci: Add mci_get_device_by_name function Daniel Schultz
2015-09-07  5:47   ` Sascha Hauer
2015-09-02  6:28 ` [PATCH v3 4/4] commands: Add MMC ext. CSD register tool Daniel Schultz
2015-09-07  7:00   ` 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=20150907070053.GY18700@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=d.schultz@phytec.de \
    /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