All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Wu <josh.wu@atmel.com>
To: linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, dedekind1@gmail.com
Cc: nicolas.ferre@atmel.com, plagnioj@jcrosoft.com,
	Josh Wu <josh.wu@atmel.com>
Subject: [PATCH 1/5] MTD: atmel_nand: avoid to report an error when lookup table offset is 0.
Date: Wed, 23 Jan 2013 20:47:08 +0800	[thread overview]
Message-ID: <1358945232-2282-2-git-send-email-josh.wu@atmel.com> (raw)
In-Reply-To: <1358945232-2282-1-git-send-email-josh.wu@atmel.com>

Before this patch, we assume the whole ROM code are mapping to memory. So
it is wrong if the lookup table offset is 0.

After this patch, we can map only the lookup table of ROM code to memory
intead of the whole ROM code (about 1M). In this case, one lookup table
offset can be 0.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
 drivers/mtd/nand/atmel_nand.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index c516a94..1d989db 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1215,7 +1215,7 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
 static int atmel_of_init_port(struct atmel_nand_host *host,
 			      struct device_node *np)
 {
-	u32 val, table_offset;
+	u32 val;
 	u32 offset[2];
 	int ecc_mode;
 	struct atmel_nand_data *board = &host->board;
@@ -1288,13 +1288,12 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
 		dev_err(host->dev, "Cannot get PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	table_offset = host->pmecc_sector_size == 512 ? offset[0] : offset[1];
-
-	if (!table_offset) {
+	if (!offset[0] && !offset[1]) {
 		dev_err(host->dev, "Invalid PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	host->pmecc_lookup_table_offset = table_offset;
+	host->pmecc_lookup_table_offset =
+		(host->pmecc_sector_size == 512) ? offset[0] : offset[1];
 
 	return 0;
 }
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
From: josh.wu@atmel.com (Josh Wu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] MTD: atmel_nand: avoid to report an error when lookup table offset is 0.
Date: Wed, 23 Jan 2013 20:47:08 +0800	[thread overview]
Message-ID: <1358945232-2282-2-git-send-email-josh.wu@atmel.com> (raw)
In-Reply-To: <1358945232-2282-1-git-send-email-josh.wu@atmel.com>

Before this patch, we assume the whole ROM code are mapping to memory. So
it is wrong if the lookup table offset is 0.

After this patch, we can map only the lookup table of ROM code to memory
intead of the whole ROM code (about 1M). In this case, one lookup table
offset can be 0.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
 drivers/mtd/nand/atmel_nand.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index c516a94..1d989db 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1215,7 +1215,7 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
 static int atmel_of_init_port(struct atmel_nand_host *host,
 			      struct device_node *np)
 {
-	u32 val, table_offset;
+	u32 val;
 	u32 offset[2];
 	int ecc_mode;
 	struct atmel_nand_data *board = &host->board;
@@ -1288,13 +1288,12 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
 		dev_err(host->dev, "Cannot get PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	table_offset = host->pmecc_sector_size == 512 ? offset[0] : offset[1];
-
-	if (!table_offset) {
+	if (!offset[0] && !offset[1]) {
 		dev_err(host->dev, "Invalid PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	host->pmecc_lookup_table_offset = table_offset;
+	host->pmecc_lookup_table_offset =
+		(host->pmecc_sector_size == 512) ? offset[0] : offset[1];
 
 	return 0;
 }
-- 
1.7.9.5

  reply	other threads:[~2013-01-23 12:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 12:47 [PATCH 0/5 v3] at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek Josh Wu
2013-01-23 12:47 ` Josh Wu
2013-01-23 12:47 ` Josh Wu [this message]
2013-01-23 12:47   ` [PATCH 1/5] MTD: atmel_nand: avoid to report an error when lookup table offset is 0 Josh Wu
2013-01-23 12:47 ` [PATCH 2/5] ARM: at91: at91sam9x5: add DT parameters to enable PMECC Josh Wu
2013-01-23 12:47   ` Josh Wu
2013-01-23 12:47 ` [PATCH 3/5] ARM: at91: at91sam9n12: " Josh Wu
2013-01-23 12:47   ` Josh Wu
2013-01-23 12:47 ` [PATCH 4/5] MTD: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is optional Josh Wu
2013-01-23 12:47   ` Josh Wu
2013-01-23 12:47 ` [PATCH 5/5] MTD: at91: atmel_nand: for PMECC, add code to check the ONFI parameter ECC requirement Josh Wu
2013-01-23 12:47   ` Josh Wu
2013-02-07  3:04 ` [PATCH 0/5 v3] at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek Josh Wu
2013-02-07  3:04   ` Josh Wu
2013-02-07 16:16 ` Nicolas Ferre
2013-02-07 16:16   ` Nicolas Ferre
2013-02-08 16:57   ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-08 16:57     ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-10  0:40   ` Olof Johansson
2013-02-10  0:40     ` Olof Johansson
2013-02-11  3:44     ` Josh Wu
2013-02-11  3:44       ` Josh Wu
2013-02-12 15:01   ` Artem Bityutskiy
2013-02-12 15:01     ` Artem Bityutskiy

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=1358945232-2282-2-git-send-email-josh.wu@atmel.com \
    --to=josh.wu@atmel.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.