public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: LiuShuo <b35362@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] mtd/nand: workaround for Freescale FCM to support 4k pagesize Nand chip
Date: Fri, 9 Dec 2011 10:33:57 +0800	[thread overview]
Message-ID: <4EE17395.5010308@freescale.com> (raw)
In-Reply-To: <201112081737.22273.marek.vasut@gmail.com>

? 2011?12?09? 00:37, Marek Vasut ??:
>> 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: Shengzhou Liu<Shengzhou.Liu@freescale.com>
>> Signed-off-by: Liu Shuo<b35362@freescale.com>
>> ---
>>   drivers/mtd/nand/fsl_elbc_nand.c |  279
>> +++++++++++++++++++++++++++++++++---- 1 files changed, 248 insertions(+),
>> 31 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c
>> b/drivers/mtd/nand/fsl_elbc_nand.c index 52362b1..3983c8c 100644
>> --- a/drivers/mtd/nand/fsl_elbc_nand.c
>> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
>> @@ -64,7 +64,6 @@ struct fsl_elbc_mtd {
>>   	struct device *dev;
>>   	int bank;               /* Chip select bank number           */
>>   	u8 __iomem *vbase;      /* Chip select base virtual address  */
>> -	int page_size;          /* NAND page size (0=512, 1=2048)    */
>>   	unsigned int fmr;       /* FCM Flash Mode Register value     */
>>   };
>>
>> @@ -85,6 +84,8 @@ struct fsl_elbc_ctrl {
>>   	unsigned int mdr;        /* UPM/FCM Data Register value           */
>>   	unsigned int use_mdr;    /* Non zero if the MDR is to be set      */
>>   	unsigned int oob;        /* Non zero if operating on OOB data     */
>> +	char *buffer;            /* just used when pagesize is greater    */
> Start sentence with capital letter
>
>> +				 /* than FCM RAM 2K limitation		  */
>>   };
>>
>>   /* These map to the positions used by the FCM hardware ECC generator */
>> @@ -159,6 +160,44 @@ static struct nand_bbt_descr bbt_mirror_descr = {
>>   	.pattern = mirror_pattern,
>>   };
>>
>> +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_ctrl *ctrl = priv->ctrl;
>> +	void *src, *dst;
>> +	int len = (oob ? 64 : 2048);
> No parenthesis ...
>
>> +
>> +	/* for emulating 4096+ bytes NAND using 2048-byte FCM RAM */
>> +	if (oob)
>> +		dst = ctrl->buffer + mtd->writesize + subpage * 64;
>> +	else
>> +		dst = ctrl->buffer + subpage * 2048;
> subpage * len ?
dst = ctrl->buffer + (oob ? mtd->writesize : 0) + subpage * len ?
Is this important ? I think it is ok.

-LiuShuo

>
>> +
>> +	src = ctrl->addr + (oob ? 2048 : 0);
>> +	memcpy_fromio(dst, src, len);
>> +}
>> +
>> +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_ctrl *ctrl = priv->ctrl;
>> +	void *src, *dst;
>> +	int len = (oob ? 64 : 2048);
>> +
>> +	if (oob)
>> +		src = ctrl->buffer + mtd->writesize + subpage * 64;
>> +	else
>> +		src = ctrl->buffer + subpage * 2048;
> DTTO
>
> M
>

  reply	other threads:[~2011-12-09  2:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08 10:49 [U-Boot] [PATCH 1/5] mtd/nand: Add function board_nand_init_tail() for some special NAND controllers Shengzhou Liu
2011-12-08 10:49 ` [U-Boot] [PATCH 2/5] mtd/nand: Fixup for support ONFI detect Shengzhou Liu
2011-12-08 10:49   ` [U-Boot] [PATCH 3/5] mtd/nand: remove CONFIG_SYS_NAND_ONFI_DETECTION to enable ONFI detection Shengzhou Liu
2011-12-08 10:49     ` [U-Boot] [PATCH 4/5] mtd/nand: Add ONFI support for FSL NAND controller Shengzhou Liu
2011-12-08 10:49       ` [U-Boot] [PATCH 5/5] mtd/nand: workaround for Freescale FCM to support 4k pagesize Nand chip Shengzhou Liu
2011-12-08 16:37         ` Marek Vasut
2011-12-09  2:33           ` LiuShuo [this message]
2011-12-09  8:27             ` Marek Vasut
2011-12-09  8:58               ` LiuShuo
2011-12-09  9:11                 ` Marek Vasut
2011-12-09  9:32                   ` LiuShuo
2011-12-09  9:46                     ` Marek Vasut
2011-12-08 18:09       ` [U-Boot] [PATCH 4/5] mtd/nand: Add ONFI support for FSL NAND controller Scott Wood
2011-12-08 16:35 ` [U-Boot] [PATCH 1/5] mtd/nand: Add function board_nand_init_tail() for some special NAND controllers Marek Vasut

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=4EE17395.5010308@freescale.com \
    --to=b35362@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