Skip to contentSkip to conversation

flash: do not fail even if flash_size is zero

PATCH New Masahiro Yamada 2 participants 5 messages Dec 5, 2014 – Dec 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flash: do not fail even if flash_size is zero

CONFIG_SYS_MAX_FLASH_BANKS_DETECT allows to determine the number of flash banks at run-time, that is, there is a possibility that no flash bank is found. It makes sense to continue the boot process without any flash device.

---

 common/board_r.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
common/board_r.c +3 -15
index 1b8998d..6e59712 100644
@@ -291,26 +291,14 @@ static int initr_flash(void)
 {
 	ulong flash_size = 0;
 	bd_t *bd = gd->bd;
-	int ok;
 
 	puts("Flash: ");
 
-	if (board_flash_wp_on()) {
+	if (board_flash_wp_on())
 		printf("Uninitialized - Write Protect On\n");
-		/* Since WP is on, we can't find real size.  Set to 0 */
-		ok = 1;
-	} else {
+	else
 		flash_size = flash_init();
-		ok = flash_size > 0;
-	}
-	if (!ok) {
-		puts("*** failed ***\n");
-#ifdef CONFIG_PPC
-		/* Why does PPC do this? */
-		hang();
-#endif
-		return -1;
-	}
+
 	print_size(flash_size, "");
 #ifdef CONFIG_SYS_FLASH_CHECKSUM
 	/*
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 flash: do not fail even if flash_size is zero

Quoted 7 lines · Masahiro Yamada

CONFIG_SYS_MAX_FLASH_BANKS_DETECT allows to determine the number of flash banks at run-time, that is, there is a possibility that no flash bank is found. It makes sense to continue the boot process without any flash device.

I also think its better to continue to boot in this case. So:

Thanks,
Stefan

#2 lore raw

PATCH 1/1 flash: do not fail even if flash_size is zero

Hi Stefan,

Thanks for your quick review.

I want to use this patch to clean up my board support code. ( I want to enable CONFIG_SYS_MAX_FLASH_BANKS_DETECT on my boards
but in some use cases, there is a possibility that no flash is found.)

CFI-flash patches are generally supposed to be applied by you, but if you do not mind, can I apply this patch with your Acked-by credit as a prerequisite for my series?

Quoted 9 lines · On Fri, 05 Dec 2014 07:54:53 +0100 Stefan Roese <[email protected]> wrote:
Quoted 7 lines · Masahiro Yamada

CONFIG_SYS_MAX_FLASH_BANKS_DETECT allows to determine the number of flash banks at run-time, that is, there is a possibility that no flash bank is found. It makes sense to continue the boot process without any flash device.

Quoted 6 lines

I also think its better to continue to boot in this case. So:

Thanks,
Stefan

Best Regards
Masahiro Yamada

#3 lore raw

PATCH 1/1 flash: do not fail even if flash_size is zero

Hi Masahiro-san,

Quoted 6 lines · Masahiro Yamada

I want to use this patch to clean up my board support code. ( I want to enable CONFIG_SYS_MAX_FLASH_BANKS_DETECT on my boards
but in some use cases, there is a possibility that no flash is found.)

CFI-flash patches are generally supposed to be applied by you, but if you do not mind, can I apply this patch with your Acked-by credit as a prerequisite for my series?

Sure. Please go ahead.

Thanks,
Stefan

#4 lore raw

PATCH 1/1 flash: do not fail even if flash_size is zero

In reply to Masahiro Yamada

2014-12-05 12:20 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 7 lines

CONFIG_SYS_MAX_FLASH_BANKS_DETECT allows to determine the number of flash banks at run-time, that is, there is a possibility that no flash bank is found. It makes sense to continue the boot process without any flash device.

Applied to u-boot-uniphier/master.

Signature · 2 lines
Best Regards
Masahiro Yamada