Skip to contentSkip to conversation

OMAP3: Fix typo and cp_delay

U-Boot dirk.behme at googlemail.com 2 participants 2 messages Nov 9, 2008

lore
Share & tools
lore
#0 lore raw

Subject: [PATCH-OMAP3] OMAP3: Fix typo and cp_delay

From: Dirk Behme <[email protected]>

Fix typo and cp_delay. Requested by Wolfgang Denk.

---

Regarding cp_delay there was the comment:

-- cut --

Review

Quoted 6 lines
(quoted diff) +6 -0
+static void cp_delay(void)
+{
+	volatile int i;
+
+	/* Many OMAP regs need at least 2 nops */
+	for (i = 0; i < 100; i++) ;

There is not much reason for the compiler not to optimize this code away. -- cut --

Please note that most of ARM code uses *this* cp_delay() implementation. If I understood correctly at IRC, Scott Wood made some tests and volatile prevents gcc from optimizing loop away.

 cpu/arm_cortexa8/cpu.c   |    5 ++---
 cpu/arm_cortexa8/start.S |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
cpu/arm_cortexa8/start.S +1 -1
Index: u-boot-arm/cpu/arm_cortexa8/start.S
===================================================================
@@ -394,7 +394,7 @@ irq:
 	.align	5
 fiq:
 	get_fiq_stack
-	/* someone ought to write a more effiction fiq_save_user_regs */
+	/* someone ought to write a more effective fiq_save_user_regs */
 	irq_save_user_regs
 	bl	do_fiq
 	irq_restore_user_regs
cpu/arm_cortexa8/cpu.c +2 -3
Index: u-boot-arm/cpu/arm_cortexa8/cpu.c
===================================================================
@@ -68,10 +68,9 @@ static void write_p15_c1(unsigned long v
 
 static void cp_delay(void)
 {
-	volatile int i;
-
 	/* Many OMAP regs need@least 2 nops */
-	for (i = 0; i < 100; i++) ;
+	asm("nop");
+	asm("nop");
 }
 
 /* See also ARM Ref. Man. */
#1 lore raw

Dear dirk.behme at googlemail.com,

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

Subject: [PATCH-OMAP3] OMAP3: Fix typo and cp_delay

From: Dirk Behme <[email protected]>

Fix typo and cp_delay. Requested by Wolfgang Denk.

See previous comments.

Quoted 17 lines

---

Regarding cp_delay there was the comment:

-- cut --

Review

Quoted 6 lines
(quoted diff) +6 -0
+static void cp_delay(void)
+{
+	volatile int i;
+
+	/* Many OMAP regs need at least 2 nops */
+	for (i = 0; i < 100; i++) ;

There is not much reason for the compiler not to optimize this code away. -- cut --

Quoted 1 line

Please note that most of ARM code uses *this* cp_delay() implementation. If I understood correctly at IRC, Scott Wood made some tests and volatile prevents gcc from optimizing loop away.

Now this is actually some interesting information which probably should be part of the commit message - in the present form, it just gets lost.

Best regards,

Wolfgang Denk

Signature · 4 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
"Deliver yesterday, code today, think tomorrow."