]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/blackfin/mach-bf533/head.S
184296bee3c9b43035c568f20e0380d2fee4a649
[linux-2.6-omap-h63xx.git] / arch / blackfin / mach-bf533 / head.S
1 /*
2  * File:         arch/blackfin/mach-bf533/head.S
3  * Based on:
4  * Author:       Jeff Dionne <jeff@uclinux.org> COPYRIGHT 1998 D. Jeff Dionne
5  *
6  * Created:      1998
7  * Description:  bf533 startup file
8  *
9  * Modified:
10  *               Copyright 2004-2006 Analog Devices Inc.
11  *
12  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, see the file COPYING, or write
26  * to the Free Software Foundation, Inc.,
27  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28  */
29
30 #include <linux/linkage.h>
31 #include <linux/init.h>
32 #include <asm/blackfin.h>
33 #ifdef CONFIG_BFIN_KERNEL_CLOCK
34 #include <asm/mach-common/clocks.h>
35 #include <asm/mach/mem_init.h>
36 #endif
37
38 .extern _bf53x_relocate_l1_mem
39
40 __INIT
41
42 ENTRY(_mach_early_start)
43         p0.h = hi(FIO_MASKA_C);
44         p0.l = lo(FIO_MASKA_C);
45         r0 = 0xFFFF(Z);
46         w[p0] = r0.L;   /* Disable all interrupts */
47         ssync;
48
49         p0.h = hi(FIO_MASKB_C);
50         p0.l = lo(FIO_MASKB_C);
51         r0 = 0xFFFF(Z);
52         w[p0] = r0.L;   /* Disable all interrupts */
53         ssync;
54
55         /* Initialise UART - when booting from u-boot, the UART is not disabled
56          * so if we dont initalize here, our serial console gets hosed */
57         p0.h = hi(BFIN_UART_LCR);
58         p0.l = lo(BFIN_UART_LCR);
59         r0 = 0x0(Z);
60         w[p0] = r0.L;   /* To enable DLL writes */
61         ssync;
62
63         p0.h = hi(BFIN_UART_DLL);
64         p0.l = lo(BFIN_UART_DLL);
65         r0 = 0x0(Z);
66         w[p0] = r0.L;
67         ssync;
68
69         p0.h = hi(BFIN_UART_DLH);
70         p0.l = lo(BFIN_UART_DLH);
71         r0 = 0x00(Z);
72         w[p0] = r0.L;
73         ssync;
74
75         p0.h = hi(BFIN_UART_GCTL);
76         p0.l = lo(BFIN_UART_GCTL);
77         r0 = 0x0(Z);
78         w[p0] = r0.L;   /* To enable UART clock */
79         ssync;
80
81         rts;
82 ENDPROC(_mach_early_start)
83
84 __FINIT
85
86 .section .l1.text
87 #ifdef CONFIG_BFIN_KERNEL_CLOCK
88 ENTRY(_start_dma_code)
89         p0.h = hi(SIC_IWR);
90         p0.l = lo(SIC_IWR);
91         r0.l = 0x1;
92         r0.h = 0x0;
93         [p0] = r0;
94         SSYNC;
95
96         /*
97          *  Set PLL_CTL
98          *   - [14:09] = MSEL[5:0] : CLKIN / VCO multiplication factors
99          *   - [8]     = BYPASS    : BYPASS the PLL, run CLKIN into CCLK/SCLK
100          *   - [7]     = output delay (add 200ps of delay to mem signals)
101          *   - [6]     = input delay (add 200ps of input delay to mem signals)
102          *   - [5]     = PDWN      : 1=All Clocks off
103          *   - [3]     = STOPCK    : 1=Core Clock off
104          *   - [1]     = PLL_OFF   : 1=Disable Power to PLL
105          *   - [0]     = DF        : 1=Pass CLKIN/2 to PLL / 0=Pass CLKIN to PLL
106          *   all other bits set to zero
107          */
108
109         p0.h = hi(PLL_LOCKCNT);
110         p0.l = lo(PLL_LOCKCNT);
111         r0 = 0x300(Z);
112         w[p0] = r0.l;
113         ssync;
114
115         P2.H = hi(EBIU_SDGCTL);
116         P2.L = lo(EBIU_SDGCTL);
117         R0 = [P2];
118         BITSET (R0, 24);
119         [P2] = R0;
120         SSYNC;
121
122         r0 = CONFIG_VCO_MULT & 63;       /* Load the VCO multiplier         */
123         r0 = r0 << 9;                    /* Shift it over,                  */
124         r1 = CLKIN_HALF;                 /* Do we need to divide CLKIN by 2?*/
125         r0 = r1 | r0;
126         r1 = PLL_BYPASS;                 /* Bypass the PLL?                 */
127         r1 = r1 << 8;                    /* Shift it over                   */
128         r0 = r1 | r0;                    /* add them all together           */
129
130         p0.h = hi(PLL_CTL);
131         p0.l = lo(PLL_CTL);              /* Load the address                */
132         cli r2;                          /* Disable interrupts              */
133         ssync;
134         w[p0] = r0.l;                    /* Set the value                   */
135         idle;                            /* Wait for the PLL to stablize    */
136         sti r2;                          /* Enable interrupts               */
137
138 .Lcheck_again:
139         p0.h = hi(PLL_STAT);
140         p0.l = lo(PLL_STAT);
141         R0 = W[P0](Z);
142         CC = BITTST(R0,5);
143         if ! CC jump .Lcheck_again;
144
145         /* Configure SCLK & CCLK Dividers */
146         r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
147         p0.h = hi(PLL_DIV);
148         p0.l = lo(PLL_DIV);
149         w[p0] = r0.l;
150         ssync;
151
152         p0.l = lo(EBIU_SDRRC);
153         p0.h = hi(EBIU_SDRRC);
154         r0 = mem_SDRRC;
155         w[p0] = r0.l;
156         ssync;
157
158         P2.H = hi(EBIU_SDGCTL);
159         P2.L = lo(EBIU_SDGCTL);
160         R0 = [P2];
161         BITCLR (R0, 24);
162         p0.h = hi(EBIU_SDSTAT);
163         p0.l = lo(EBIU_SDSTAT);
164         r2.l = w[p0];
165         cc = bittst(r2,3);
166         if !cc jump .Lskip;
167         NOP;
168         BITSET (R0, 23);
169 .Lskip:
170         [P2] = R0;
171         SSYNC;
172
173         R0.L = lo(mem_SDGCTL);
174         R0.H = hi(mem_SDGCTL);
175         R1 = [p2];
176         R1 = R1 | R0;
177         [P2] = R1;
178         SSYNC;
179
180         RTS;
181 ENDPROC(_start_dma_code)
182 #endif /* CONFIG_BFIN_KERNEL_CLOCK */