Skip to contentSkip to conversation

orion5x: fix relocation-incompatible code

PATCH Superseded Albert Aribaud 3 participants 7 messages Sep 21, 2010 – Sep 23, 2010 Arm (32-bit)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 orion5x: fix relocation-incompatible code

---
Device address window mapping code would not run from FLASH due to cutting access to BOOTCS. Fixed by reordering code.

Timer initialization would write globals, thus would not run correctly from FLASH. Fixed by moving the writes to a later phase in RAM.

 arch/arm/cpu/arm926ejs/orion5x/cpu.c    |   80 +++++++++++++++++++------------
 arch/arm/cpu/arm926ejs/orion5x/timer.c  |    8 ++-
 arch/arm/include/asm/arch-orion5x/cpu.h |    1 +
 3 files changed, 56 insertions(+), 33 deletions(-)
arch/arm/cpu/arm926ejs/orion5x/cpu.c +50 -30
index 260f88b..5cffa86 100644
@@ -77,6 +77,17 @@ unsigned int orion5x_winctrl_calcsize(unsigned int sizeval)
  *
  * If remap function not used, remap_lo must be set as base
  *
+ * NOTES:
+ *
+ * 1) in order to avoid windows with inconsistent control and base values
+ *    (which could prevent access to BOOTCS and hence execution from FLASH)
+ *    always disable window before writing the base value then reenable it
+ *    by writing the control value.
+ * 
+ * 2) in order to avoid losing access to BOOTCS when disabling window 7,
+ *    first configure window 6 for BOOTCS, then configure window 7 for BOOTCS,
+ *    then configure windows 0 to 6 for their own target.
+ *
  * Reference Documentation:
  * Mbus-L to Mbus Bridge Registers Configuration.
  * (Sec 25.1 and 25.3 of Datasheet)
@@ -86,57 +97,64 @@ int orion5x_config_adr_windows(void)
 	struct orion5x_win_registers *winregs =
 		(struct orion5x_win_registers *)ORION5X_CPU_WIN_BASE;
 
-	/* Window 0: PCIE MEM address space */
+/* Disable window 6, configure it for FLASH, enable it. */
+	writel(0, &winregs[6].ctrl);
+	writel(ORION5X_ADR_BOOTROM, &winregs[6].base);
+	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
+		ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
+		ORION5X_WIN_ENABLE), &winregs[6].ctrl);
+/* Disable window 7, configure it for FLASH, enable it. */
+	writel(0, &winregs[7].ctrl);
+	writel(ORION5X_ADR_BOOTROM, &winregs[7].base);
+	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
+		ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
+		ORION5X_WIN_ENABLE), &winregs[7].ctrl);
+/* Disable window 0, configure it for its intended target, enable it. */
+	writel(0, &winregs[0].ctrl);
+ 	writel(ORION5X_ADR_PCIE_MEM, &winregs[0].base);
+	writel(ORION5X_ADR_PCIE_MEM_REMAP_LO, &winregs[0].remap_lo);
+	writel(ORION5X_ADR_PCIE_MEM_REMAP_HI, &winregs[0].remap_hi);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCIE_MEM,
 		ORION5X_TARGET_PCIE, ORION5X_ATTR_PCIE_MEM,
 		ORION5X_WIN_ENABLE), &winregs[0].ctrl);
-	writel(ORION5X_ADR_PCIE_MEM, &winregs[0].base);
-	writel(ORION5X_ADR_PCIE_MEM_REMAP_LO, &winregs[0].remap_lo);
-	writel(ORION5X_ADR_PCIE_MEM_REMAP_HI, &winregs[0].remap_hi);
-
-	/* Window 1: PCIE IO address space */
-	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCIE_IO,
-		ORION5X_TARGET_PCIE, ORION5X_ATTR_PCIE_IO,
-		ORION5X_WIN_ENABLE), &winregs[1].ctrl);
+/* Disable window 1, configure it for its intended target, enable it. */
+	writel(0, &winregs[1].ctrl);
 	writel(ORION5X_ADR_PCIE_IO, &winregs[1].base);
 	writel(ORION5X_ADR_PCIE_IO_REMAP_LO, &winregs[1].remap_lo);
 	writel(ORION5X_ADR_PCIE_IO_REMAP_HI, &winregs[1].remap_hi);
