]> err.no Git - linux-2.6/blobdiff - arch/blackfin/kernel/setup.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
[linux-2.6] / arch / blackfin / kernel / setup.c
index 34fbf93cc1184c0ffa48ed70ec034944aafef168..d2822010b7ce4318ef2eed5446c9a7694fb10489 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/cacheflush.h>
 #include <asm/blackfin.h>
 #include <asm/cplbinit.h>
+#include <asm/div64.h>
 #include <asm/fixed_code.h>
 #include <asm/early_printk.h>
 
@@ -316,6 +317,15 @@ void __init setup_arch(char **cmdline_p)
 
        init_leds();
 
+       _bfin_swrst = bfin_read_SWRST();
+
+       if (_bfin_swrst & RESET_DOUBLE)
+               printk(KERN_INFO "Recovering from Double Fault event\n");
+       else if (_bfin_swrst & RESET_WDOG)
+               printk(KERN_INFO "Recovering from Watchdog event\n");
+       else if (_bfin_swrst & RESET_SOFTWARE)
+               printk(KERN_NOTICE "Reset caused by Software reset\n");
+
        printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
        if (bfin_compiled_revid() == 0xffff)
                printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
@@ -402,8 +412,6 @@ void __init setup_arch(char **cmdline_p)
        if (l1_length > L1_DATA_A_LENGTH)
                panic("L1 data memory overflow\n");
 
-       _bfin_swrst = bfin_read_SWRST();
-
        /* Copy atomic sequences to their fixed location, and sanity check that
           these locations are the ones that we advertise to userspace.  */
        memcpy((void *)FIXED_CODE_START, &fixed_code_start,
@@ -424,6 +432,8 @@ void __init setup_arch(char **cmdline_p)
               != ATOMIC_AND32 - FIXED_CODE_START);
        BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
               != ATOMIC_XOR32 - FIXED_CODE_START);
+       BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
+               != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
 
        init_exception_vectors();
        bf53x_cache_init();
@@ -459,7 +469,7 @@ static u_long get_vco(void)
        return vco;
 }
 
-/*Get the Core clock*/
+/* Get the Core clock */
 u_long get_cclk(void)
 {
        u_long csel, ssel;
@@ -493,12 +503,28 @@ u_long get_sclk(void)
 }
 EXPORT_SYMBOL(get_sclk);
 
+unsigned long sclk_to_usecs(unsigned long sclk)
+{
+       u64 tmp = USEC_PER_SEC * (u64)sclk;
+       do_div(tmp, get_sclk());
+       return tmp;
+}
+EXPORT_SYMBOL(sclk_to_usecs);
+
+unsigned long usecs_to_sclk(unsigned long usecs)
+{
+       u64 tmp = get_sclk() * (u64)usecs;
+       do_div(tmp, USEC_PER_SEC);
+       return tmp;
+}
+EXPORT_SYMBOL(usecs_to_sclk);
+
 /*
  *     Get CPU information for use by the procfs.
  */
 static int show_cpuinfo(struct seq_file *m, void *v)
 {
-       char *cpu, *mmu, *fpu, *name, vendor[20], cache[30];
+       char *cpu, *mmu, *fpu, *vendor, *cache;
        uint32_t revid;
 
        u_long cclk = 0, sclk = 0;
@@ -508,17 +534,17 @@ static int show_cpuinfo(struct seq_file *m, void *v)
        mmu = "none";
        fpu = "none";
        revid = bfin_revid();
-       name = bfin_board_name;
 
        cclk = get_cclk();
        sclk = get_sclk();
 
        switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) {
-       case(0xca):
-               strcpy(vendor, "AnalogDevices");
+       case 0xca:
+               vendor = "Analog Devices";
                break;
        default:
-               strcpy(vendor, "unknown");
+               vendor = "unknown";
+               break;
        }
 
        seq_printf(m, "processor\t: %d\n"
@@ -544,22 +570,22 @@ static int show_cpuinfo(struct seq_file *m, void *v)
        /* Check Cache configutation */
        switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) {
        case ACACHE_BSRAM:
-               strcpy(cache, "dbank-A/B\t: cache/sram");
+               cache = "dbank-A/B\t: cache/sram";
                dcache_size = 16;
                dsup_banks = 1;
                break;
        case ACACHE_BCACHE:
-               strcpy(cache, "dbank-A/B\t: cache/cache");
+               cache = "dbank-A/B\t: cache/cache";
                dcache_size = 32;
                dsup_banks = 2;
                break;
        case ASRAM_BSRAM:
-               strcpy(cache, "dbank-A/B\t: sram/sram");
+               cache = "dbank-A/B\t: sram/sram";
                dcache_size = 0;
                dsup_banks = 0;
                break;
        default:
-               strcpy(cache, "unknown");
+               cache = "unknown";
                dcache_size = 0;
                dsup_banks = 0;
                break;
@@ -577,7 +603,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #elif defined CONFIG_BFIN_WT
                "wt"
 #endif
-               , 0);
+               "", 0);
 
        seq_printf(m, "%s\n", cache);
 
@@ -639,7 +665,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
        }
 #endif
 
-       seq_printf(m, "board name\t: %s\n", name);
+       seq_printf(m, "board name\t: %s\n", bfin_board_name);
        seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n",
                 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end);
        seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n",