diff mbox series

[01/11] spl: fit: nand: skip bad block handling if NAND chip not fully defined

Message ID 20210301223337.7763-2-tharvey@gateworks.com
State Accepted
Commit 39cb85043cdbc98d10b49f0b86596043d5f8e3f8
Delegated to: Stefano Babic
Headers show
Series imx: ventana: convert Gateworks Ventana to dm | expand

Commit Message

Tim Harvey March 1, 2021, 10:33 p.m. UTC
commit 9f6a14c47ff9 ("spl: fit: nand: fix fit loading in case of bad blocks")
added support for adjusting the image offset to account for bad blocks.
However this requires nand_spl_adjust_offset() which requires fully defined
specifics of the NAND chip being used may not be avialable.

Allow skipping this support for drivers or configs which don't specify
the NAND chip details statically with defines.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 common/spl/spl_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tom Rini March 2, 2021, 1:28 p.m. UTC | #1
On Mon, Mar 01, 2021 at 02:33:27PM -0800, Tim Harvey wrote:

> commit 9f6a14c47ff9 ("spl: fit: nand: fix fit loading in case of bad blocks")
> added support for adjusting the image offset to account for bad blocks.
> However this requires nand_spl_adjust_offset() which requires fully defined
> specifics of the NAND chip being used may not be avialable.
> 
> Allow skipping this support for drivers or configs which don't specify
> the NAND chip details statically with defines.
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Stefano Babic April 8, 2021, 8:57 p.m. UTC | #2
> commit 9f6a14c47ff9 ("spl: fit: nand: fix fit loading in case of bad blocks")
> added support for adjusting the image offset to account for bad blocks.
> However this requires nand_spl_adjust_offset() which requires fully defined
> specifics of the NAND chip being used may not be avialable.
> Allow skipping this support for drivers or configs which don't specify
> the NAND chip details statically with defines.
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index d13a524597..8213836df4 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -42,11 +42,13 @@  static int spl_nand_load_image(struct spl_image_info *spl_image,
 static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
 			       ulong size, void *dst)
 {
-	ulong sector;
 	int err;
+#ifdef CONFIG_SYS_NAND_BLOCK_SIZE
+	ulong sector;
 
 	sector = *(int *)load->priv;
 	offs = sector + nand_spl_adjust_offset(sector, offs - sector);
+#endif
 	err = nand_spl_load_image(offs, size, dst);
 	if (err)
 		return 0;