From: Marek Vasut <marex@denx.de>
To: Fabio Estevam <festevam@gmail.com>
Cc: Shawn Guo <shawn.guo@linaro.org>,
Subodh Nijsure <snijsure@grid-net.com>,
Huang Shijie <b32955@freescale.com>,
linux-mtd@lists.infradead.org,
Sascha Hauer <kernel@pengutronix.de>,
computersforpeace@gmail.com
Subject: Re: Kernel crashes when CONFIG_MTD_NAND_VERIFY_WRITE=y
Date: Fri, 10 Aug 2012 03:41:22 +0200 [thread overview]
Message-ID: <201208100341.23167.marex@denx.de> (raw)
In-Reply-To: <CAOMZO5BCjV6iLUiQ74GskkOdgGpdqbo2ZB=7eu6VeY=mNwWf0Q@mail.gmail.com>
Dear Fabio Estevam,
> Hi Marek,
>
> On Thu, Aug 9, 2012 at 8:53 PM, Marek Vasut <marex@denx.de> wrote:
> > This problem is there because the GPMI NAND code doesn't implement verify
> > buffer
>
> > function and defaults to nand_verify_buf() call in nand_base.c:
> Yes, you are right.
>
> > Now the chip->IO_ADDR_R is zero, making the kernel access bogus location,
> > and therefore crash. So the correct solution is to properly implement
> > the struct nand_chip *'s verify_buf function.
>
> Right, the patch below prevents the kernel to happen:
>
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -857,6 +857,15 @@ static uint8_t gpmi_read_byte(struct mtd_info *mtd)
> return buf[0];
> }
>
> +/* Used by the upper layer to verify the data in NAND Flash
> + * with the data in the buf. */
> +static int gpmi_verify_buf(struct mtd_info *mtd,
> + const u_char *buf, int len)
> +{
> + /* TODO: implement verify_buf mechanism */
> + return 0;
> +}
NAK! This is only a workaround, proper implementation is needed. If it's not
implemented now, I'm pretty sure such workaround will be there forever.
> /*
> * Handles block mark swapping.
> * It can be called in swapping the block mark, or swapping it back,
> @@ -1568,6 +1577,7 @@ static int __devinit gpmi_nfc_init(struct
> gpmi_nand_data *this)
> chip->ecc.size = 1;
> chip->ecc.strength = 8;
> chip->ecc.layout = &gpmi_hw_ecclayout;
> + chip->verify_buf = gpmi_verify_buf;
> if (of_get_nand_on_flash_bbt(this->dev->of_node))
> chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
>
> Now we need to come up with a real gpmi_verify_buf function ;-)
>
> Regards,
>
> Fabio Estevam
Best regards,
Marek Vasut
next prev parent reply other threads:[~2012-08-10 1:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-09 23:43 Kernel crashes when CONFIG_MTD_NAND_VERIFY_WRITE=y Fabio Estevam
2012-08-09 23:53 ` Marek Vasut
2012-08-10 1:36 ` Fabio Estevam
2012-08-10 1:41 ` Marek Vasut [this message]
2012-08-10 1:42 ` Marek Vasut
2012-08-10 1:49 ` Fabio Estevam
2012-08-10 2:08 ` Huang Shijie
2012-08-10 2:11 ` Marek Vasut
2012-08-10 2:29 ` Fabio Estevam
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=201208100341.23167.marex@denx.de \
--to=marex@denx.de \
--cc=b32955@freescale.com \
--cc=computersforpeace@gmail.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-mtd@lists.infradead.org \
--cc=shawn.guo@linaro.org \
--cc=snijsure@grid-net.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