]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/freescale/mx25_3stack/lowlevel_init.S
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / board / freescale / mx25_3stack / lowlevel_init.S
1 /*
2  * Copyright (c) 2009  Freescale Semiconductor
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22
23 #include <asm/arch/mx25-regs.h>
24
25 .macro REG reg, val
26         ldr r2, =\reg
27         ldr r3, =\val
28         str r3, [r2]
29 .endm
30
31 .macro REG8 reg, val
32         ldr r2, =\reg
33         ldr r3, =\val
34         strb r3, [r2]
35 .endm
36
37 .globl lowlevel_init
38 lowlevel_init:
39
40         REG 0x53F80008, 0x20034000 // ARM clk = 399, AHB clk = 133
41
42         /* Init Debug Board CS5 */
43         REG 0xB8002050, 0x0000D843
44         REG 0xB8002054, 0x22252521
45         REG 0xB8002058, 0x22220A00
46
47         /* MAX (Multi-Layer AHB Crossbar Switch) setup */
48         /* MAX - priority for MX25 is (SDHC2/SDMA)>USBOTG>RTIC>IAHB>DAHB */
49         ldr r0, =MAX_BASE
50         ldr r1, =0x00002143
51         str r1, [r0, #0x000]        /* for S0 */
52         str r1, [r0, #0x100]        /* for S1 */
53         str r1, [r0, #0x200]        /* for S2 */
54         str r1, [r0, #0x300]        /* for S3 */
55         str r1, [r0, #0x400]        /* for S4 */
56         /* SGPCR - always park on last master */
57         ldr r1, =0x10
58         str r1, [r0, #0x010]        /* for S0 */
59         str r1, [r0, #0x110]        /* for S1 */
60         str r1, [r0, #0x210]        /* for S2 */
61         str r1, [r0, #0x310]        /* for S3 */
62         str r1, [r0, #0x410]        /* for S4 */
63         /* MGPCR - restore default values */
64         ldr r1, =0x0
65         str r1, [r0, #0x800]        /* for M0 */
66         str r1, [r0, #0x900]        /* for M1 */
67         str r1, [r0, #0xA00]        /* for M2 */
68         str r1, [r0, #0xB00]        /* for M3 */
69         str r1, [r0, #0xC00]        /* for M4 */
70
71         /* M3IF setup */
72         ldr r1, =M3IF_BASE
73         ldr r0, =0x00000001
74         str r0, [r1]  /* M3IF control reg */
75
76         /* default CLKO to 1/32 of the ARM core */
77         ldr r0, =CCM_MCR
78         ldr r1, =CCM_MCR
79         bic r1, r1, #0x00F00000
80         bic r1, r1, #0x7F000000
81         mov r2,     #0x5F000000
82         add r2, r2, #0x00200000
83         orr r1, r1, r2
84         str r1, [r0]
85
86         /* enable all the clocks */
87         ldr r2, =0x1FFFFFFF
88         ldr r0, =CCM_CGR0
89         str r2, [r0]
90         ldr r2, =0xFFFFFFFF
91         ldr r0, =CCM_CGR1
92         str r2, [r0]
93         ldr r2, =0x000FDFFF
94         ldr r0, =CCM_CGR2
95         str r2, [r0]
96         mov     pc, lr
97