-
-	/* Window 2: PCI MEM address space */
+	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCIE_IO,
+		ORION5X_TARGET_PCIE, ORION5X_ATTR_PCIE_IO,
+		ORION5X_WIN_ENABLE), &winregs[1].ctrl);
+/* Disable window 2, configure it for its intended target, enable it. */
+	writel(0, &winregs[2].ctrl);
+	writel(ORION5X_ADR_PCI_MEM, &winregs[2].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCI_MEM,
 		ORION5X_TARGET_PCI, ORION5X_ATTR_PCI_MEM,
 		ORION5X_WIN_ENABLE), &winregs[2].ctrl);
-	writel(ORION5X_ADR_PCI_MEM, &winregs[2].base);
-
-	/* Window 3: PCI IO address space */
+/* Disable window 3, configure it for its intended target, enable it. */
+	writel(0, &winregs[3].ctrl);
+	writel(ORION5X_ADR_PCI_IO, &winregs[3].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCI_IO,
 		ORION5X_TARGET_PCI, ORION5X_ATTR_PCI_IO,
 		ORION5X_WIN_ENABLE), &winregs[3].ctrl);
-	writel(ORION5X_ADR_PCI_IO, &winregs[3].base);
-
-	/* Window 4: DEV_CS0 address space */
+/* Disable window 4, configure it for its intended target, enable it. */
+	writel(0, &winregs[4].ctrl);
+	writel(ORION5X_ADR_DEV_CS0, &winregs[4].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_DEV_CS0,
 		ORION5X_TARGET_DEVICE, ORION5X_ATTR_DEV_CS0,
 		ORION5X_WIN_ENABLE), &winregs[4].ctrl);
-	writel(ORION5X_ADR_DEV_CS0, &winregs[4].base);
-
-	/* Window 5: DEV_CS1 address space */
+/* Disable window 5, configure it for its intended target, enable it. */
+	writel(0, &winregs[5].ctrl);
+	writel(ORION5X_ADR_DEV_CS1, &winregs[5].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_DEV_CS1,
 		ORION5X_TARGET_DEVICE, ORION5X_ATTR_DEV_CS1,
 		ORION5X_WIN_ENABLE), &winregs[5].ctrl);
-	writel(ORION5X_ADR_DEV_CS1, &winregs[5].base);
-
-	/* Window 6: DEV_CS2 address space */
+/* Disable window 6, configure it for its intended target, enable it. */
+	writel(0, &winregs[6].ctrl);
+	writel(ORION5X_ADR_DEV_CS2, &winregs[6].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_DEV_CS2,
 		ORION5X_TARGET_DEVICE, ORION5X_ATTR_DEV_CS2,
 		ORION5X_WIN_ENABLE), &winregs[6].ctrl);
-	writel(ORION5X_ADR_DEV_CS2, &winregs[6].base);
-
-	/* Window 7: BOOT Memory address space */
-	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
-		ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
-		ORION5X_WIN_ENABLE), &winregs[7].ctrl);
-	writel(ORION5X_ADR_BOOTROM, &winregs[7].base);
 
 	return 0;
 }
@@ -265,6 +283,8 @@ int arch_misc_init(void)
 	writel(ORION5X_MPP16_23, ORION5X_MPP_BASE+0x50);
 	writel(ORION5X_GPIO_OUT_ENABLE, ORION5X_GPIO_BASE+0x04);
 
+	/* initialize timer */
+	timer_init_r();
 	return 0;
 }
 #endif /* CONFIG_ARCH_MISC_INIT */
arch/arm/cpu/arm926ejs/orion5x/timer.c +5 -3
index 115448f..d976f5a 100644
@@ -173,9 +173,11 @@ int timer_init(void)
 	cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR);
 	cntmrctrl |= CTCR_ARM_TIMER_AUTO_EN(UBOOT_CNTR);
 	writel(cntmrctrl, CNTMR_CTRL_REG);
