Skip to contentSkip to conversation

ARM: don't panic if no flash is there

PATCH New Alessandro Rubini 4 participants 9 messages Apr 17, 2011 – Apr 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

From: Alessandro Rubini <[email protected]>

Commit f1d2b313c9eb6808d30c16a9eb5251240452a56c, which introduced relocation, also added some ifdef to panic for no flash is found but some is expected. This is policy, in my opinion, and should not be part of the boot loader like it wasn't there earlier.

This is mandatory to have the versatile port work on qemu, where flash has never been correctly identified without any side effect on the usefulness of the emulation.

---
 arch/arm/lib/board.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
arch/arm/lib/board.c +0 -7
index dc46e21..bc8b589 100644
@@ -431,10 +431,6 @@ void board_init_f (ulong bootflag)
 	/* NOTREACHED - relocate_code() does not return */
 }
 
-#if !defined(CONFIG_SYS_NO_FLASH)
-static char *failed = "*** failed ***\n";
-#endif
-
 /************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
@@ -501,9 +497,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 # else	/* !CONFIG_SYS_FLASH_CHECKSUM */
 		print_size (flash_size, "\n");
 # endif /* CONFIG_SYS_FLASH_CHECKSUM */
-	} else {
-		puts (failed);
-		hang ();
 	}
 #endif
 
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 2/3 versatile: use boards.confg

From: Alessandro Rubini <[email protected]>

---
 Makefile                                   |    9 ------
 board/armltd/versatile/split_by_variant.sh |   42 ----------------------------
 boards.cfg                                 |    5 ++-
 3 files changed, 4 insertions(+), 52 deletions(-)
 delete mode 100755 board/armltd/versatile/split_by_variant.sh
Makefile +0 -9
index 93c33c7..bbd2e9c 100644
@@ -998,15 +998,6 @@ edb9315a_config: unconfig
 	@$(MKCONFIG) -n $@ -t $(@:_config=) edb93xx arm arm920t edb93xx - ep93xx
 
 #########################################################################
-# ARM supplied Versatile development boards
-#########################################################################
-
-versatile_config	\
-versatileab_config	\
-versatilepb_config :	unconfig
-	@board/armltd/versatile/split_by_variant.sh $@
-
-#########################################################################
 ## XScale Systems
 #########################################################################
 
board/armltd/versatile/split_by_variant.sh deleted +0 -42

42 lines not on this page · raw message

boards.cfg +4 -1
index 80488b8..39a023e 100644
@@ -115,7 +115,10 @@ nhk8815                      arm         arm926ejs   nhk8815             st
 nhk8815_onenand              arm         arm926ejs   nhk8815             st             nomadik       nhk8815:BOOT_ONENAND
 omap5912osk                  arm         arm926ejs   -                   ti             omap
 edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
-dkb			     arm         arm926ejs   -                   Marvell        pantheon
+dkb                          arm         arm926ejs   -                   Marvell        pantheon
+versatile                    arm         arm926ejs   -                   armltd         versatile
+versatileab                  arm         arm926ejs   versatile           armltd         versatile     versatile:ARCH_VERSATILE_AB
+versatilepb                  arm         arm926ejs   versatile           armltd         versatile     versatile:
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
 efikamx                      arm         armv7       efikamx             -              mx5
 mx51evk                      arm         armv7       mx51evk             freescale      mx5
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 3/3 versatile: support relocation

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

---
 board/armltd/versatile/versatile.c |    2 ++
 include/configs/versatile.h        |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
board/armltd/versatile/versatile.c +2 -0
index 6e836dd..deca47f 100644
@@ -88,6 +88,8 @@ int misc_init_r (void)
 ******************************/
 int dram_init (void)
 {
+	gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE,
+				    CONFIG_SYS_SDRAM_SIZE);
 	return 0;
 }
 
include/configs/versatile.h +3 -0
index 45d8434..d883725 100644
@@ -168,6 +168,9 @@
 #define PHYS_SDRAM_1		0x00000000	/* SDRAM Bank #1 */
 #define PHYS_SDRAM_1_SIZE	0x08000000	/* 128 MB */
 #define PHYS_FLASH_SIZE		0x04000000	/* 64MB */
