aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/mach-bf537/head.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/mach-bf537/head.S')
-rw-r--r--arch/blackfin/mach-bf537/head.S128
1 files changed, 29 insertions, 99 deletions
diff --git a/arch/blackfin/mach-bf537/head.S b/arch/blackfin/mach-bf537/head.S
index 429c8a1019da..3014fe8dd155 100644
--- a/arch/blackfin/mach-bf537/head.S
+++ b/arch/blackfin/mach-bf537/head.S
@@ -33,6 +33,7 @@
33#include <asm/trace.h> 33#include <asm/trace.h>
34 34
35#if CONFIG_BFIN_KERNEL_CLOCK 35#if CONFIG_BFIN_KERNEL_CLOCK
36#include <asm/mach-common/clocks.h>
36#include <asm/mach/mem_init.h> 37#include <asm/mach/mem_init.h>
37#endif 38#endif
38 39
@@ -50,10 +51,12 @@ __INIT
50ENTRY(__start) 51ENTRY(__start)
51 /* R0: argument of command line string, passed from uboot, save it */ 52 /* R0: argument of command line string, passed from uboot, save it */
52 R7 = R0; 53 R7 = R0;
53 /* Set the SYSCFG register: 54 /* Enable Cycle Counter and Nesting Of Interrupts */
54 * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit) 55#ifdef CONFIG_BFIN_SCRATCH_REG_CYCLES
55 */ 56 R0 = SYSCFG_SNEN;
56 R0 = 0x36; 57#else
58 R0 = SYSCFG_SNEN | SYSCFG_CCEN;
59#endif
57 SYSCFG = R0; 60 SYSCFG = R0;
58 R0 = 0; 61 R0 = 0;
59 62
@@ -95,43 +98,43 @@ ENTRY(__start)
95 M2 = r0; 98 M2 = r0;
96 M3 = r0; 99 M3 = r0;
97 100
98 trace_buffer_start(p0,r0); 101 trace_buffer_init(p0,r0);
99 P0 = R1; 102 P0 = R1;
100 R0 = R1; 103 R0 = R1;
101 104
102 /* Turn off the icache */ 105 /* Turn off the icache */
103 p0.l = (IMEM_CONTROL & 0xFFFF); 106 p0.l = LO(IMEM_CONTROL);
104 p0.h = (IMEM_CONTROL >> 16); 107 p0.h = HI(IMEM_CONTROL);
105 R1 = [p0]; 108 R1 = [p0];
106 R0 = ~ENICPLB; 109 R0 = ~ENICPLB;
107 R0 = R0 & R1; 110 R0 = R0 & R1;
108 111
109 /* Anomaly 05000125 */ 112 /* Anomaly 05000125 */
110#ifdef ANOMALY_05000125 113#if ANOMALY_05000125
111 CLI R2; 114 CLI R2;
112 SSYNC; 115 SSYNC;
113#endif 116#endif
114 [p0] = R0; 117 [p0] = R0;
115 SSYNC; 118 SSYNC;
116#ifdef ANOMALY_05000125 119#if ANOMALY_05000125
117 STI R2; 120 STI R2;
118#endif 121#endif
119 122
120 /* Turn off the dcache */ 123 /* Turn off the dcache */
121 p0.l = (DMEM_CONTROL & 0xFFFF); 124 p0.l = LO(DMEM_CONTROL);
122 p0.h = (DMEM_CONTROL >> 16); 125 p0.h = HI(DMEM_CONTROL);
123 R1 = [p0]; 126 R1 = [p0];
124 R0 = ~ENDCPLB; 127 R0 = ~ENDCPLB;
125 R0 = R0 & R1; 128 R0 = R0 & R1;
126 129
127 /* Anomaly 05000125 */ 130 /* Anomaly 05000125 */
128#ifdef ANOMALY_05000125 131#if ANOMALY_05000125
129 CLI R2; 132 CLI R2;
130 SSYNC; 133 SSYNC;
131#endif 134#endif
132 [p0] = R0; 135 [p0] = R0;
133 SSYNC; 136 SSYNC;
134#ifdef ANOMALY_05000125 137#if ANOMALY_05000125
135 STI R2; 138 STI R2;
136#endif 139#endif
137 140
@@ -141,12 +144,12 @@ ENTRY(__start)
141 */ 144 */
142 p0.h = hi(BFIN_PORT_MUX); 145 p0.h = hi(BFIN_PORT_MUX);
143 p0.l = lo(BFIN_PORT_MUX); 146 p0.l = lo(BFIN_PORT_MUX);
144#ifdef ANOMALY_05000212 147#if ANOMALY_05000212
145 R0.L = W[P0]; /* Read */ 148 R0.L = W[P0]; /* Read */
146 SSYNC; 149 SSYNC;
147#endif 150#endif
148 R0 = (PGDE_UART | PFTE_UART)(Z); 151 R0 = (PGDE_UART | PFTE_UART)(Z);
149#ifdef ANOMALY_05000212 152#if ANOMALY_05000212
150 W[P0] = R0.L; /* Write */ 153 W[P0] = R0.L; /* Write */
151 SSYNC; 154 SSYNC;
152#endif 155#endif
@@ -155,12 +158,12 @@ ENTRY(__start)
155 158
156 p0.h = hi(PORTF_FER); 159 p0.h = hi(PORTF_FER);
157 p0.l = lo(PORTF_FER); 160 p0.l = lo(PORTF_FER);
158#ifdef ANOMALY_05000212 161#if ANOMALY_05000212
159 R0.L = W[P0]; /* Read */ 162 R0.L = W[P0]; /* Read */
160 SSYNC; 163 SSYNC;
161#endif 164#endif
162 R0 = 0x000F(Z); 165 R0 = 0x000F(Z);
163#ifdef ANOMALY_05000212 166#if ANOMALY_05000212
164 W[P0] = R0.L; /* Write */ 167 W[P0] = R0.L; /* Write */
165 SSYNC; 168 SSYNC;
166#endif 169#endif
@@ -221,6 +224,12 @@ ENTRY(__start)
221 fp = sp; 224 fp = sp;
222 usp = sp; 225 usp = sp;
223 226
227#ifdef CONFIG_EARLY_PRINTK
228 SP += -12;
229 call _init_early_exception_vectors;
230 SP += 12;
231#endif
232
224 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 233 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
225 call _bf53x_relocate_l1_mem; 234 call _bf53x_relocate_l1_mem;
226#if CONFIG_BFIN_KERNEL_CLOCK 235#if CONFIG_BFIN_KERNEL_CLOCK
@@ -274,7 +283,7 @@ ENTRY(__start)
274 p0.l = .LWAIT_HERE; 283 p0.l = .LWAIT_HERE;
275 p0.h = .LWAIT_HERE; 284 p0.h = .LWAIT_HERE;
276 reti = p0; 285 reti = p0;
277#if defined(ANOMALY_05000281) 286#if ANOMALY_05000281
278 nop; nop; nop; 287 nop; nop; nop;
279#endif 288#endif
280 rti; 289 rti;
@@ -436,8 +445,8 @@ ENTRY(_start_dma_code)
436 w[p0] = r0.l; 445 w[p0] = r0.l;
437 ssync; 446 ssync;
438 447
439 p0.l = (EBIU_SDBCTL & 0xFFFF); 448 p0.l = LO(EBIU_SDBCTL);
440 p0.h = (EBIU_SDBCTL >> 16); /* SDRAM Memory Bank Control Register */ 449 p0.h = HI(EBIU_SDBCTL); /* SDRAM Memory Bank Control Register */
441 r0 = mem_SDBCTL; 450 r0 = mem_SDBCTL;
442 w[p0] = r0.l; 451 w[p0] = r0.l;
443 ssync; 452 ssync;
@@ -475,85 +484,6 @@ ENTRY(_start_dma_code)
475ENDPROC(_start_dma_code) 484ENDPROC(_start_dma_code)
476#endif /* CONFIG_BFIN_KERNEL_CLOCK */ 485#endif /* CONFIG_BFIN_KERNEL_CLOCK */
477 486
478ENTRY(_bfin_reset)
479 /* No more interrupts to be handled*/
480 CLI R6;
481 SSYNC;
482
483#if defined(CONFIG_MTD_M25P80)
484 /*
485 * The following code fix the SPI flash reboot issue,
486 * /CS signal of the chip which is using PF10 return to GPIO mode
487 */
488 p0.h = hi(PORTF_FER);
489 p0.l = lo(PORTF_FER);
490 r0.l = 0x0000;
491 w[p0] = r0.l;
492 SSYNC;
493
494 /* /CS return to high */
495 p0.h = hi(PORTFIO);
496 p0.l = lo(PORTFIO);
497 r0.l = 0xFFFF;
498 w[p0] = r0.l;
499 SSYNC;
500
501 /* Delay some time, This is necessary */
502 r1.h = 0;
503 r1.l = 0x400;
504 p1 = r1;
505 lsetup (.L_delay_lab1, .L_delay_lab1_end) lc1 = p1;
506.L_delay_lab1:
507 r0.h = 0;
508 r0.l = 0x8000;
509 p0 = r0;
510 lsetup (.L_delay_lab0, .L_delay_lab0_end) lc0 = p0;
511.L_delay_lab0:
512 nop;
513.L_delay_lab0_end:
514 nop;
515.L_delay_lab1_end:
516 nop;
517#endif
518
519 /* Clear the IMASK register */
520 p0.h = hi(IMASK);
521 p0.l = lo(IMASK);
522 r0 = 0x0;
523 [p0] = r0;
524
525 /* Clear the ILAT register */
526 p0.h = hi(ILAT);
527 p0.l = lo(ILAT);
528 r0 = [p0];
529 [p0] = r0;
530 SSYNC;
531
532 /* make sure SYSCR is set to use BMODE */
533 P0.h = hi(SYSCR);
534 P0.l = lo(SYSCR);
535 R0.l = 0x0;
536 W[P0] = R0.l;
537 SSYNC;
538
539 /* issue a system soft reset */
540 P1.h = hi(SWRST);
541 P1.l = lo(SWRST);
542 R1.l = 0x0007;
543 W[P1] = R1;
544 SSYNC;
545
546 /* clear system soft reset */
547 R0.l = 0x0000;
548 W[P0] = R0;
549 SSYNC;
550
551 /* issue core reset */
552 raise 1;
553
554 RTS;
555ENDPROC(_bfin_reset)
556
557.data 487.data
558 488
559/* 489/*