blob: d4484ef1f0b63799443b6d218909c76d03232f61 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +09002/*
3 * Copyright (C) 2007
4 * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Wolfgang Denk0a5c2142007-12-27 01:52:50 +01005 *
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +09006 * Copyright (C) 2007
7 * Kenati Technologies, Inc.
8 *
9 * board/ms7722se/lowlevel_init.S
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090010 */
11
12#include <config.h>
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090013
14#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010015#include <asm/macro.h>
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090016
17/*
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010018 * Board specific low level init code, called _very_ early in the
19 * startup sequence. Relocation to SDRAM has not happened yet, no
20 * stack is available, bss section has not been initialised, etc.
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090021 *
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010022 * (Note: As no stack is available, no subroutines can be called...).
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090023 */
24
25 .global lowlevel_init
26
27 .text
28 .align 2
29
30lowlevel_init:
31
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010032 /*
33 * Cache Control Register
34 * Instruction Cache Invalidate
35 */
36 write32 CCR_A, CCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090037
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010038 /*
39 * Address of MMU Control Register
40 * TI == TLB Invalidate bit
41 */
42 write32 MMUCR_A, MMUCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090043
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +090044 /* Address of Power Control Register 0 */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010045 write32 MSTPCR0_A, MSTPCR0_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090046
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +090047 /* Address of Power Control Register 2 */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010048 write32 MSTPCR2_A, MSTPCR2_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090049
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010050 write16 SBSCR_A, SBSCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090051
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010052 write16 PSCR_A, PSCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090053
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +090054 /* 0xA4520004 (Watchdog Control / Status Register) */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010055! write16 RWTCSR_A, RWTCSR_D_1 /* 0xA507 -> timer_STOP/WDT_CLK=max */
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090056
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +090057 /* 0xA4520000 (Watchdog Count Register) */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010058 write16 RWTCNT_A, RWTCNT_D /*0x5A00 -> Clear */
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090059
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +090060 /* 0xA4520004 (Watchdog Control / Status Register) */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010061 write16 RWTCSR_A, RWTCSR_D_2 /* 0xA504 -> timer_STOP/CLK=500ms */
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090062
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +090063 /* 0xA4150000 Frequency control register */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010064 write32 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090065
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010066 write32 CCR_A, CCR_D_2
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090067
68bsc_init:
69
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010070 write16 PSELA_A, PSELA_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090071
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010072 write16 DRVCR_A, DRVCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090073
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010074 write16 PCCR_A, PCCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090075
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010076 write16 PECR_A, PECR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090077
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010078 write16 PJCR_A, PJCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090079
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010080 write16 PXCR_A, PXCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090081
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010082 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090083
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010084 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090085
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010086 write32 CS2BCR_A, CS2BCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090087
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010088 write32 CS4BCR_A, CS4BCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090089
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010090 write32 CS5ABCR_A, CS5ABCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090091
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010092 write32 CS5BBCR_A, CS5BBCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090093
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010094 write32 CS6ABCR_A, CS6ABCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090095
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010096 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090097
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010098 write32 CS2WCR_A, CS2WCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +090099
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100100 write32 CS4WCR_A, CS4WCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900101
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100102 write32 CS5AWCR_A, CS5AWCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900103
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100104 write32 CS5BWCR_A, CS5BWCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900105
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100106 write32 CS6AWCR_A, CS6AWCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900107
108 ! SDRAM initialization
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100109 write32 SDCR_A, SDCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900110
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100111 write32 SDWCR_A, SDWCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900112
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100113 write32 SDPCR_A, SDPCR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900114
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100115 write32 RTCOR_A, RTCOR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900116
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100117 write32 RTCSR_A, RTCSR_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900118
Nobuhiro Iwamatsufcbff802009-01-11 17:48:56 +0900119 write8 SDMR3_A, SDMR3_D
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900120
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100121 ! BL bit off (init = ON) (?!?)
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900122
123 stc sr, r0 ! BL bit off(init=ON)
124 mov.l SR_MASK_D, r1
125 and r1, r0
126 ldc r0, sr
127
128 rts
129 mov #0, r0
130
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900131 .align 2
132
Wolfgang Denk0a5c2142007-12-27 01:52:50 +0100133CCR_A: .long CCR
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900134MMUCR_A: .long MMUCR
135MSTPCR0_A: .long MSTPCR0
136MSTPCR2_A: .long MSTPCR2
137SBSCR_A: .long SBSCR
138PSCR_A: .long PSCR
139RWTCSR_A: .long RWTCSR
140RWTCNT_A: .long RWTCNT
141FRQCR_A: .long FRQCR
142
143CCR_D: .long 0x00000800
144CCR_D_2: .long 0x00000103
145MMUCR_D: .long 0x00000004
146MSTPCR0_D: .long 0x00001001
147MSTPCR2_D: .long 0xffffffff
148FRQCR_D: .long 0x07022538
149
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100150PSELA_A: .long 0xa405014E
151PSELA_D: .word 0x0A10
Wolfgang Denk0a5c2142007-12-27 01:52:50 +0100152 .align 2
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900153
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100154DRVCR_A: .long 0xa405018A
155DRVCR_D: .word 0x0554
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900156 .align 2
157
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100158PCCR_A: .long 0xa4050104
159PCCR_D: .word 0x8800
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900160 .align 2
161
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100162PECR_A: .long 0xa4050108
163PECR_D: .word 0x0000
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900164 .align 2
165
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100166PJCR_A: .long 0xa4050110
167PJCR_D: .word 0x1000
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900168 .align 2
169
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100170PXCR_A: .long 0xa4050148
171PXCR_D: .word 0x0AAA
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900172 .align 2
173
174CMNCR_A: .long CMNCR
175CMNCR_D: .long 0x00000013
176CS0BCR_A: .long CS0BCR ! Flash bank 1
177CS0BCR_D: .long 0x24920400
178CS2BCR_A: .long CS2BCR ! SRAM
179CS2BCR_D: .long 0x24920400
180CS4BCR_A: .long CS4BCR ! FPGA, PCMCIA, USB, ext slot
181CS4BCR_D: .long 0x24920400
182CS5ABCR_A: .long CS5ABCR ! Ext slot
183CS5ABCR_D: .long 0x24920400
184CS5BBCR_A: .long CS5BBCR ! USB controller
185CS5BBCR_D: .long 0x24920400
186CS6ABCR_A: .long CS6ABCR ! Ethernet
187CS6ABCR_D: .long 0x24920400
188
189CS0WCR_A: .long CS0WCR
190CS0WCR_D: .long 0x00000300
191CS2WCR_A: .long CS2WCR
192CS2WCR_D: .long 0x00000300
193CS4WCR_A: .long CS4WCR
194CS4WCR_D: .long 0x00000300
195CS5AWCR_A: .long CS5AWCR
196CS5AWCR_D: .long 0x00000300
197CS5BWCR_A: .long CS5BWCR
198CS5BWCR_D: .long 0x00000300
199CS6AWCR_A: .long CS6AWCR
200CS6AWCR_D: .long 0x00000300
201
202SDCR_A: .long SBSC_SDCR
203SDCR_D: .long 0x00020809
204SDWCR_A: .long SBSC_SDWCR
205SDWCR_D: .long 0x00164d0d
206SDPCR_A: .long SBSC_SDPCR
207SDPCR_D: .long 0x00000087
208RTCOR_A: .long SBSC_RTCOR
209RTCOR_D: .long 0xA55A0034
210RTCSR_A: .long SBSC_RTCSR
211RTCSR_D: .long 0xA55A0010
212SDMR3_A: .long 0xFE500180
Nobuhiro Iwamatsufcbff802009-01-11 17:48:56 +0900213SDMR3_D: .long 0x0
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900214
215 .align 1
216
217SBSCR_D: .word 0x0040
218PSCR_D: .word 0x0000
219RWTCSR_D_1: .word 0xA507
220RWTCSR_D_2: .word 0xA507
221RWTCNT_D: .word 0x5A00
Nobuhiro Iwamatsue58917e2008-09-18 19:34:36 +0900222 .align 2
Nobuhiro Iwamatsudabcc0e2007-09-23 02:31:13 +0900223
224SR_MASK_D: .long 0xEFFFFF0F