+#define CONFIG_SYS_SDRAM_BASE	0x00000000
+#define CONFIG_SYS_SDRAM_SIZE	PHYS_SDRAM_1_SIZE
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000)
 
 /*-----------------------------------------------------------------------
  * FLASH and environment organization
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

In reply to Alessandro Rubini

Dear Alessandro Rubini,

Quoted 8 lines · In message <7edfdbf8df20140ad93f0a967fc526f8cef5360d.1303028702.git.rubini@gnud…

From: Alessandro Rubini <[email protected]>

Commit f1d2b313c9eb6808d30c16a9eb5251240452a56c, which introduced relocation, also added some ifdef to panic for no flash is found but some is expected. This is policy, in my opinion, and should not be part of the boot loader like it wasn't there earlier.

Quoted 8 lines

This is mandatory to have the versatile port work on qemu, where flash has never been correctly identified without any side effect on the usefulness of the emulation.

---
 arch/arm/lib/board.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

Sorry, but I reject this patch. This is common code that has always been there (at least in the reference implementation on Power; it was a bug that got fixed that this was missing before in ARM).

If you do not have NOR flash, then you should not enable it (and define CONFIG_SYS_NO_FLASH). Otherwise, you are supposed to have flash memory.

If there are problems with the Qemu emulation of NOR flash these should be fixed there.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You see but you do not observe.
Sir Arthur Conan Doyle, in "The Memoirs of Sherlock Holmes"
#4 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

Quoted 1 line

Sorry, but I reject this patch.

Please let me restate the point once more. Maybe i've not been clear.

Quoted 3 lines

If you do not have NOR flash, then you should not enable it (and define CONFIG_SYS_NO_FLASH). Otherwise, you are supposed to have flash memory.

I expect a serious boot loader to work in all possible situations and to be a development tool, the thing that was called a monitor ages ago (why do you have "mw" and "md" otherwise?). I've always loved u-boot usefulness as opposed to the crappy "do nothing at all" wince or freecale boot loaders.

Thus, I see three reasons to revert the older behaviour.

- even if flash got broken over time, the machine should be useable. hang() here gains nothing, as I may still be able to boot though the net and see what happens, without the need to recompile and reflesh a special recovery boot loader

- during initial development it's common to have some parameter misconfigured (and thus see no flash) while still using u-boot to md/mw/whatever and see how's flash really mapepd. It makes no sense to be being forced to flash twice at each development loop (one trying new code and hang() and another to get an interactive session).

- there may be board build both with and without NOR flash. On one side you added relocation to support boards with different memory sizes with a single u-boot binary, on the other you are now forbidding a single binary to work on two similar boards with a different set of peripherals.

This is policy to me, and I see no reason to force policy in a boot loader. I expect only simple and uniform behaviour: do we hang() if no network is found?

Quoted 2 lines

If there are problems with the Qemu emulation of NOR flash these should be fixed there.

Sure, if you want flash. I'm not asking non-compliant code the be added in u-boot to deal with a flaky implementation elsewhere. I'd love a perfectly working, though incomplete, emulation to be supported just like real hardware prototypes with production bugs in the NOR mounting.

Amicalment (even though this message sounds harsh it isn't meant to be) /alessandro

#5 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

Dear Alessandro Rubini,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 4 lines

If you do not have NOR flash, then you should not enable it (and define CONFIG_SYS_NO_FLASH). Otherwise, you are supposed to have flash memory.

I expect a serious boot loader to work in all possible situations and to be a development tool, the thing that was called a monitor ages ago (why do you have "mw" and "md" otherwise?). I've always loved u-boot usefulness as opposed to the crappy "do nothing at all" wince or freecale boot loaders.

You know that all this is just polemics, as in your special case none of your arguments actually applies.

Quoted 1 line

Thus, I see three reasons to revert the older behaviour.

We want to unify the code across architectures. The behavior we have now is what we have in U-Boot (and PPCBoot) since day one, i. e. for well over a decade. The problem was just that some architectures incorrectly implemented this, and such bugs got finally fixed.

Quoted 4 lines

- even if flash got broken over time, the machine should be useable. hang() here gains nothing, as I may still be able to boot though the net and see what happens, without the need to recompile and reflesh a special recovery boot loader

If you have a system with NOR flash, you usually boot from NOR. If NOR is so broken that it fails the detection, you cannot make any assumptions about which code might be running, and which not. You have fully undefined behaviour then. In such a situation it is best to shut the system down and halt in a safe mode, instead of running any random code. Many of these devices actually control hardware, where uncontrolled misfunction might be dangerous.

I'm sorry, but my decision is made.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The number you have dialed is imaginary. Please divide by 0  and  try
again.
#6 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

In reply to Alessandro Rubini

Would it be possible to introduce a QEMU Versatile board in U-Boot derived from the regular Versatile board's config? It would disable the things that aren't (yet) supported in QEMU or too painful to support.

Signature · 1 line
Lo?c Minier
#7 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

Le 18/04/2011 11:40, Lo?c Minier a ?crit :

Quoted 4 lines

Would it be possible to introduce a QEMU Versatile board in U-Boot derived from the regular Versatile board's config? It would disable the things that aren't (yet) supported in QEMU or too painful to support.

Either that or introduce a config option for versatile that will allow the same code to support both the real and the QEMUed version -- although I tend to side with Wolfgang in saying that the interest of QEMU is its ability to emulate systems, so if the real versatile has NOR, it should have it too under QEMU.

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

PATCH 1/3 ARM: don't panic if no flash is there

In reply to Loïc Minier

Dear =?iso-8859-1?Q?Lo=EFc?= Minier,

Quoted 4 lines · In message <[email protected]> you wrote:

Would it be possible to introduce a QEMU Versatile board in U-Boot derived from the regular Versatile board's config? It would disable the things that aren't (yet) supported in QEMU or too painful to support.

Sure. Please feel free to submit a patch.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It became apparent that one reason why the Ice Giants were  known  as
the  Ice  Giants  was  because they were, well, giants. The other was
that they were made of ice.              -Terry Pratchett, _Sourcery_