aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/kernel/setup.c')
-rw-r--r--arch/blackfin/kernel/setup.c97
1 files changed, 63 insertions, 34 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 7a82d10b4ebf..7f35d1046cd8 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -42,6 +42,7 @@ EXPORT_SYMBOL(memory_start);
42EXPORT_SYMBOL(memory_end); 42EXPORT_SYMBOL(memory_end);
43EXPORT_SYMBOL(physical_mem_end); 43EXPORT_SYMBOL(physical_mem_end);
44EXPORT_SYMBOL(_ramend); 44EXPORT_SYMBOL(_ramend);
45EXPORT_SYMBOL(reserved_mem_dcache_on);
45 46
46#ifdef CONFIG_MTD_UCLINUX 47#ifdef CONFIG_MTD_UCLINUX
47unsigned long memory_mtd_end, memory_mtd_start, mtd_size; 48unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
@@ -52,7 +53,8 @@ EXPORT_SYMBOL(mtd_size);
52#endif 53#endif
53 54
54char __initdata command_line[COMMAND_LINE_SIZE]; 55char __initdata command_line[COMMAND_LINE_SIZE];
55unsigned int __initdata *__retx; 56void __initdata *init_retx, *init_saved_retx, *init_saved_seqstat,
57 *init_saved_icplb_fault_addr, *init_saved_dcplb_fault_addr;
56 58
57/* boot memmap, for parsing "memmap=" */ 59/* boot memmap, for parsing "memmap=" */
58#define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */ 60#define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */
@@ -77,10 +79,10 @@ static struct change_member *change_point[2*BFIN_MEMMAP_MAX] __initdata;
77static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata; 79static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata;
78static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata; 80static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata;
79 81
80void __init bf53x_cache_init(void) 82void __init bfin_cache_init(void)
81{ 83{
82#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) 84#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
83 generate_cpl_tables(); 85 generate_cplb_tables();
84#endif 86#endif
85 87
86#ifdef CONFIG_BFIN_ICACHE 88#ifdef CONFIG_BFIN_ICACHE
@@ -100,7 +102,7 @@ void __init bf53x_cache_init(void)
100#endif 102#endif
101} 103}
102 104
103void __init bf53x_relocate_l1_mem(void) 105void __init bfin_relocate_l1_mem(void)
104{ 106{
105 unsigned long l1_code_length; 107 unsigned long l1_code_length;
106 unsigned long l1_data_a_length; 108 unsigned long l1_data_a_length;
@@ -410,7 +412,7 @@ static __init void parse_cmdline_early(char *cmdline_p)
410 * [_rambase, _ramstart]: kernel image 412 * [_rambase, _ramstart]: kernel image
411 * [memory_start, memory_end]: dynamic memory managed by kernel 413 * [memory_start, memory_end]: dynamic memory managed by kernel
412 * [memory_end, _ramend]: reserved memory 414 * [memory_end, _ramend]: reserved memory
413 * [meory_mtd_start(memory_end), 415 * [memory_mtd_start(memory_end),
414 * memory_mtd_start + mtd_size]: rootfs (if any) 416 * memory_mtd_start + mtd_size]: rootfs (if any)
415 * [_ramend - DMA_UNCACHED_REGION, 417 * [_ramend - DMA_UNCACHED_REGION,
416 * _ramend]: uncached DMA region 418 * _ramend]: uncached DMA region
@@ -782,16 +784,25 @@ void __init setup_arch(char **cmdline_p)
782 784
783 _bfin_swrst = bfin_read_SWRST(); 785 _bfin_swrst = bfin_read_SWRST();
784 786
785 /* If we double fault, reset the system - otherwise we hang forever */ 787#ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
786 bfin_write_SWRST(DOUBLE_FAULT); 788 bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT);
789#endif
790#ifdef CONFIG_DEBUG_DOUBLEFAULT_RESET
791 bfin_write_SWRST(_bfin_swrst | DOUBLE_FAULT);
792#endif
787 793
788 if (_bfin_swrst & RESET_DOUBLE) 794 if (_bfin_swrst & RESET_DOUBLE) {
789 /* 795 printk(KERN_EMERG "Recovering from DOUBLE FAULT event\n");
790 * don't decode the address, since you don't know if this 796#ifdef CONFIG_DEBUG_DOUBLEFAULT
791 * kernel's symbol map is the same as the crashing kernel 797 /* We assume the crashing kernel, and the current symbol table match */
792 */ 798 printk(KERN_EMERG " While handling exception (EXCAUSE = 0x%x) at %pF\n",
793 printk(KERN_INFO "Recovering from Double Fault event at %pF\n", __retx); 799 (int)init_saved_seqstat & SEQSTAT_EXCAUSE, init_saved_retx);
794 else if (_bfin_swrst & RESET_WDOG) 800 printk(KERN_NOTICE " DCPLB_FAULT_ADDR: %pF\n", init_saved_dcplb_fault_addr);
801 printk(KERN_NOTICE " ICPLB_FAULT_ADDR: %pF\n", init_saved_icplb_fault_addr);
802#endif
803 printk(KERN_NOTICE " The instruction at %pF caused a double exception\n",
804 init_retx);
805 } else if (_bfin_swrst & RESET_WDOG)
795 printk(KERN_INFO "Recovering from Watchdog event\n"); 806 printk(KERN_INFO "Recovering from Watchdog event\n");
796 else if (_bfin_swrst & RESET_SOFTWARE) 807 else if (_bfin_swrst & RESET_SOFTWARE)
797 printk(KERN_NOTICE "Reset caused by Software reset\n"); 808 printk(KERN_NOTICE "Reset caused by Software reset\n");
@@ -803,17 +814,24 @@ void __init setup_arch(char **cmdline_p)
803 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU); 814 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
804 else 815 else
805 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid()); 816 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
806 if (bfin_revid() != bfin_compiled_revid()) { 817
807 if (bfin_compiled_revid() == -1) 818 if (unlikely(CPUID != bfin_cpuid()))
808 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n", 819 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
809 bfin_revid()); 820 CPU, bfin_cpuid(), bfin_revid());
810 else if (bfin_compiled_revid() != 0xffff) 821 else {
811 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", 822 if (bfin_revid() != bfin_compiled_revid()) {
812 bfin_compiled_revid(), bfin_revid()); 823 if (bfin_compiled_revid() == -1)
824 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
825 bfin_revid());
826 else if (bfin_compiled_revid() != 0xffff)
827 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
828 bfin_compiled_revid(), bfin_revid());
829 }
830 if (bfin_revid() <= CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX)
831 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
832 CPU, bfin_revid());
813 } 833 }
814 if (bfin_revid() < SUPPORTED_REVID) 834
815 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
816 CPU, bfin_revid());
817 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); 835 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
818 836
819 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", 837 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
@@ -850,7 +868,7 @@ void __init setup_arch(char **cmdline_p)
850 != SAFE_USER_INSTRUCTION - FIXED_CODE_START); 868 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
851 869
852 init_exception_vectors(); 870 init_exception_vectors();
853 bf53x_cache_init(); 871 bfin_cache_init();
854} 872}
855 873
856static int __init topology_init(void) 874static int __init topology_init(void)
@@ -986,13 +1004,18 @@ static int show_cpuinfo(struct seq_file *m, void *v)
986 } 1004 }
987 1005
988 seq_printf(m, "processor\t: %d\n" 1006 seq_printf(m, "processor\t: %d\n"
989 "vendor_id\t: %s\n" 1007 "vendor_id\t: %s\n",
990 "cpu family\t: 0x%x\n" 1008 *(unsigned int *)v,
991 "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n" 1009 vendor);
1010
1011 if (CPUID == bfin_cpuid())
1012 seq_printf(m, "cpu family\t: 0x%04x\n", CPUID);
1013 else
1014 seq_printf(m, "cpu family\t: Compiled for:0x%04x, running on:0x%04x\n",
1015 CPUID, bfin_cpuid());
1016
1017 seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
992 "stepping\t: %d\n", 1018 "stepping\t: %d\n",
993 0,
994 vendor,
995 (bfin_read_CHIPID() & CHIPID_FAMILY),
996 cpu, cclk/1000000, sclk/1000000, 1019 cpu, cclk/1000000, sclk/1000000,
997#ifdef CONFIG_MPU 1020#ifdef CONFIG_MPU
998 "mpu on", 1021 "mpu on",
@@ -1038,7 +1061,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1038 if ((bfin_read_DMEM_CONTROL() & (ENDCPLB | DMC_ENABLE)) != (ENDCPLB | DMC_ENABLE)) 1061 if ((bfin_read_DMEM_CONTROL() & (ENDCPLB | DMC_ENABLE)) != (ENDCPLB | DMC_ENABLE))
1039 dcache_size = 0; 1062 dcache_size = 0;
1040 1063
1041 if ((bfin_read_IMEM_CONTROL() & (IMC | ENICPLB)) == (IMC | ENICPLB)) 1064 if ((bfin_read_IMEM_CONTROL() & (IMC | ENICPLB)) != (IMC | ENICPLB))
1042 icache_size = 0; 1065 icache_size = 0;
1043 1066
1044 seq_printf(m, "cache size\t: %d KB(L1 icache) " 1067 seq_printf(m, "cache size\t: %d KB(L1 icache) "
@@ -1127,12 +1150,18 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1127 1150
1128static void *c_start(struct seq_file *m, loff_t *pos) 1151static void *c_start(struct seq_file *m, loff_t *pos)
1129{ 1152{
1130 return *pos < NR_CPUS ? ((void *)0x12345678) : NULL; 1153 if (*pos == 0)
1154 *pos = first_cpu(cpu_online_map);
1155 if (*pos >= num_online_cpus())
1156 return NULL;
1157
1158 return pos;
1131} 1159}
1132 1160
1133static void *c_next(struct seq_file *m, void *v, loff_t *pos) 1161static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1134{ 1162{
1135 ++*pos; 1163 *pos = next_cpu(*pos, cpu_online_map);
1164
1136 return c_start(m, pos); 1165 return c_start(m, pos);
1137} 1166}
1138 1167