linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Re-sending pxa3xx nand controller patches
@ 2011-11-07 15:43 Daniel Mack
  2011-11-07 15:43 ` [PATCH 1/4] mtd: pxa3xx_nand: fix a memory leak Daniel Mack
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel Mack @ 2011-11-07 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

These four patches have been discussed in June this year and at least
two of them are mandatory for the pxa3xx driver to operate. I'm not 
aware of any reason why they didn't make it to any repository, but
most probably they were just forgotten.

Axel Lin (2):
  mtd: pxa3xx_nand: fix a memory leak
  mtd: pxa3xx_nand: remove unused variable 'mtd'

Daniel Mack (1):
  mtd: pxa3xx_nand: Fix blank page ECC mismatch

Lei Wen (1):
  mtd: pxa3xx_nand: fix nand detection issue

 drivers/mtd/nand/pxa3xx_nand.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

-- 
1.7.6.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] mtd: pxa3xx_nand: fix a memory leak
  2011-11-07 15:43 [PATCH 0/4] Re-sending pxa3xx nand controller patches Daniel Mack
@ 2011-11-07 15:43 ` Daniel Mack
  2011-11-07 15:43 ` [PATCH 2/4] mtd: pxa3xx_nand: remove unused variable 'mtd' Daniel Mack
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-11-07 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Axel Lin <axel.lin@gmail.com>

In pxa3xx_nand_remove, we should call nand_release instead of
mtd_device_unregister to properly free bad block table memory
and bad block descriptor memory.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Lei Wen <leiwen@marvell.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 1fb3b3a..f7040ea 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1119,7 +1119,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
 	clk_put(info->clk);
 
 	if (mtd) {
-		mtd_device_unregister(mtd);
+		nand_release(mtd);
 		kfree(mtd);
 	}
 	return 0;
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] mtd: pxa3xx_nand: remove unused variable 'mtd'
  2011-11-07 15:43 [PATCH 0/4] Re-sending pxa3xx nand controller patches Daniel Mack
  2011-11-07 15:43 ` [PATCH 1/4] mtd: pxa3xx_nand: fix a memory leak Daniel Mack
@ 2011-11-07 15:43 ` Daniel Mack
  2011-11-07 15:43 ` [PATCH 3/4] mtd: pxa3xx_nand: fix nand detection issue Daniel Mack
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-11-07 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Axel Lin <axel.lin@gmail.com>

Remove unused variable 'mtd' to eliminate below warning.

  CC      drivers/mtd/nand/pxa3xx_nand.o
