All of lore.kernel.org
 help / color / mirror / Atom feed
From: dirk.behme at googlemail.com <dirk.behme@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH-OMAP3] OMAP3: Fix typo and cp_delay
Date: Sun,  9 Nov 2008 19:38:24 +0100	[thread overview]
Message-ID: <49172e21.0407560a.71cf.ffffba13@mx.google.com> (raw)

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

From: Dirk Behme <dirk.behme@gmail.com>

Fix typo and cp_delay. Requested by Wolfgang Denk.

Signed-off-by: Dirk Behme <dirk.behme@gmail.com>

---

Regarding cp_delay there was the comment:

-- cut --
>+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(-)

Index: u-boot-arm/cpu/arm_cortexa8/start.S
===================================================================
--- u-boot-arm.orig/cpu/arm_cortexa8/start.S
+++ 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
Index: u-boot-arm/cpu/arm_cortexa8/cpu.c
===================================================================
--- u-boot-arm.orig/cpu/arm_cortexa8/cpu.c
+++ 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. */

             reply	other threads:[~2008-11-09 18:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-09 18:38 dirk.behme at googlemail.com [this message]
2008-11-09 20:03 ` [U-Boot] [PATCH-OMAP3] OMAP3: Fix typo and cp_delay Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49172e21.0407560a.71cf.ffffba13@mx.google.com \
    --to=dirk.behme@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.