[PATCH 2/2] nand_omap_gpmc: use 0x00 for ECC padding in BCH ROM mode
Sascha Hauer
s.hauer at pengutronix.de
Wed Jan 30 16:52:53 EST 2013
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 at 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 at 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 |
More information about the barebox
mailing list