summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/u-boot-1.1.6/cpu')
-rw-r--r--cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/nvram.S2
-rw-r--r--cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/start.S11
-rw-r--r--cleopatre/u-boot-1.1.6/cpu/spc300/nvram.S23
-rw-r--r--cleopatre/u-boot-1.1.6/cpu/spc300/start.S8
4 files changed, 38 insertions, 6 deletions
diff --git a/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/nvram.S b/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/nvram.S
index b18d9d622c..02409b69b9 100644
--- a/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/nvram.S
+++ b/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/nvram.S
@@ -45,11 +45,13 @@
detect_nvram:
ldr r10, =nvram_dft /* if nvram is not found, we will have this value in r10 */
ldr r1, =-1 /* init value for loop counter */
+ ldr r4, =PHYS_FLASH_SPI_1 /* Offset of the SPI Direct access address */
.Lsect:
add r1, r1, #1
cmp r1, #LAST_SECTOR
bge .Lreturn /* we did not found it */
mov r0, r1, lsl #16 /* r0= r1<<16 = r1*0x10000 */
+ add r0, r0, r4 /* Add SPI Direct base address */
ldr r2, [r0, #0] /* load r2 with the first 4 bytes from the sector beginning */
ldr r3, =nvram_magic /* r3 = nvram_magic (previously defined : char *nvram_magic = "NVRAM\0\0\0";) */
ldr r3, [r3, #0] /* r3 <- first 4 bytes of magic word */
diff --git a/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/start.S b/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/start.S
index 7aafa237a2..104202f177 100644
--- a/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/start.S
+++ b/cleopatre/u-boot-1.1.6/cpu/spc300-fcm3/start.S
@@ -257,7 +257,7 @@ wait_mpu_child0:
remap_end:
bl cpu_init_crit
first_init_end:
- /* As we don't call cpu_init_crit we need to find NVRAM address */
+ /* We need to find NVRAM address */
mov ip, lr /* perserve link reg across call */
bl detect_nvram /* r10 will hold the NVRAM address */
mov lr, ip /* restore link */
@@ -266,14 +266,13 @@ first_init_end:
* we do sys-critical inits only at reboot,
* not when booting from ram!
*/
-#ifdef CONFIG_SKIP_LOWLEVEL_INIT
- /* As we don't call cpu_init_crit we need to find NVRAM address */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+ bl cpu_init_crit
+#endif
+ /* We need to find NVRAM address */
mov ip, lr /* perserve link reg across call */
bl detect_nvram /* r10 will hold the NVRAM address */
mov lr, ip /* restore link */
-#else
- bl cpu_init_crit
-#endif
#endif
#ifndef CONFIG_SKIP_RELOCATE_UBOOT
diff --git a/cleopatre/u-boot-1.1.6/cpu/spc300/nvram.S b/cleopatre/u-boot-1.1.6/cpu/spc300/nvram.S
index b18d9d622c..8c5d6a2f6a 100644
--- a/cleopatre/u-boot-1.1.6/cpu/spc300/nvram.S
+++ b/cleopatre/u-boot-1.1.6/cpu/spc300/nvram.S
@@ -33,6 +33,8 @@
.align 2 @ Align to word boundary; "2" means the number of bits that must be zero
.globl detect_nvram
.type detect_nvram, %function
+ .globl check_nvram
+ .type check_nvram, %function
/*
@@ -45,11 +47,13 @@
detect_nvram:
ldr r10, =nvram_dft /* if nvram is not found, we will have this value in r10 */
ldr r1, =-1 /* init value for loop counter */
+ ldr r4, =PHYS_FLASH_SPI_1 /* Offset of the SPI Direct access address */
.Lsect:
add r1, r1, #1
cmp r1, #LAST_SECTOR
bge .Lreturn /* we did not found it */
mov r0, r1, lsl #16 /* r0= r1<<16 = r1*0x10000 */
+ add r0, r0, r4 /* Add SPI Direct base address */
ldr r2, [r0, #0] /* load r2 with the first 4 bytes from the sector beginning */
ldr r3, =nvram_magic /* r3 = nvram_magic (previously defined : char *nvram_magic = "NVRAM\0\0\0";) */
ldr r3, [r3, #0] /* r3 <- first 4 bytes of magic word */
@@ -73,6 +77,25 @@ detect_nvram:
/*
*************************************************************************
*
+ * NVRAM check if address is in SPI area
+ *
+ *************************************************************************
+ */
+check_nvram:
+ mov r0, #-1
+ mov r2, r10
+ ldr r3, =0xFF000000
+ and r2, r10, r3 /* load Mapping area of NVRAM address */
+ ldr r3, =PHYS_FLASH_SPI_1
+ cmp r2, r3 /* check is NVRAM is in SPI area */
+ bne .Lwrongnvram /* no : return -1 under r0 */
+ mov r0, #0 /* yes: return 0 under r0 */
+.Lwrongnvram:
+ mov pc, lr /* back to my caller */
+
+/*
+ *************************************************************************
+ *
* NVRAM default values
*
*************************************************************************
diff --git a/cleopatre/u-boot-1.1.6/cpu/spc300/start.S b/cleopatre/u-boot-1.1.6/cpu/spc300/start.S
index 23a600532f..15d2826953 100644
--- a/cleopatre/u-boot-1.1.6/cpu/spc300/start.S
+++ b/cleopatre/u-boot-1.1.6/cpu/spc300/start.S
@@ -253,6 +253,13 @@ in_sdram:
ldr r1, =0x00000001
str r1, [r0, #RB_BUS_SYS_REMAPPED]
+ /*
+ * Check if a correct NVRAM was found
+ * NVRAM address was under r10
+ */
+ bl check_nvram /* we pass NVRAM addr in r10 and wait result under r0 */
+ cmp r0, #0
+ bne bl_no_nvram
/*
* Configure GPIOs and PIO
@@ -276,6 +283,7 @@ in_sdram:
bic r1, r1, #RST_INTF /* clear bit 1 of RB_RST_GROUP, sw_rst_intf -> 0 */
str r1, [r0, #RB_RST_GROUP]
+bl_no_nvram:
/* EXT reset */
ldr r0, =REGBANK_BASE
ldr r1, [r0, #RB_RST_MODULE]