+	return 0;
+}
 
+void timer_init_r(void)
+{
 	/* init the timestamp and lastdec value */
 	reset_timer_masked();
-
-	return 0;
-}
+}
\ No newline at end of file
arch/arm/include/asm/arch-orion5x/cpu.h +1 -0
index 6ce02a9..c84efaf 100644
@@ -255,5 +255,6 @@ void reset_cpu(unsigned long ignored);
 u32 orion5x_device_id(void);
 u32 orion5x_device_rev(void);
 unsigned int orion5x_winctrl_calcsize(unsigned int sizeval);
+void timer_init_r(void);
 #endif /* __ASSEMBLY__ */
 #endif /* _ORION5X_CPU_H */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 edminiv2: enable relocation

---
 board/LaCie/edminiv2/config.mk |    4 +++-
 include/configs/edminiv2.h     |    6 ++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
board/LaCie/edminiv2/config.mk +3 -1
index 3dec1aa..b4845ad 100644
@@ -24,4 +24,6 @@
 # MA 02110-1301 USA
 #
 
-TEXT_BASE = 0x00100000
+# with relocation TEXT_BASE now *must* be in FLASH
+
+TEXT_BASE = 0xfff90000
include/configs/edminiv2.h +6 -0
index ccfc660..a61e225 100644
@@ -223,4 +223,10 @@
 #define CONFIG_SYS_RESET_ADDRESS	0xffff0000
 #define CONFIG_SYS_MAXARGS		16
 
+/* additions for new relocation code, must added to all boards */
+#undef CONFIG_SYS_ARM_WITHOUT_RELOC
+#define CONFIG_SYS_SDRAM_BASE		0
+#define CONFIG_SYS_INIT_SP_ADDR	\
+	(CONFIG_SYS_SDRAM_BASE + 0x1000 - CONFIG_SYS_GBL_DATA_SIZE)
+
 #endif /* _CONFIG_EDMINIV2_H */
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 edminiv2: enable relocation

Hello.

Quoted 1 line · Albert Aribaud

[...]

board/LaCie/edminiv2/config.mk line 28

Quoted 11 lines
board/LaCie/edminiv2/config.mk +2 -1
index 3dec1aa..b4845ad 100644
@@ -24,4 +24,6 @@
  # MA 02110-1301 USA
  #
 
-TEXT_BASE = 0x00100000
+# with relocation TEXT_BASE now *must* be in FLASH
+

Don't think this empty line is needed...

include/configs/edminiv2.h line 226

Quoted 10 lines
board/LaCie/edminiv2/config.mk +1 -0
+TEXT_BASE = 0xfff90000
include/configs/edminiv2.h +1 -0
index ccfc660..a61e225 100644
@@ -223,4 +223,10 @@
  #define CONFIG_SYS_RESET_ADDRESS	0xffff0000
  #define CONFIG_SYS_MAXARGS		16
 
+/* additions for new relocation code, must added to all boards */

Maybe "must be added"?

WBR, Sergei

#3 lore raw

PATCH 2/2 edminiv2: enable relocation

Le 22/09/2010 11:13, Sergei Shtylyov a ?crit :

Quoted 15 lines

Hello.

Quoted 1 line · Albert Aribaud

[...]

Quoted 9 lines
board/LaCie/edminiv2/config.mk +0 -0
index 3dec1aa..b4845ad 100644
@@ -24,4 +24,6 @@
 # MA 02110-1301 USA
 #
 
Quoted 5 lines

board/LaCie/edminiv2/config.mk line 28

Quoted 3 lines
board/LaCie/edminiv2/config.mk +2 -1
-TEXT_BASE = 0x00100000
+# with relocation TEXT_BASE now *must* be in FLASH
+

Don't think this empty line is needed...

So be it :) -- I'll remove it.

