diff mbox

[U-Boot] flash: do not fail even if flash_size is zero

Message ID 1417749658-22827-1-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Masahiro Yamada
Headers show

Commit Message

Masahiro Yamada Dec. 5, 2014, 3:20 a.m. UTC
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.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Stefan Roese <sr@denx.de>
---

 common/board_r.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

Comments

Stefan Roese Dec. 5, 2014, 6:54 a.m. UTC | #1
On 05.12.2014 04:20, Masahiro Yamada wrote:
> 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.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Stefan Roese <sr@denx.de>

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

Acked-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Masahiro Yamada Dec. 5, 2014, 8:40 a.m. UTC | #2
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?




On Fri, 05 Dec 2014 07:54:53 +0100
Stefan Roese <sr@denx.de> wrote:

> On 05.12.2014 04:20, Masahiro Yamada wrote:
> > 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.
> >
> > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> > Cc: Stefan Roese <sr@denx.de>
> 
> I also think its better to continue to boot in this case. So:
> 
> Acked-by: Stefan Roese <sr@denx.de>
> 
> Thanks,
> Stefan


Best Regards
Masahiro Yamada
Stefan Roese Dec. 5, 2014, 8:43 a.m. UTC | #3
Hi Masahiro-san,

On 05.12.2014 09:40, Masahiro Yamada wrote:
> 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
Masahiro Yamada Dec. 7, 2014, 4:47 p.m. UTC | #4
2014-12-05 12:20 GMT+09:00 Masahiro Yamada <yamada.m@jp.panasonic.com>:
> 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.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Stefan Roese <sr@denx.de>

Applied to u-boot-uniphier/master.
diff mbox

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 1b8998d..6e59712 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -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
 	/*