diff options
Diffstat (limited to 'arch/blackfin/kernel/setup.c')
-rw-r--r-- | arch/blackfin/kernel/setup.c | 95 |
1 files changed, 55 insertions, 40 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index a58687bdee6a..6454babdfaff 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -18,9 +18,12 @@ | |||
18 | #include <linux/tty.h> | 18 | #include <linux/tty.h> |
19 | #include <linux/pfn.h> | 19 | #include <linux/pfn.h> |
20 | 20 | ||
21 | #ifdef CONFIG_MTD_UCLINUX | ||
22 | #include <linux/mtd/map.h> | ||
21 | #include <linux/ext2_fs.h> | 23 | #include <linux/ext2_fs.h> |
22 | #include <linux/cramfs_fs.h> | 24 | #include <linux/cramfs_fs.h> |
23 | #include <linux/romfs_fs.h> | 25 | #include <linux/romfs_fs.h> |
26 | #endif | ||
24 | 27 | ||
25 | #include <asm/cplb.h> | 28 | #include <asm/cplb.h> |
26 | #include <asm/cacheflush.h> | 29 | #include <asm/cacheflush.h> |
@@ -45,6 +48,7 @@ EXPORT_SYMBOL(_ramend); | |||
45 | EXPORT_SYMBOL(reserved_mem_dcache_on); | 48 | EXPORT_SYMBOL(reserved_mem_dcache_on); |
46 | 49 | ||
47 | #ifdef CONFIG_MTD_UCLINUX | 50 | #ifdef CONFIG_MTD_UCLINUX |
51 | extern struct map_info uclinux_ram_map; | ||
48 | unsigned long memory_mtd_end, memory_mtd_start, mtd_size; | 52 | unsigned long memory_mtd_end, memory_mtd_start, mtd_size; |
49 | unsigned long _ebss; | 53 | unsigned long _ebss; |
50 | EXPORT_SYMBOL(memory_mtd_end); | 54 | EXPORT_SYMBOL(memory_mtd_end); |
@@ -150,40 +154,45 @@ void __init bfin_relocate_l1_mem(void) | |||
150 | unsigned long l1_data_b_length; | 154 | unsigned long l1_data_b_length; |
151 | unsigned long l2_length; | 155 | unsigned long l2_length; |
152 | 156 | ||
157 | /* | ||
158 | * due to the ALIGN(4) in the arch/blackfin/kernel/vmlinux.lds.S | ||
159 | * we know that everything about l1 text/data is nice and aligned, | ||
160 | * so copy by 4 byte chunks, and don't worry about overlapping | ||
161 | * src/dest. | ||
162 | * | ||
163 | * We can't use the dma_memcpy functions, since they can call | ||
164 | * scheduler functions which might be in L1 :( and core writes | ||
165 | * into L1 instruction cause bad access errors, so we are stuck, | ||
166 | * we are required to use DMA, but can't use the common dma | ||
167 | * functions. We can't use memcpy either - since that might be | ||
168 | * going to be in the relocated L1 | ||
169 | */ | ||
170 | |||
153 | blackfin_dma_early_init(); | 171 | blackfin_dma_early_init(); |
154 | 172 | ||
173 | /* if necessary, copy _stext_l1 to _etext_l1 to L1 instruction SRAM */ | ||
155 | l1_code_length = _etext_l1 - _stext_l1; | 174 | l1_code_length = _etext_l1 - _stext_l1; |
156 | if (l1_code_length > L1_CODE_LENGTH) | 175 | if (l1_code_length) |
157 | panic("L1 Instruction SRAM Overflow\n"); | 176 | early_dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length); |
158 | /* cannot complain as printk is not available as yet. | ||
159 | * But we can continue booting and complain later! | ||
160 | */ | ||
161 | |||
162 | /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */ | ||
163 | dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length); | ||
164 | 177 | ||
178 | /* if necessary, copy _sdata_l1 to _sbss_l1 to L1 data bank A SRAM */ | ||
165 | l1_data_a_length = _sbss_l1 - _sdata_l1; | 179 | l1_data_a_length = _sbss_l1 - _sdata_l1; |
166 | if (l1_data_a_length > L1_DATA_A_LENGTH) | 180 | if (l1_data_a_length) |
167 | panic("L1 Data SRAM Bank A Overflow\n"); | 181 | early_dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length); |
168 | |||
169 | /* Copy _sdata_l1 to _sbss_l1 to L1 data bank A SRAM */ | ||
170 | dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length); | ||
171 | 182 | ||
183 | /* if necessary, copy _sdata_b_l1 to _sbss_b_l1 to L1 data bank B SRAM */ | ||
172 | l1_data_b_length = _sbss_b_l1 - _sdata_b_l1; | 184 | l1_data_b_length = _sbss_b_l1 - _sdata_b_l1; |
173 | if (l1_data_b_length > L1_DATA_B_LENGTH) | 185 | if (l1_data_b_length) |
174 | panic("L1 Data SRAM Bank B Overflow\n"); | 186 | early_dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length + |
175 | |||
176 | /* Copy _sdata_b_l1 to _sbss_b_l1 to L1 data bank B SRAM */ | ||
177 | dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length + | ||
178 | l1_data_a_length, l1_data_b_length); | 187 | l1_data_a_length, l1_data_b_length); |
179 | 188 | ||
189 | early_dma_memcpy_done(); | ||
190 | |||
191 | /* if necessary, copy _stext_l2 to _edata_l2 to L2 SRAM */ | ||
180 | if (L2_LENGTH != 0) { | 192 | if (L2_LENGTH != 0) { |
181 | l2_length = _sbss_l2 - _stext_l2; | 193 | l2_length = _sbss_l2 - _stext_l2; |
182 | if (l2_length > L2_LENGTH) | 194 | if (l2_length) |
183 | panic("L2 SRAM Overflow\n"); | 195 | memcpy(_stext_l2, _l2_lma_start, l2_length); |
184 | |||
185 | /* Copy _stext_l2 to _edata_l2 to L2 SRAM */ | ||
186 | dma_memcpy(_stext_l2, _l2_lma_start, l2_length); | ||
187 | } | 196 | } |
188 | } | 197 | } |
189 | 198 | ||
@@ -472,7 +481,7 @@ static __init void memory_setup(void) | |||
472 | 481 | ||
473 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { | 482 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { |
474 | console_init(); | 483 | console_init(); |
475 | panic("DMA region exceeds memory limit: %lu.\n", | 484 | panic("DMA region exceeds memory limit: %lu.", |
476 | _ramend - _ramstart); | 485 | _ramend - _ramstart); |
477 | } | 486 | } |
478 | memory_end = _ramend - DMA_UNCACHED_REGION; | 487 | memory_end = _ramend - DMA_UNCACHED_REGION; |
@@ -526,14 +535,13 @@ static __init void memory_setup(void) | |||
526 | 535 | ||
527 | if (mtd_size == 0) { | 536 | if (mtd_size == 0) { |
528 | console_init(); | 537 | console_init(); |
529 | panic("Don't boot kernel without rootfs attached.\n"); | 538 | panic("Don't boot kernel without rootfs attached."); |
530 | } | 539 | } |
531 | 540 | ||
532 | /* Relocate MTD image to the top of memory after the uncached memory area */ | 541 | /* Relocate MTD image to the top of memory after the uncached memory area */ |
533 | dma_memcpy((char *)memory_end, _end, mtd_size); | 542 | uclinux_ram_map.phys = memory_mtd_start = memory_end; |
534 | 543 | uclinux_ram_map.size = mtd_size; | |
535 | memory_mtd_start = memory_end; | 544 | dma_memcpy((void *)uclinux_ram_map.phys, _end, uclinux_ram_map.size); |
536 | _ebss = memory_mtd_start; /* define _ebss for compatible */ | ||
537 | #endif /* CONFIG_MTD_UCLINUX */ | 545 | #endif /* CONFIG_MTD_UCLINUX */ |
538 | 546 | ||
539 | #if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263) | 547 | #if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263) |
@@ -796,10 +804,8 @@ void __init setup_arch(char **cmdline_p) | |||
796 | cclk = get_cclk(); | 804 | cclk = get_cclk(); |
797 | sclk = get_sclk(); | 805 | sclk = get_sclk(); |
798 | 806 | ||
799 | #if !defined(CONFIG_BFIN_KERNEL_CLOCK) | 807 | if ((ANOMALY_05000273 || ANOMALY_05000274) && (cclk >> 1) < sclk) |
800 | if (ANOMALY_05000273 && cclk == sclk) | 808 | panic("ANOMALY 05000273 or 05000274: CCLK must be >= 2*SCLK"); |
801 | panic("ANOMALY 05000273, SCLK can not be same as CCLK"); | ||
802 | #endif | ||
803 | 809 | ||
804 | #ifdef BF561_FAMILY | 810 | #ifdef BF561_FAMILY |
805 | if (ANOMALY_05000266) { | 811 | if (ANOMALY_05000266) { |
@@ -881,7 +887,7 @@ void __init setup_arch(char **cmdline_p) | |||
881 | printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", | 887 | printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", |
882 | bfin_compiled_revid(), bfin_revid()); | 888 | bfin_compiled_revid(), bfin_revid()); |
883 | if (bfin_compiled_revid() > bfin_revid()) | 889 | if (bfin_compiled_revid() > bfin_revid()) |
884 | panic("Error: you are missing anomaly workarounds for this rev\n"); | 890 | panic("Error: you are missing anomaly workarounds for this rev"); |
885 | } | 891 | } |
886 | } | 892 | } |
887 | if (bfin_revid() < CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX) | 893 | if (bfin_revid() < CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX) |
@@ -891,16 +897,13 @@ void __init setup_arch(char **cmdline_p) | |||
891 | 897 | ||
892 | /* We can't run on BF548-0.1 due to ANOMALY 05000448 */ | 898 | /* We can't run on BF548-0.1 due to ANOMALY 05000448 */ |
893 | if (bfin_cpuid() == 0x27de && bfin_revid() == 1) | 899 | if (bfin_cpuid() == 0x27de && bfin_revid() == 1) |
894 | panic("You can't run on this processor due to 05000448\n"); | 900 | panic("You can't run on this processor due to 05000448"); |
895 | 901 | ||
896 | printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); | 902 | printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); |
897 | 903 | ||
898 | printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", | 904 | printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", |
899 | cclk / 1000000, sclk / 1000000); | 905 | cclk / 1000000, sclk / 1000000); |
900 | 906 | ||
901 | if (ANOMALY_05000273 && (cclk >> 1) <= sclk) | ||
902 | printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n"); | ||
903 | |||
904 | setup_bootmem_allocator(); | 907 | setup_bootmem_allocator(); |
905 | 908 | ||
906 | paging_init(); | 909 | paging_init(); |
@@ -1095,7 +1098,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1095 | CPUID, bfin_cpuid()); | 1098 | CPUID, bfin_cpuid()); |
1096 | 1099 | ||
1097 | seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n" | 1100 | seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n" |
1098 | "stepping\t: %d\n", | 1101 | "stepping\t: %d ", |
1099 | cpu, cclk/1000000, sclk/1000000, | 1102 | cpu, cclk/1000000, sclk/1000000, |
1100 | #ifdef CONFIG_MPU | 1103 | #ifdef CONFIG_MPU |
1101 | "mpu on", | 1104 | "mpu on", |
@@ -1104,7 +1107,16 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1104 | #endif | 1107 | #endif |
1105 | revid); | 1108 | revid); |
1106 | 1109 | ||
1107 | seq_printf(m, "cpu MHz\t\t: %lu.%03lu/%lu.%03lu\n", | 1110 | if (bfin_revid() != bfin_compiled_revid()) { |
1111 | if (bfin_compiled_revid() == -1) | ||
1112 | seq_printf(m, "(Compiled for Rev none)"); | ||
1113 | else if (bfin_compiled_revid() == 0xffff) | ||
1114 | seq_printf(m, "(Compiled for Rev any)"); | ||
1115 | else | ||
1116 | seq_printf(m, "(Compiled for Rev %d)", bfin_compiled_revid()); | ||
1117 | } | ||
1118 | |||
1119 | seq_printf(m, "\ncpu MHz\t\t: %lu.%03lu/%lu.%03lu\n", | ||
1108 | cclk/1000000, cclk%1000000, | 1120 | cclk/1000000, cclk%1000000, |
1109 | sclk/1000000, sclk%1000000); | 1121 | sclk/1000000, sclk%1000000); |
1110 | seq_printf(m, "bogomips\t: %lu.%02lu\n" | 1122 | seq_printf(m, "bogomips\t: %lu.%02lu\n" |
@@ -1169,6 +1181,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1169 | #ifdef __ARCH_SYNC_CORE_DCACHE | 1181 | #ifdef __ARCH_SYNC_CORE_DCACHE |
1170 | seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count); | 1182 | seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count); |
1171 | #endif | 1183 | #endif |
1184 | #ifdef __ARCH_SYNC_CORE_ICACHE | ||
1185 | seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", cpudata->icache_invld_count); | ||
1186 | #endif | ||
1172 | #ifdef CONFIG_BFIN_ICACHE_LOCK | 1187 | #ifdef CONFIG_BFIN_ICACHE_LOCK |
1173 | switch ((cpudata->imemctl >> 3) & WAYALL_L) { | 1188 | switch ((cpudata->imemctl >> 3) & WAYALL_L) { |
1174 | case WAY0_L: | 1189 | case WAY0_L: |