Quoted 9 lines
Quoted 9 lines
board/LaCie/edminiv2/config.mk +1 -0
+TEXT_BASE = 0xfff90000
include/configs/edminiv2.h +0 -0
index ccfc660..a61e225 100644
@@ -223,4 +223,10 @@
 #define CONFIG_SYS_RESET_ADDRESS 0xffff0000
 #define CONFIG_SYS_MAXARGS 16
 
Quoted 3 lines

include/configs/edminiv2.h line 226

Quoted 1 line
include/configs/edminiv2.h +1 -0
+/* additions for new relocation code, must added to all boards */

Maybe "must be added"?

Thanks, I'll fix that in V2, and as this is copied from Heiko's patches, I've forwarded this correction request to his series as well.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 1/2 orion5x: fix relocation-incompatible code

In reply to Albert Aribaud
Quoted 58 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
Sent: Wednesday, September 22, 2010 1:06 AM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 1/2] [NEXT] orion5x: fix relocation-incompatible code

---
Device address window mapping code would not run from FLASH due to cutting access to BOOTCS. Fixed by reordering code.

Timer initialization would write globals, thus would not run correctly from FLASH. Fixed by moving the writes to a later phase in RAM.

 arch/arm/cpu/arm926ejs/orion5x/cpu.c    |   80 
+++++++++++++++++++------------
 arch/arm/cpu/arm926ejs/orion5x/timer.c  |    8 ++-
 arch/arm/include/asm/arch-orion5x/cpu.h |    1 +
 3 files changed, 56 insertions(+), 33 deletions(-)
arch/arm/cpu/arm926ejs/orion5x/cpu.c +3 -0
index 260f88b..5cffa86 100644
@@ -77,6 +77,17 @@ unsigned int 
 orion5x_winctrl_calcsize(unsigned int sizeval)
  *
  * If remap function not used, remap_lo must be set as base
  *
+ * NOTES:
+ *
+ * 1) in order to avoid windows with inconsistent control 

and base values
+ * (which could prevent access to BOOTCS and hence
execution from FLASH)
+ * always disable window before writing the base value
then reenable it
+ * by writing the control value.
+ *
+ * 2) in order to avoid losing access to BOOTCS when disabling window 7,
+ * first configure window 6 for BOOTCS, then configure
window 7 for BOOTCS,
+ * then configure windows 0 to 6 for their own target.
+ *
* Reference Documentation:
* Mbus-L to Mbus Bridge Registers Configuration.
* (Sec 25.1 and 25.3 of Datasheet)

arch/arm/cpu/arm926ejs/orion5x/cpu.c +0 -0
@@ -86,57 +97,64 @@ int orion5x_config_adr_windows(void)
 	struct orion5x_win_registers *winregs =

arch/arm/cpu/arm926ejs/orion5x/cpu.c int orion5x_config_adr_windows(void) · line 106

Quoted 10 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +7 -1
 		(struct orion5x_win_registers *)ORION5X_CPU_WIN_BASE;
 
-	/* Window 0: PCIE MEM address space */
+/* Disable window 6, configure it for FLASH, enable it. */
+	writel(0, &winregs[6].ctrl);
+	writel(ORION5X_ADR_BOOTROM, &winregs[6].base);
+	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
+		ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
+		ORION5X_WIN_ENABLE), &winregs[6].ctrl);
+/* Disable window 7, configure it for FLASH, enable it. */

Can you pls fix the ordering here so that win6/7 appears last in the code?

