[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3F607A5180246847A760FD34122A1E052DC4CD@039-SN1MPN1-003.039d.mgd.msft.net>
Date: Thu, 24 Nov 2011 07:37:21 +0000
From: Li Yang-R58472 <r58472@...escale.com>
To: Liu Shuo-B35362 <B35362@...escale.com>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"Artem.Bityutskiy@...ia.com" <Artem.Bityutskiy@...ia.com>,
Wood Scott-B07421 <B07421@...escale.com>
CC: "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/3] mtd/nand : workaround for Freescale FCM to support
large-page Nand chip
> Subject: [PATCH 3/3] mtd/nand : workaround for Freescale FCM to support
> large-page Nand chip
>
> From: Liu Shuo <b35362@...escale.com>
>
> Freescale FCM controller has a 2K size limitation of buffer RAM. In order
> to support the Nand flash chip whose page size is larger than 2K bytes,
> we read/write 2k data repeatedly by issuing FIR_OP_RB/FIR_OP_WB and save
> them to a large buffer.
>
> Signed-off-by: Liu Shuo <b35362@...escale.com>
> Signed-off-by: Li Yang <leoli@...escale.com>
> ---
> drivers/mtd/nand/fsl_elbc_nand.c | 211
> +++++++++++++++++++++++++++++++++++---
> 1 files changed, 194 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
> index d634c5f..c96e714 100644
> --- a/drivers/mtd/nand/fsl_elbc_nand.c
> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
[snip]
> +static void io_to_buffer(struct mtd_info *mtd, int subpage, int oob)
> +{
> + struct nand_chip *chip = mtd->priv;
> + struct fsl_elbc_mtd *priv = chip->priv;
> + struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
> + void *src, *dst;
> + int len = (oob ? 64 : 2048);
> +
> + if (oob)
> + dst = elbc_fcm_ctrl->buffer + mtd->writesize + subpage * 64;
> + else
> + dst = elbc_fcm_ctrl->buffer + subpage * 2048;
> +
> + src = elbc_fcm_ctrl->addr + (oob ? 2048 : 0);
> + memcpy_fromio(dst, src, len);
Might be safer to use _memcpy_fromio()
> +}
> +
> +static void buffer_to_io(struct mtd_info *mtd, int subpage, int oob)
> +{
> + struct nand_chip *chip = mtd->priv;
> + struct fsl_elbc_mtd *priv = chip->priv;
> + struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
> + void *src, *dst;
> + int len = (oob ? 64 : 2048);
> +
> + if (oob)
> + src = elbc_fcm_ctrl->buffer + mtd->writesize + subpage * 64;
> + else
> + src = elbc_fcm_ctrl->buffer + subpage * 2048;
> +
> + dst = elbc_fcm_ctrl->addr + (oob ? 2048 : 0);
> + memcpy_toio(dst, src, len);
> +
> + /* See the in_8() in fsl_elbc_write_buf() */
> + in_8(elbc_fcm_ctrl->addr);
Should be safer to read back the last char.
- Leo
Powered by blists - more mailing lists