public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands
@ 2014-10-05 16:39 Maxime Hadjinlian
  2014-10-05 17:43 ` thomas.langer at lantiq.com
  0 siblings, 1 reply; 14+ messages in thread
From: Maxime Hadjinlian @ 2014-10-05 16:39 UTC (permalink / raw)
  To: u-boot

This patch adds [+]len handler for the all the commands that will
automatically round up the requested erase length to the flash's
sector_size.
It was previously only available for the erase command.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---

 common/cmd_sf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index c60e8d1..d5af3fe 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -245,8 +245,8 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
 	offset = simple_strtoul(argv[2], &endp, 16);
 	if (*argv[2] == 0 || *endp != 0)
 		return -1;
-	len = simple_strtoul(argv[3], &endp, 16);
-	if (*argv[3] == 0 || *endp != 0)
+	len = sf_parse_len_arg(argv[3], &len);
+	if (ret != 1)
 		return -1;
 
 	/* Consistency checking */
@@ -529,15 +529,15 @@ usage:
 U_BOOT_CMD(
 	sf,	5,	1,	do_spi_flash,
 	"SPI flash sub-system",
+	"Note: `+len' round up `len' to block size\n"
 	"probe [[bus:]cs] [hz] [mode]	- init flash device on given SPI bus\n"
 	"				  and chip select\n"
-	"sf read addr offset len	- read `len' bytes starting at\n"
+	"sf read addr offset [+]len	- read `len' bytes starting at\n"
 	"				  `offset' to memory at `addr'\n"
-	"sf write addr offset len	- write `len' bytes from memory\n"
+	"sf write addr offset [+]len	- write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset'\n"
 	"sf erase offset [+]len		- erase `len' bytes from `offset'\n"
-	"				  `+len' round up `len' to block size\n"
-	"sf update addr offset len	- erase and write `len' bytes from memory\n"
+	"sf update addr offset [+]len	- erase and write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset'"
 	SF_TEST_HELP
 );
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-10-11 16:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-05 16:39 [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands Maxime Hadjinlian
2014-10-05 17:43 ` thomas.langer at lantiq.com
2014-10-05 18:40   ` Maxime Hadjinlian
2014-10-05 19:12     ` Marek Vasut
2014-10-05 19:19       ` thomas.langer at lantiq.com
2014-10-05 19:27         ` Maxime Hadjinlian
2014-10-05 19:45           ` Marek Vasut
2014-10-05 19:51             ` Maxime Hadjinlian
2014-10-05 20:28               ` Marek Vasut
2014-10-05 20:35                 ` Maxime Hadjinlian
2014-10-05 20:55                   ` Marek Vasut
2014-10-08  8:35                     ` Chin Liang See
2014-10-10 21:16                       ` Maxime Hadjinlian
2014-10-11 16:22                         ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox