Skip to contentSkip to conversation

nand: fix up badblock skipping

PATCH Superseded Jiri Valek 3 participants 4 messages Oct 19, 2018 – Feb 5, 2019

Subsystems (3)
lore
Share & tools
lore

Jiri Valek

author
#0 lore raw

PATCH 1/1 nand: fix up badblock skipping

From: Jiri Valek <[email protected]>

Currently the badblock skipping fails. SPL loader fails to boot from NAND. End up on message "SPL: failed to boot from all boot devices"

---

 drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
index 2d7bbe83cc..56618c95dc 100644
@@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
 			 */
 			while (is_badblock(mtd, offs, 1)) {
 				page = page + nand_page_per_block;
+				offs = offs + mtd.erasesize;
 				/* Check i we've reached the end of flash. */
 				if (page >= mtd->size >> chip->page_shift)
 					return -ENOMEM;
Signature · 1 line
2.11.0
maintainer
#1 lore raw

PATCH 1/1 nand: fix up badblock skipping

Hi Jiri,

Jiri Valek <[email protected]> wrote on Fri, 19 Oct 2018 10:15:55 +0200:

Quoted 16 lines

From: Jiri Valek <[email protected]>

Currently the badblock skipping fails. SPL loader fails to boot from NAND. End up on message "SPL: failed to boot from all boot devices"

---

 drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/mxs_nand_spl.c +0 -0
index 2d7bbe83cc..56618c95dc 100644

drivers/mtd/nand/raw/mxs_nand_spl.c int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf) · line 245

Quoted 7 lines
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
@@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
 			 */
 			while (is_badblock(mtd, offs, 1)) {
 				page = page + nand_page_per_block;
+				offs = offs + mtd.erasesize;
 				/* Check i we've reached the end of flash. */
 				if (page >= mtd->size >> chip->page_shift)
 					return -ENOMEM;

Thanks,
Miquèl

#2 lore raw

PATCH 1/1 nand: fix up badblock skipping

Hi Jiri, Miquel,

Quoted 16 lines · Miquel Raynal

Hi Jiri,

Jiri Valek <[email protected]> wrote on Fri, 19 Oct 2018 10:15:55 +0200:

Quoted 11 lines

From: Jiri Valek <[email protected]>

Currently the badblock skipping fails. SPL loader fails to boot from NAND. End up on message "SPL: failed to boot from all boot devices"

---

 drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines

drivers/mtd/nand/raw/mxs_nand_spl.c int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf) · line 245

Quoted 12 lines
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
index 2d7bbe83cc..56618c95dc 100644
@@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
 			 */
 			while (is_badblock(mtd, offs, 1)) {
 				page = page + nand_page_per_block;
+				offs = offs + mtd.erasesize;
 				/* Check i we've reached the end of flash. */
 				if (page >= mtd->size >> chip->page_shift)
 					return -ENOMEM;

I agree that secto must be skipped, but implementation looks wrong. mtd is a pointer, and the above line should be off + mtd->erasesize. Do you build with it ? I tried to apply it, as expected it cannot be compiled clean.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#3 lore raw

PATCH v2 1/1 nand: fix up badblock skipping

Hi all,
yes you are right. I had checked out older version of u-boot. off + mtd->erasesize
this is OK. I`m sending patch v2.

Quoted 35 lines · Stefano Babic

Hi Jiri, Miquel,

Quoted 16 lines · Miquel Raynal

Hi Jiri,

Jiri Valek <[email protected]> wrote on Fri, 19 Oct 2018 10:15:55 +0200:

Quoted 11 lines

From: Jiri Valek <[email protected]>

Currently the badblock skipping fails. SPL loader fails to boot from NAND. End up on message "SPL: failed to boot from all boot devices"

---

  drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 15 lines

drivers/mtd/nand/raw/mxs_nand_spl.c int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf) · line 245

Quoted 12 lines
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
index 2d7bbe83cc..56618c95dc 100644
@@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
  			 */
  			while (is_badblock(mtd, offs, 1)) {
  				page = page + nand_page_per_block;
+				offs = offs + mtd.erasesize;
  				/* Check i we've reached the end of flash. */
  				if (page >= mtd->size >> chip->page_shift)
  					return -ENOMEM;
Quoted 8 lines

I agree that secto must be skipped, but implementation looks wrong. mtd is a pointer, and the above line should be off + mtd->erasesize. Do you build with it ? I tried to apply it, as expected it cannot be compiled clean.

Best regards,
Stefano Babic

---
Changes for v2:
- Repaired "mtd" to struct pinter

  drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
  1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/mtd/nand/raw/mxs_nand_spl.c
index c628f3adec..ddaaba87a3 100644

drivers/mtd/nand/raw/mxs_nand_spl.c +0 -0
@@ -240,6 +240,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int 

size, void *buf)
*/
while (is_badblock(mtd, offs, 1)) {
page = page + nand_page_per_block;
+ offs = offs + mtd->erasesize;
/* Check i we've reached the end of flash. */ if (page >= mtd->size >> chip->page_shift)
return -ENOMEM;

Signature · 1 line
2.11.0