From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] cmd_sf: Add handler for +len arg for erase command.
Date: Wed, 16 Feb 2011 15:47:17 -0600 [thread overview]
Message-ID: <20110216154717.39b0b3a7@schlenkerla> (raw)
In-Reply-To: <1297888074-8344-3-git-send-email-RichardRetanubun@RuggedCom.com>
On Wed, 16 Feb 2011 15:27:54 -0500
Richard Retanubun <RichardRetanubun@ruggedcom.com> wrote:
> This patch adds [+]len handler for the erase command that will
> automatically round up the requested erase length to the flash's
> sector_size.
> ---
> common/cmd_sf.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index 6e7be81..bbd4842 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -19,6 +19,48 @@
>
> static struct spi_flash *flash;
>
> +
> +/*
> + * This function computes the length argument for the erase command.
> + * The length on which the command is to operate can be given in two forms:
> + * 1. <cmd> offset len - operate on <'offset', 'len')
> + * 2. <cmd> offset +len - operate on <'offset', 'round_up(len)')
> + * If the second form is used and the length doesn't fall on the
> + * sector boundary, than it will be adjusted to the next sector boundary.
> + * If it isn't in the flash, the function will fail (return -1).
On NOR, + is used to indicate that the second argument is a length,
as opposed to an ending address. Rounding seems like a side effect of
length mode.
On NAND we unconditionally round up erase lengths, as we don't support
ending-address mode (looks like SPI doesn't either).
-Scott
prev parent reply other threads:[~2011-02-16 21:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 14:13 [U-Boot] [U-boot] sf: API for spi_flash_get_sector_size Richard Retanubun
2011-02-08 14:40 ` Wolfgang Denk
2011-02-08 15:11 ` Richard Retanubun
2011-02-08 15:19 ` Wolfgang Denk
2011-02-08 15:33 ` Richard Retanubun
2011-02-09 21:16 ` [U-Boot] [PATCH] [RFC] SF: Add "sf erase offset +len" command handler Richard Retanubun
2011-02-15 9:34 ` Mike Frysinger
2011-02-16 20:27 ` [U-Boot] (no subject) Richard Retanubun
2011-02-17 5:46 ` Mike Frysinger
2011-02-16 20:27 ` [U-Boot] [PATCH 1/2] SPI: Add struct spi_flash.sector_size parameter Richard Retanubun
2011-02-16 21:00 ` Wolfgang Denk
2011-02-16 20:27 ` [U-Boot] [PATCH 2/2] cmd_sf: Add handler for +len arg for erase command Richard Retanubun
2011-02-16 21:06 ` Wolfgang Denk
2011-02-16 21:37 ` [U-Boot] [PATCH 1/2] SPI: Add struct spi_flash.sector_size parameter Richard Retanubun
2011-04-12 6:34 ` Mike Frysinger
2011-02-16 21:39 ` [U-Boot] [PATCH 2/2] cmd_sf: Add handler for +len arg for erase command Richard Retanubun
2011-02-16 21:47 ` Scott Wood [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=20110216154717.39b0b3a7@schlenkerla \
--to=scottwood@freescale.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