Blackfin: optimize MMR reads during startup a bit
authorMike Frysinger <vapier@gentoo.org>
Mon, 18 Apr 2011 22:37:38 +0000 (18:37 -0400)
committerMike Frysinger <vapier@gentoo.org>
Wed, 25 May 2011 12:13:43 +0000 (08:13 -0400)
Since the value of these MMRs aren't changing, store the value in a local
variable and work off of that.  This avoids multiple MMR reads which are
implicitly forced by the volatile markings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/kernel/setup.c

index 904a25d..2f48f03 100644 (file)
@@ -853,6 +853,7 @@ void __init native_machine_early_platform_add_devices(void)
 
 void __init setup_arch(char **cmdline_p)
 {
+       u32 mmr;
        unsigned long sclk, cclk;
 
        native_machine_early_platform_add_devices();
@@ -923,17 +924,14 @@ void __init setup_arch(char **cmdline_p)
                bfin_read_IMDMA_D1_IRQ_STATUS();
        }
 #endif
-       printk(KERN_INFO "Hardware Trace ");
-       if (bfin_read_TBUFCTL() & 0x1)
-               printk(KERN_CONT "Active ");
-       else
-               printk(KERN_CONT "Off ");
-       if (bfin_read_TBUFCTL() & 0x2)
-               printk(KERN_CONT "and Enabled\n");
-       else
-               printk(KERN_CONT "and Disabled\n");
 
-       printk(KERN_INFO "Boot Mode: %i\n", bfin_read_SYSCR() & 0xF);
+       mmr = bfin_read_TBUFCTL();
+       printk(KERN_INFO "Hardware Trace %s and %sabled\n",
+               (mmr & 0x1) ? "active" : "off",
+               (mmr & 0x2) ? "en" : "dis");
+
+       mmr = bfin_read_SYSCR();
+       printk(KERN_INFO "Boot Mode: %i\n", mmr & 0xF);
 
        /* Newer parts mirror SWRST bits in SYSCR */
 #if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \
@@ -941,7 +939,7 @@ void __init setup_arch(char **cmdline_p)
        _bfin_swrst = bfin_read_SWRST();
 #else
        /* Clear boot mode field */
-       _bfin_swrst = bfin_read_SYSCR() & ~0xf;
+       _bfin_swrst = mmr & ~0xf;
 #endif
 
 #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT