[U-Boot] [PATCH] NAND: fixed bugs in nand_[read, write]_skip_bad()
Scott Wood
scottwood at freescale.com
Fri Nov 21 18:22:13 CET 2008
On Tue, Nov 18, 2008 at 07:27:29PM +0200, Valeriy Glushkov wrote:
> - fixed bugs in nand_[read,write]_skip_bad() to double speed
Changelog should specify what the bugs are.
> - added printing of dots to show progress
>
> Signed-off-by: Valeriy Glushkov <gvv at lstec.com>
> ---
> drivers/mtd/nand/nand_base.c | 16 ++++++++++++++--
> drivers/mtd/nand/nand_util.c | 6 ++++--
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 00c9d4a..e4da6b1 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -1136,8 +1136,11 @@ static int nand_do_read_ops(struct mtd_info *mtd,
> loff_t from,
> ret = chip->ecc.read_page_raw(mtd, chip, bufpoi);
> else
> ret = chip->ecc.read_page(mtd, chip, bufpoi);
> - if (ret < 0)
> + if (ret < 0) {
> + printf("nand_read_opts: page 0x%x error %d\n",
> + realpage, ret);
> break;
> + }
This patch is whitespace-damaged.
>
> /* Transfer not aligned data */
> if (!aligned) {
> @@ -1190,6 +1193,9 @@ static int nand_do_read_ops(struct mtd_info *mtd,
> loff_t from,
> /* Increment page address */
> realpage++;
>
> + if( !((realpage << chip->page_shift) & 0xfffff) )
if (!(xxx)), not if( !(xxx) ).
> + debug(".");
Should progress meters really be debug()?
Maybe space it out according to percentage, rather than a fixed interval.
> page = realpage & chip->pagemask;
> /* Check, if we cross a chip boundary */
> if (!page) {
> @@ -1828,8 +1834,11 @@ static int nand_do_write_ops(struct mtd_info *mtd,
> loff_t to,
>
> ret = chip->write_page(mtd, chip, wbuf, page, cached,
> (ops->mode == MTD_OOB_RAW));
> - if (ret)
> + if (ret) {
> + printf("nand_write_opts: page 0x%x error %d\n",
> + realpage, ret);
> break;
> + }
>
> writelen -= bytes;
> if (!writelen)
> @@ -1839,6 +1848,9 @@ static int nand_do_write_ops(struct mtd_info *mtd,
> loff_t to,
> buf += bytes;
> realpage++;
>
> + if( !((realpage << chip->page_shift) & 0xfffff) )
> + debug(".");
> +
> page = realpage & chip->pagemask;
> /* Check, if we cross a chip boundary */
> if (!page) {
> diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
> index 52b3d21..818a876 100644
> --- a/drivers/mtd/nand/nand_util.c
> +++ b/drivers/mtd/nand/nand_util.c
> @@ -498,8 +498,8 @@ int nand_write_skip_bad(nand_info_t *nand, size_t
> offset, size_t *length,
> if (rval != 0) {
> printf ("NAND write to offset %x failed %d\n",
> offset, rval);
> - return rval;
> }
> + return rval;
> }
This bit should be posted in a separate patch, as it's a bugfix that can
go in outside the merge window.
Or, we could just get rid of this altogether and always use the loop.
-Scott
More information about the U-Boot
mailing list