Re-sending pxa3xx nand controller patches
Subsystems (2)
cover Re-sending pxa3xx nand controller patches
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(-)
Signature · 1 line
1.7.6.4
PATCH 1/4 mtd: pxa3xx_nand: fix a memory leak
From: Axel Lin <[email protected]>
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.
--- drivers/mtd/nand/pxa3xx_nand.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.6.4
PATCH 2/4 mtd: pxa3xx_nand: remove unused variable 'mtd'
In reply to Daniel MackFrom: Axel Lin <[email protected]>
Remove unused variable 'mtd' to eliminate below warning.
CC drivers/mtd/nand/pxa3xx_nand.odrivers/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'
--- drivers/mtd/nand/pxa3xx_nand.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +0 -2
@@ -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);
Signature · 1 line
1.7.6.4
PATCH 3/4 mtd: pxa3xx_nand: fix nand detection issue
In reply to Daniel MackFrom: Lei Wen <[email protected]>
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.
--- drivers/mtd/nand/pxa3xx_nand.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +7 -5
@@ -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 ;
Signature · 1 line
1.7.6.4
PATCH 4/4 mtd: pxa3xx_nand: Fix blank page ECC mismatch
In reply to Daniel MackThis 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.
--- drivers/mtd/nand/pxa3xx_nand.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +2 -0
@@ -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++; }
Signature · 1 line
1.7.6.4
cover Re-sending pxa3xx nand controller patches
In reply to Daniel MackQuoted 4 lines · Daniel Mack
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.