From: Jagan Teki <jagannadh.teki@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v3, 2/2] cmd_sf: Add print mesgs on sf read/write commands
Date: Mon, 03 Jun 2013 00:13:40 +0530 [thread overview]
Message-ID: <51AB925C.7010708@gmail.com> (raw)
In-Reply-To: <50a124ba-ac79-4b9f-9747-90aac19362da@CO9EHSMHS026.ehs.local>
On 27-05-2013 15:41, Jagannadha Sutradharudu Teki wrote:
> This patch adds a print messages while using 'sf read' and
> 'sf write' commands to make sure that how many bytes read/written
> from/into flash device.
>
> Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
>
> ---
> common/cmd_sf.c | 26 +++++++++++++++-----------
> drivers/mtd/spi/spi_flash.c | 3 ---
> 2 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index 12d1aca..3a40444 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -234,7 +234,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
> unsigned long len;
> void *buf;
> char *endp;
> - int ret;
> + int ret = 1;
>
> if (argc < 4)
> return -1;
> @@ -264,19 +264,23 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
>
> if (strcmp(argv[0], "update") == 0)
> ret = spi_flash_update(flash, offset, len, buf);
> - else if (strcmp(argv[0], "read") == 0)
> - ret = spi_flash_read(flash, offset, len, buf);
> - else
> - ret = spi_flash_write(flash, offset, len, buf);
> + else if (strncmp(argv[0], "read", 4) == 0 ||
> + strncmp(argv[0], "write", 5) == 0) {
> + int read;
> +
> + read = strncmp(argv[0], "read", 4) == 0;
> + if (read)
> + ret = spi_flash_read(flash, offset, len, buf);
> + else
> + ret = spi_flash_write(flash, offset, len, buf);
> +
> + printf("SF: %zu bytes @ %#x %s: %s\n", (size_t)len, (u32)offset,
> + read ? "Read" : "Written", ret ? "ERROR" : "OK");
> + }
>
> unmap_physmem(buf, len);
>
> - if (ret) {
> - printf("SPI flash %s failed\n", argv[0]);
> - return 1;
> - }
> -
> - return 0;
> + return ret == 0 ? 0 : 1;
> }
>
> static int do_spi_flash_erase(int argc, char * const argv[])
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 77938d3..aeb1ccb 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -125,9 +125,6 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset,
> }
> }
>
> - debug("SF: program %s %zu bytes @ %#x\n",
> - ret ? "failure" : "success", len, offset);
> -
> spi_release_bus(flash->spi);
> return ret;
> }
Applied to u-boot-spi/master
--
Thanks,
Jagan.
prev parent reply other threads:[~2013-06-02 18:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1369685506-30740-1-git-send-email-jaganna@xilinx.com>
2013-05-27 20:11 ` [U-Boot] [PATCH v3 1/2] cmd_sf: Add print mesg for 'sf erase' command Jagannadha Sutradharudu Teki
2013-06-02 18:44 ` [U-Boot] [U-Boot, v3, " Jagan Teki
2013-05-27 20:11 ` [U-Boot] [PATCH v3 2/2] cmd_sf: Add print mesgs on sf read/write commands Jagannadha Sutradharudu Teki
2013-06-02 18:43 ` Jagan Teki [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=51AB925C.7010708@gmail.com \
--to=jagannadh.teki@gmail.com \
--cc=u-boot@lists.denx.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