public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jagannadh.teki@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v3, 1/2] cmd_sf: Add print mesg for 'sf erase' command
Date: Mon, 03 Jun 2013 00:14:19 +0530	[thread overview]
Message-ID: <51AB9283.3000908@gmail.com> (raw)
In-Reply-To: <7d2959d1-82c1-4558-a99b-815c31b6e1a5@CO9EHSMHS009.ehs.local>

On 27-05-2013 15:41, Jagannadha Sutradharudu Teki wrote:
> This patch adds a print messages while using 'sf erase' command
> to make sure that how many bytes erased in flash device.
>
> Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
>
> ---
> common/cmd_sf.c             |    8 +++-----
>   drivers/mtd/spi/spi_flash.c |    7 ++-----
>   2 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index 1daff70..12d1aca 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -305,12 +305,10 @@ static int do_spi_flash_erase(int argc, char * const argv[])
>   	}
>   
>   	ret = spi_flash_erase(flash, offset, len);
> -	if (ret) {
> -		printf("SPI flash %s failed\n", argv[0]);
> -		return 1;
> -	}
> +	printf("SF: %zu bytes @ %#x Erased: %s\n", (size_t)len, (u32)offset,
> +			ret ? "ERROR" : "OK");
>   
> -	return 0;
> +	return ret == 0 ? 0 : 1;
>   }
>   
>   #ifdef CONFIG_CMD_SF_TEST
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index d2bee3a..77938d3 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -206,7 +206,7 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout)
>   
>   int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)
>   {
> -	u32 start, end, erase_size;
> +	u32 end, erase_size;
>   	int ret;
>   	u8 cmd[4];
>   
> @@ -226,8 +226,7 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)
>   		cmd[0] = CMD_ERASE_4K;
>   	else
>   		cmd[0] = CMD_ERASE_64K;
> -	start = offset;
> -	end = start + len;
> +	end = offset + len;
>   
>   	while (offset < end) {
>   		spi_flash_addr(offset, cmd);
> @@ -251,8 +250,6 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)
>   			goto out;
>   	}
>   
> -	debug("SF: Successfully erased %zu bytes @ %#x\n", len, start);
> -
>    out:
>   	spi_release_bus(flash->spi);
>   	return ret;
Applied to u-boot-spi/master

--
Thanks,
Jagan.

  reply	other threads:[~2013-06-02 18:44 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   ` Jagan Teki [this message]
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   ` [U-Boot] [U-Boot, v3, " Jagan Teki

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=51AB9283.3000908@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