Quoted 91 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +6 -0
+	writel(0, &winregs[7].ctrl);
+	writel(ORION5X_ADR_BOOTROM, &winregs[7].base);
+	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
+		ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
+		ORION5X_WIN_ENABLE), &winregs[7].ctrl);
+/* Disable window 0, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +5 -8
+	writel(0, &winregs[0].ctrl);
+ 	writel(ORION5X_ADR_PCIE_MEM, &winregs[0].base);
+	writel(ORION5X_ADR_PCIE_MEM_REMAP_LO, &winregs[0].remap_lo);
+	writel(ORION5X_ADR_PCIE_MEM_REMAP_HI, &winregs[0].remap_hi);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCIE_MEM,
 		ORION5X_TARGET_PCIE, ORION5X_ATTR_PCIE_MEM,
 		ORION5X_WIN_ENABLE), &winregs[0].ctrl);
-	writel(ORION5X_ADR_PCIE_MEM, &winregs[0].base);
-	writel(ORION5X_ADR_PCIE_MEM_REMAP_LO, &winregs[0].remap_lo);
-	writel(ORION5X_ADR_PCIE_MEM_REMAP_HI, &winregs[0].remap_hi);
-
-	/* Window 1: PCIE IO address space */
-	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCIE_IO,
-		ORION5X_TARGET_PCIE, ORION5X_ATTR_PCIE_IO,
-		ORION5X_WIN_ENABLE), &winregs[1].ctrl);
+/* Disable window 1, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +5 -2
+	writel(0, &winregs[1].ctrl);
 	writel(ORION5X_ADR_PCIE_IO, &winregs[1].base);
 	writel(ORION5X_ADR_PCIE_IO_REMAP_LO, &winregs[1].remap_lo);
 	writel(ORION5X_ADR_PCIE_IO_REMAP_HI, &winregs[1].remap_hi);
-
-	/* Window 2: PCI MEM address space */
+	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCIE_IO,
+		ORION5X_TARGET_PCIE, ORION5X_ATTR_PCIE_IO,
+		ORION5X_WIN_ENABLE), &winregs[1].ctrl);
+/* Disable window 2, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +3 -3
+	writel(0, &winregs[2].ctrl);
+	writel(ORION5X_ADR_PCI_MEM, &winregs[2].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCI_MEM,
 		ORION5X_TARGET_PCI, ORION5X_ATTR_PCI_MEM,
 		ORION5X_WIN_ENABLE), &winregs[2].ctrl);
-	writel(ORION5X_ADR_PCI_MEM, &winregs[2].base);
-
-	/* Window 3: PCI IO address space */
+/* Disable window 3, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +3 -3
+	writel(0, &winregs[3].ctrl);
+	writel(ORION5X_ADR_PCI_IO, &winregs[3].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_PCI_IO,
 		ORION5X_TARGET_PCI, ORION5X_ATTR_PCI_IO,
 		ORION5X_WIN_ENABLE), &winregs[3].ctrl);
-	writel(ORION5X_ADR_PCI_IO, &winregs[3].base);
-
-	/* Window 4: DEV_CS0 address space */
+/* Disable window 4, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +3 -3
+	writel(0, &winregs[4].ctrl);
+	writel(ORION5X_ADR_DEV_CS0, &winregs[4].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_DEV_CS0,
 		ORION5X_TARGET_DEVICE, ORION5X_ATTR_DEV_CS0,
 		ORION5X_WIN_ENABLE), &winregs[4].ctrl);
-	writel(ORION5X_ADR_DEV_CS0, &winregs[4].base);
-
-	/* Window 5: DEV_CS1 address space */
+/* Disable window 5, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +3 -3
+	writel(0, &winregs[5].ctrl);
+	writel(ORION5X_ADR_DEV_CS1, &winregs[5].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_DEV_CS1,
 		ORION5X_TARGET_DEVICE, ORION5X_ATTR_DEV_CS1,
 		ORION5X_WIN_ENABLE), &winregs[5].ctrl);
-	writel(ORION5X_ADR_DEV_CS1, &winregs[5].base);
-
-	/* Window 6: DEV_CS2 address space */
+/* Disable window 6, configure it for its intended target, 

enable it. */

arch/arm/cpu/arm926ejs/orion5x/cpu.c +2 -7
+	writel(0, &winregs[6].ctrl);
+	writel(ORION5X_ADR_DEV_CS2, &winregs[6].base);
 	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_DEV_CS2,
 		ORION5X_TARGET_DEVICE, ORION5X_ATTR_DEV_CS2,
 		ORION5X_WIN_ENABLE), &winregs[6].ctrl);
