mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] mtd: nand-imx: don't copy more bytes than read from hardware
Date: Thu,  5 Feb 2015 22:21:32 +0100	[thread overview]
Message-ID: <1423171292-26728-4-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1423171292-26728-1-git-send-email-u.kleine-koenig@pengutronix.de>

The NFC command used for reading the result of a READID command to the NAND chip
reads 6 bytes (in x8 mode) or 6 words (in x16 mode with the upper bytes all
being 0). So there is no need to safe 16 bytes for later consumption.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/nand/nand_imx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
index 685750991389..00c05d00afe3 100644
--- a/drivers/mtd/nand/nand_imx.c
+++ b/drivers/mtd/nand/nand_imx.c
@@ -362,7 +362,11 @@ static void send_read_id_v3(struct imx_nand_host *host)
 
 	wait_op_done(host);
 
-	memcpy(host->data_buf, host->main_area0, 16);
+	/*
+	 * NFC_ID results in reading 6 bytes or words (depending on data width),
+	 * so copying 3 32-bit values is just fine.
+	 */
+	memcpy(host->data_buf, host->main_area0, 12);
 }
 
 static void send_read_param_v3(struct imx_nand_host *host)
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-02-05 21:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 21:21 [PATCH 0/3] mtd: nand: ONFI probing for x16 devices on i.MX25 (and others) Uwe Kleine-König
2015-02-05 21:21 ` [PATCH 1/3] mtd: nand-imx: fix byte reading in x16 mode Uwe Kleine-König
2015-02-05 21:21 ` [PATCH 2/3] mtd: nand: cleanup ONFI printed errors, warnings Uwe Kleine-König
2015-02-05 21:21 ` Uwe Kleine-König [this message]
2015-02-09  7:11 ` [PATCH 0/3] mtd: nand: ONFI probing for x16 devices on i.MX25 (and others) Sascha Hauer

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=1423171292-26728-4-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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