drivers/mtd/nand/pxa3xx_nand.c: In function 'pxa3xx_nand_suspend':
drivers/mtd/nand/pxa3xx_nand.c:1167: warning: unused variable 'mtd'
drivers/mtd/nand/pxa3xx_nand.c: In function 'pxa3xx_nand_resume':
drivers/mtd/nand/pxa3xx_nand.c:1180: warning: unused variable 'mtd'

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index f7040ea..e11f926 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1164,7 +1164,6 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
 static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state)
 {
 	struct pxa3xx_nand_info *info = platform_get_drvdata(pdev);
-	struct mtd_info *mtd = info->mtd;
 
 	if (info->state) {
 		dev_err(&pdev->dev, "driver busy, state = %d\n", info->state);
@@ -1177,7 +1176,6 @@ static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state)
 static int pxa3xx_nand_resume(struct platform_device *pdev)
 {
 	struct pxa3xx_nand_info *info = platform_get_drvdata(pdev);
-	struct mtd_info *mtd = info->mtd;
 
 	nand_writel(info, NDTR0CS0, info->ndtr0cs0);
 	nand_writel(info, NDTR1CS0, info->ndtr1cs0);
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] mtd: pxa3xx_nand: fix nand detection issue
  2011-11-07 15:43 [PATCH 0/4] Re-sending pxa3xx nand controller patches Daniel Mack
  2011-11-07 15:43 ` [PATCH 1/4] mtd: pxa3xx_nand: fix a memory leak Daniel Mack
  2011-11-07 15:43 ` [PATCH 2/4] mtd: pxa3xx_nand: remove unused variable 'mtd' Daniel Mack
@ 2011-11-07 15:43 ` Daniel Mack
  2011-11-07 15:43 ` [PATCH 4/4] mtd: pxa3xx_nand: Fix blank page ECC mismatch Daniel Mack
  2011-11-17 21:15 ` [PATCH 0/4] Re-sending pxa3xx nand controller patches Artem Bityutskiy
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-11-07 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Lei Wen <leiwen@marvell.com>

When keep_config is set, the detection would goes different routine.
That the driver would read out the setting which is set previously
by bootloader. While most bootloader keep the irq mask as off, and
current driver need all irq default open, keep_config behavior would
lead to no irq at all.

Signed-off-by: Lei Wen <leiwen@marvell.com>
Tested-by: Daniel Mack <zonque@gmail.com>
Cc: stable at kernel.org [2.6.38+]
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index e11f926..f08fae9 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -813,7 +813,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info)
 	info->page_size = ndcr & NDCR_PAGE_SZ ? 2048 : 512;
 	/* set info fields needed to read id */
 	info->read_id_bytes = (info->page_size == 2048) ? 4 : 2;
-	info->reg_ndcr = ndcr;
+	info->reg_ndcr = ndcr & ~NDCR_INT_MASK;
 	info->cmdset = &default_cmdset;
 
 	info->ndtr0cs0 = nand_readl(info, NDTR0CS0);
@@ -882,7 +882,7 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
 	struct pxa3xx_nand_info *info = mtd->priv;
 	struct platform_device *pdev = info->pdev;
 	struct pxa3xx_nand_platform_data *pdata = pdev->dev.platform_data;
-	struct nand_flash_dev pxa3xx_flash_ids[2] = { {NULL,}, {NULL,} };
+	struct nand_flash_dev pxa3xx_flash_ids[2], *def = NULL;
 	const struct pxa3xx_nand_flash *f = NULL;
 	struct nand_chip *chip = mtd->priv;
 	uint32_t id = -1;
@@ -942,8 +942,10 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
 	pxa3xx_flash_ids[0].erasesize = f->page_size * f->page_per_block;
 	if (f->flash_width == 16)
 		pxa3xx_flash_ids[0].options = NAND_BUSWIDTH_16;
+	pxa3xx_flash_ids[1].name = NULL;
+	def = pxa3xx_flash_ids;
 KEEP_CONFIG:
-	if (nand_scan_ident(mtd, 1, pxa3xx_flash_ids))
+	if (nand_scan_ident(mtd, 1, def))
 		return -ENODEV;
 	/* calculate addressing information */
 	info->col_addr_cycles = (mtd->writesize >= 2048) ? 2 : 1;
@@ -954,9 +956,9 @@ KEEP_CONFIG:
 		info->row_addr_cycles = 2;
 	mtd->name = mtd_names[0];
 	chip->ecc.mode = NAND_ECC_HW;
-	chip->ecc.size = f->page_size;
+	chip->ecc.size = info->page_size;
 
-	chip->options = (f->flash_width == 16) ? NAND_BUSWIDTH_16 : 0;
+	chip->options = (info->reg_ndcr & NDCR_DWIDTH_M) ? NAND_BUSWIDTH_16 : 0;
 	chip->options |= NAND_NO_AUTOINCR;
 	chip->options |= NAND_NO_READRDY;
 
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] mtd: pxa3xx_nand: Fix blank page ECC mismatch
  2011-11-07 15:43 [PATCH 0/4] Re-sending pxa3xx nand controller patches Daniel Mack
                   ` (2 preceding siblings ...)
  2011-11-07 15:43 ` [PATCH 3/4] mtd: pxa3xx_nand: fix nand detection issue Daniel Mack
@ 2011-11-07 15:43 ` Daniel Mack
  2011-11-17 21:15 ` [PATCH 0/4] Re-sending pxa3xx nand controller patches Artem Bityutskiy
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-11-07 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

This bug was introduced in f8155a40 ("mtd: pxa3xx_nand: rework irq
logic") and causes the PXA3xx NAND controller fail to operate with NAND
flash that has empty pages. According to the comment in this block, the
hardware controller will report a double-bit error for empty pages,
which can and must be ignored.

This patch restores the original behaviour of the driver.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Lei Wen <leiwen@marvell.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: stable at kernel.org [2.6.38+]
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index f08fae9..063cb19 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -685,6 +685,8 @@ static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd,
 		 * OOB, ignore such double bit errors
 		 */
 		if (is_buf_blank(buf, mtd->writesize))
+			info->retcode = ERR_NONE;
+		else
 			mtd->ecc_stats.failed++;
 	}
 
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/4] Re-sending pxa3xx nand controller patches
  2011-11-07 15:43 [PATCH 0/4] Re-sending pxa3xx nand controller patches Daniel Mack
                   ` (3 preceding siblings ...)
  2011-11-07 15:43 ` [PATCH 4/4] mtd: pxa3xx_nand: Fix blank page ECC mismatch Daniel Mack
@ 2011-11-17 21:15 ` Artem Bityutskiy
  4 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2011-11-17 21:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-11-07 at 16:43 +0100, Daniel Mack wrote:
> These four patches have been discussed in June this year and at least
> two of them are mandatory for the pxa3xx driver to operate. I'm not 
> aware of any reason why they didn't make it to any repository, but
> most probably they were just forgotten.

These are in upstream already. Didn't I send a reply that I took them to
l2-mtd-2.6.git tree?

Artem.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-17 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07 15:43 [PATCH 0/4] Re-sending pxa3xx nand controller patches Daniel Mack
2011-11-07 15:43 ` [PATCH 1/4] mtd: pxa3xx_nand: fix a memory leak Daniel Mack
2011-11-07 15:43 ` [PATCH 2/4] mtd: pxa3xx_nand: remove unused variable 'mtd' Daniel Mack
2011-11-07 15:43 ` [PATCH 3/4] mtd: pxa3xx_nand: fix nand detection issue Daniel Mack
2011-11-07 15:43 ` [PATCH 4/4] mtd: pxa3xx_nand: Fix blank page ECC mismatch Daniel Mack
2011-11-17 21:15 ` [PATCH 0/4] Re-sending pxa3xx nand controller patches Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).