-	writel(ORION5X_ADR_DEV_CS2, &winregs[6].base);
-
-	/* Window 7: BOOT Memory address space */
-	writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
-		ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
-		ORION5X_WIN_ENABLE), &winregs[7].ctrl);
-	writel(ORION5X_ADR_BOOTROM, &winregs[7].base);
 
 	return 0;
 }

arch/arm/cpu/arm926ejs/orion5x/cpu.c int arch_misc_init(void) · line 287

Quoted 5 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +2 -0
@@ -265,6 +283,8 @@ int arch_misc_init(void)
 	writel(ORION5X_MPP16_23, ORION5X_MPP_BASE+0x50);
 	writel(ORION5X_GPIO_OUT_ENABLE, ORION5X_GPIO_BASE+0x04);
 
+	/* initialize timer */
+	timer_init_r();

Using CONFIG_MISC_INIT_R in the board configuration makes more sense here And you can put this function in timer.c only and avoid exporting API through cpu.h

Quoted 14 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +0 -0
 	return 0;
 }
 #endif /* CONFIG_ARCH_MISC_INIT */
arch/arm/cpu/arm926ejs/orion5x/timer.c +2 -0
index 115448f..d976f5a 100644
@@ -173,9 +173,11 @@ int timer_init(void)
 	cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR);
 	cntmrctrl |= CTCR_ARM_TIMER_AUTO_EN(UBOOT_CNTR);
 	writel(cntmrctrl, CNTMR_CTRL_REG);
+	return 0;
+}

arch/arm/cpu/arm926ejs/orion5x/timer.c int timer_init(void) · line 183

Quoted 10 lines
arch/arm/cpu/arm926ejs/orion5x/timer.c +3 -3
 
+void timer_init_r(void)
+{
 	/* init the timestamp and lastdec value */
 	reset_timer_masked();
-
-	return 0;
-}
+}
\ No newline at end of file

Pls fix this

Regards..
Prafulla . .

#5 lore raw

PATCH 1/2 orion5x: fix relocation-incompatible code

Hi Prafulla,

Le 23/09/2010 11:16, Prafulla Wadaskar a ?crit :

Quoted 3 lines
Quoted 1 line

+/* Disable window 7, configure it for FLASH, enable it. */

Can you pls fix the ordering here so that win6/7 appears last in the code?

Of course.

Quoted 9 lines

arch/arm/cpu/arm926ejs/orion5x/cpu.c int arch_misc_init(void) · line 287

Quoted 6 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +2 -0
@@ -265,6 +283,8 @@ int arch_misc_init(void)
  	writel(ORION5X_MPP16_23, ORION5X_MPP_BASE+0x50);
  	writel(ORION5X_GPIO_OUT_ENABLE, ORION5X_GPIO_BASE+0x04);
 
+	/* initialize timer */
+	timer_init_r();

Using CONFIG_MISC_INIT_R in the board configuration makes more sense here And you can put this function in timer.c only and avoid exporting API through cpu.h

Ok for misc_init_r() rather than arch_misc_init(). However I think this function is not timer-specific and thus belongs more to cpu.c than timer.c.

Quoted 3 lines
Quoted 1 line

\ No newline at end of file

Pls fix this

Will do.

Quoted 2 lines

Regards..
Prafulla . .

Thanks!

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH 1/2 orion5x: fix relocation-incompatible code

Le 23/09/2010 11:32, Albert ARIBAUD a ?crit :

Quoted 2 lines

Ok for misc_init_r() rather than arch_misc_init(). However I think this function is not timer-specific and thus belongs more to cpu.c than timer.c.

Following-up on myself: according to a find on the whole u-boot tree, misc_init_r is uniformously used from board directories, which makes it a de facto board-specific, not SoC-specific, init function, whereas arch_misc_init is only used in SoC directories -- only by orion5x and kirkwood, actually :) -- which makes it a de facto SoC init function.

As the timer_init_r code is SoC-, not board-, specific, I think it belongs more to arch_misc_init and to misc_init_r.

Amicalement,

Signature · 1 line
Albert.