From: Brian Norris <computersforpeace@gmail.com>
To: Huang Shijie <b32955@freescale.com>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
akinobu.mita@gmail.com, matthieu.castet@parrot.com,
dedekind1@gmail.com
Subject: Re: [PATCH v2 4/9] mtd: gpmi: rewrite the gpmi_ecc_write_oob() to support the jffs2
Date: Fri, 23 Aug 2013 23:19:16 -0700 [thread overview]
Message-ID: <20130824061916.GC32074@brian-ubuntu> (raw)
In-Reply-To: <1376879478-22128-5-git-send-email-b32955@freescale.com>
On Mon, Aug 19, 2013 at 10:31:13AM +0800, Huang Shijie wrote:
> When we use the ECC info which is get from the nand chip's datasheet,
> we may have some freed oob area now.
>
> This patch rewrites the gpmi_ecc_write_oob() to implement the ecc.write_oob().
> We also update the comment for gpmi_hw_ecclayout.
>
> Yes! We can support the JFFS2 for the SLC nand now.
>
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 31 ++++++++++++++++++++++---------
> 1 files changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 9c89e80..cc0306b 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -45,7 +45,10 @@ static struct nand_bbt_descr gpmi_bbt_descr = {
> .pattern = scan_ff_pattern
> };
>
> -/* We will use all the (page + OOB). */
> +/*
> + * We may change the layout if we can get the ECC info from the datasheet,
> + * else we will use all the (page + OOB).
> + */
> static struct nand_ecclayout gpmi_hw_ecclayout = {
> .eccbytes = 0,
> .eccpos = { 0, },
> @@ -1263,14 +1266,24 @@ static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
> static int
> gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page)
> {
> - /*
> - * The BCH will use all the (page + oob).
> - * Our gpmi_hw_ecclayout can only prohibit the JFFS2 to write the oob.
> - * But it can not stop some ioctls such MEMWRITEOOB which uses
> - * MTD_OPS_PLACE_OOB. So We have to implement this function to prohibit
> - * these ioctls too.
> - */
> - return -EPERM;
> + struct nand_oobfree *of = gpmi_hw_ecclayout.oobfree;
Why do you directly access your static layout? I think you should use
the proper indirection, through chip->ecc.layout. (There's a similar
issue with set_geometry_by_ecc_info() currently.)
[BTW, I was about to recommend nand_chip.ecclayout, but it looks like
that is just a dead field. It's not initialized anywhere, AFAICT, and if
it's used anywhere, it's more likely a bug than anything else...]
> + int status = 0;
> +
> + /* Do we have available oob area? */
> + if (!of->length)
> + return -EPERM;
> +
> + if (!nand_is_slc(chip))
> + return -EPERM;
> +
> + pr_debug("page number is %d\n", page);
> +
> + chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize + of->offset, page);
> + chip->write_buf(mtd, chip->oob_poi + of->offset, of->length);
> + chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
> +
> + status = chip->waitfunc(mtd, chip);
> + return status & NAND_STATUS_FAIL ? -EIO : 0;
> }
>
> static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs)
Brian
next prev parent reply other threads:[~2013-08-24 6:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-19 2:31 [PATCH v2 0/9] About the SLC/MLC Huang Shijie
2013-08-19 2:31 ` [PATCH v2 1/9] mtd: nand: rename the cellinfo to bits_per_cell Huang Shijie
2013-08-24 5:49 ` Brian Norris
2013-08-25 3:52 ` Huang Shijie
2013-08-19 2:31 ` [PATCH v2 2/9] mtd: set the cell information for ONFI nand Huang Shijie
2013-08-19 2:31 ` [PATCH v2 3/9] mtd: print out the cell information for nand chip Huang Shijie
2013-08-24 5:58 ` Brian Norris
2013-08-24 21:02 ` Ezequiel Garcia
2013-08-25 16:04 ` Huang Shijie
2013-08-19 2:31 ` [PATCH v2 4/9] mtd: gpmi: rewrite the gpmi_ecc_write_oob() to support the jffs2 Huang Shijie
2013-08-24 6:19 ` Brian Norris [this message]
2013-08-24 19:18 ` Huang Shijie
2013-08-24 7:17 ` Brian Norris
2013-08-19 2:31 ` [PATCH v2 5/9] mtd: add more comment for MTD_NANDFLASH/MTD_MLCNANDFLASH Huang Shijie
2013-08-19 2:31 ` [PATCH v2 6/9] mtd: fix the wrong mtd->type for nand chip Huang Shijie
2013-08-19 2:31 ` [PATCH v2 7/9] jffs2: init the ret with -EINVAL Huang Shijie
2013-08-24 6:37 ` Brian Norris
2013-08-25 4:00 ` Huang Shijie
2013-08-19 2:31 ` [PATCH v2 8/9] mtd: add MTD_MLCNANDFLASH case for mtd_type_show() Huang Shijie
2013-08-19 2:31 ` [PATCH v2 9/9] mtd: add a helper to detect the nand type Huang Shijie
2013-08-19 8:59 ` [PATCH v2 append] mtd: mtd-abi: " Huang Shijie
2013-08-20 5:32 ` [PATCH append fix] " Huang Shijie
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=20130824061916.GC32074@brian-ubuntu \
--to=computersforpeace@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=b32955@freescale.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=matthieu.castet@parrot.com \
/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