mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jan Luebbe <jlu@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] nand_omap_gpmc: use 0x00 for ECC padding in BCH ROM mode
Date: Wed, 30 Jan 2013 22:52:53 +0100	[thread overview]
Message-ID: <20130130215253.GG1906@pengutronix.de> (raw)
In-Reply-To: <1359453482-6583-2-git-send-email-jlu@pengutronix.de>

On Tue, Jan 29, 2013 at 10:58:02AM +0100, Jan Luebbe wrote:
> The kernel uses these bytes to differentiate between erased/programmed
> pages.
> 
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
>  drivers/mtd/nand/nand_omap_gpmc.c |   30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
> index 9050a8d..b81ad53 100644
> --- a/drivers/mtd/nand/nand_omap_gpmc.c
> +++ b/drivers/mtd/nand/nand_omap_gpmc.c
> @@ -751,6 +751,35 @@ static int omap_gpmc_read_page_bch_rom_mode(struct mtd_info *mtd,
>  	return 0;
>  }
>  
> +static void omap_gpmc_write_page_bch_rom_mode(struct mtd_info *mtd, struct nand_chip *chip,
> +				  const uint8_t *buf)
> +{
> +	int i, eccsize = chip->ecc.size;
> +	int eccbytes = chip->ecc.bytes;
> +	int eccsteps = chip->ecc.steps;
> +	uint8_t *ecc_calc = chip->buffers->ecccalc;
> +	const uint8_t *p = buf;
> +	uint32_t *eccpos = chip->ecc.layout->eccpos;
> +
> +	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
> +		chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
> +		chip->write_buf(mtd, p, eccsize);
> +		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
> +	}
> +
> +	for (i = 0; i < chip->ecc.total; i++)
> +		chip->oob_poi[eccpos[i]] = ecc_calc[i];
> +
> +	/*
> +	 * set padding byte for each subpage to 0x00, so the kernel
> +	 * can detect erased pages
> +	 */
> +	for (i = 0; i < 4; i++) {
> +		chip->oob_poi[1+14*(i+1)] = 0x00;
> +	}
> +
> +	chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
> +}
>  static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
>  		enum gpmc_ecc_mode mode)
>  {

Nit: Missing blank line.

Sascha

> @@ -823,6 +852,7 @@ static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
>  		oinfo->nand.ecc.bytes    = 4 * 13;
>  		oinfo->nand.ecc.size     = 4 * 512;
>  		nand->ecc.read_page = omap_gpmc_read_page_bch_rom_mode;
> +		nand->ecc.write_page = omap_gpmc_write_page_bch_rom_mode;
>  		omap_oobinfo.oobfree->length = 0;
>  		j = 0;
>  		for (i = 2; i < 15; i++)
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-01-30 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29  9:58 [PATCH 1/2] nand_write: initialize OOB buffer for each page Jan Luebbe
2013-01-29  9:58 ` [PATCH 2/2] nand_omap_gpmc: use 0x00 for ECC padding in BCH ROM mode Jan Luebbe
2013-01-30 21:52   ` Sascha Hauer [this message]
2013-01-30 21:52 ` [PATCH 1/2] nand_write: initialize OOB buffer for each page Sascha Hauer

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=20130130215253.GG1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jlu@pengutronix.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