Skip to contentSkip to conversation

integrator: make flash writeable on boot

PATCH Superseded Linus Walleij 4 participants 7 messages Sep 18, 2011 – Sep 19, 2011

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 integrator: make flash writeable on boot

This reconfigures the EBI (External Bus Interface) on the integrator so that chip select 1, handling the flash memory, is set to writeable. Without this it is not possible for U-Boot to access flash memory and it crashes on startup since CFI won't work properly.

Since this is the first time we use the EBI, we create a header file for its registers.

---
 board/armltd/integrator/integrator.c |   15 ++++++++
 include/arm-ebi.h                    |   62 ++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 include/arm-ebi.h
board/armltd/integrator/integrator.c +15 -0
index 780218c..44e69f1 100644
@@ -35,6 +35,7 @@
 
 #include <common.h>
 #include <netdev.h>
+#include <arm-ebi.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -56,6 +57,8 @@ void show_boot_progress(int progress)
 
 int board_init (void)
 {
+	u32 val;
+
 	/* arch number of Integrator Board */
 #ifdef CONFIG_ARCH_CINTEGRATOR
 	gd->bd->bi_arch_number = MACH_TYPE_CINTEGRATOR;
@@ -73,6 +76,18 @@ extern void cm_remap(void);
 	cm_remap();	/* remaps writeable memory to 0x00000000 */
 #endif
 
+	/*
+	 * The system comes up with the flash memory non-writable and
+	 * configuration locked. If we want U-Boot to be used for flash
+	 * access we cannot have the flash memory locked.
+	 */
+	writel(EBI_UNLOCK_MAGIC, EBI_BASE + EBI_LOCK_REG);
+	val = readl(EBI_BASE + EBI_CSR1_REG);
+	val &= EBI_CSR_WREN_MASK;
+	val |= EBI_CSR_WREN_ENABLE;
+	writel(val, EBI_BASE + EBI_CSR1_REG);
+	writel(0, EBI_BASE + EBI_LOCK_REG);
+
 	icache_enable ();
 
 	return 0;
include/arm-ebi.h new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.6
#1 lore raw

PATCH 5/5 integrator: make flash writeable on boot

Quoted 5 lines · On Sunday, September 18, 2011 03:52:58 Linus Walleij wrote:
 board/armltd/integrator/integrator.c |   15 ++++++++
 include/arm-ebi.h                    |   62
++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 0
deletions(-)
 create mode 100644 include/arm-ebi.h

if the integrator board is the only one that cares about this header, then it's probably best to keep it in the board-specific dir rather than include/ -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110918/06b14f7e/attachment.pgp

#2 lore raw

PATCH 5/5 integrator: make flash writeable on boot

Quoted 9 lines · Mike Frysinger
Quoted 5 lines · On Sunday, September 18, 2011 03:52:58 Linus Walleij wrote:

?board/armltd/integrator/integrator.c | ? 15 ++++++++ ?include/arm-ebi.h ? ? ? ? ? ? ? ? ? ?| ? 62 ++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 0 deletions(-)
?create mode 100644 include/arm-ebi.h

if the integrator board is the only one that cares about this header, then it's probably best to keep it in the board-specific dir rather than include/

Yes why not. I'll move it to the board dir, it indeed seems to be a board pecularity.

Thanks,
Linus Walleij

#3 lore raw

PATCH 5/5 integrator: make flash writeable on boot

In reply to Linus Walleij

Hi Linus,

Le 18/09/2011 09:52, Linus Walleij a ?crit :

Quoted 5 lines

This reconfigures the EBI (External Bus Interface) on the integrator so that chip select 1, handling the flash memory, is set to writeable. Without this it is not possible for U-Boot to access flash memory and it crashes on startup since CFI won't work properly.

Do you mean that U-Boot writes to the flash at each boot on this board?

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 5/5 integrator: make flash writeable on boot

Dear Albert ARIBAUD,

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

Le 18/09/2011 09:52, Linus Walleij a =E9crit :

Quoted 5 lines

This reconfigures the EBI (External Bus Interface) on the integrator so that chip select 1, handling the flash memory, is set to writeable. Without this it is not possible for U-Boot to access flash memory and it crashes on startup since CFI won't work properly.

Do you mean that U-Boot writes to the flash at each boot on this board?

I think this is a misunderstanding of terms. When we try to identify the flash type and geomentry in the CFI driver, we do send certain commands to the flash, and read the returned data. This "sending commands" includes write cycles to the flash address space, so it is necessary that the memory controller setup allows write cycles on the bus.

This does however NOT mean that any data are programmed into the flash.

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
Anarchy may not be the best form of government, but it's better  than
no government at all.
#5 lore raw

PATCH 5/5 integrator: make flash writeable on boot

Le 18/09/2011 15:24, Wolfgang Denk a ?crit :

Quoted 20 lines

Dear Albert ARIBAUD,

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

Le 18/09/2011 09:52, Linus Walleij a =E9crit :

Quoted 5 lines

This reconfigures the EBI (External Bus Interface) on the integrator so that chip select 1, handling the flash memory, is set to writeable. Without this it is not possible for U-Boot to access flash memory and it crashes on startup since CFI won't work properly.

Do you mean that U-Boot writes to the flash at each boot on this board?

I think this is a misunderstanding of terms. When we try to identify the flash type and geomentry in the CFI driver, we do send certain commands to the flash, and read the returned data. This "sending commands" includes write cycles to the flash address space, so it is necessary that the memory controller setup allows write cycles on the bus.

Quoted 2 lines

This does however NOT mean that any data are programmed into the flash.

Indeed, I had misunderstood the commit message. Apologies.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH 5/5 integrator: make flash writeable on boot

In reply to Wolfgang Denk
Quoted 6 lines · Wolfgang Denk

I think this is a misunderstanding of terms. ?When we try to identify the flash type and geomentry in the CFI driver, we do send certain commands to the flash, and read the returned data. ?This "sending commands" includes write cycles to the flash address space, so it is necessary that the memory controller setup allows write cycles on the bus.

Yes that is exactly what happens. The integrator has some gate to disallow any write cycles to CFI unless it's unlocked through the EBI.

Yours,
Linus Walleij