blob: db859f48ad240a708740edab70ee8e6a2c5cb7b4 [file] [log] [blame]
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +09001/*
2 * Copyright (C) 2007
3 * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Wolfgang Denk61fb15c52007-12-27 01:52:50 +01004 *
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +09005 * Copyright (C) 2007
6 * Kenati Technologies, Inc.
7 *
8 * board/ms7722se/lowlevel_init.S
9 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020010 * SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090011 */
12
13#include <config.h>
14#include <version.h>
15
16#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010017#include <asm/macro.h>
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090018
19/*
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010020 * Board specific low level init code, called _very_ early in the
21 * startup sequence. Relocation to SDRAM has not happened yet, no
22 * stack is available, bss section has not been initialised, etc.
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090023 *
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010024 * (Note: As no stack is available, no subroutines can be called...).
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090025 */
26
27 .global lowlevel_init
28
29 .text
30 .align 2
31
32lowlevel_init:
33
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010034 /*
35 * Cache Control Register
36 * Instruction Cache Invalidate
37 */
38 write32 CCR_A, CCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090039
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010040 /*
41 * Address of MMU Control Register
42 * TI == TLB Invalidate bit
43 */
44 write32 MMUCR_A, MMUCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090045
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +090046 /* Address of Power Control Register 0 */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010047 write32 MSTPCR0_A, MSTPCR0_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090048
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +090049 /* Address of Power Control Register 2 */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010050 write32 MSTPCR2_A, MSTPCR2_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090051
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010052 write16 SBSCR_A, SBSCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090053
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010054 write16 PSCR_A, PSCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090055
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +090056 /* 0xA4520004 (Watchdog Control / Status Register) */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010057! write16 RWTCSR_A, RWTCSR_D_1 /* 0xA507 -> timer_STOP/WDT_CLK=max */
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090058
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +090059 /* 0xA4520000 (Watchdog Count Register) */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010060 write16 RWTCNT_A, RWTCNT_D /*0x5A00 -> Clear */
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090061
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +090062 /* 0xA4520004 (Watchdog Control / Status Register) */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010063 write16 RWTCSR_A, RWTCSR_D_2 /* 0xA504 -> timer_STOP/CLK=500ms */
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090064
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +090065 /* 0xA4150000 Frequency control register */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010066 write32 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090067
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010068 write32 CCR_A, CCR_D_2
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090069
70bsc_init:
71
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010072 write16 PSELA_A, PSELA_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090073
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010074 write16 DRVCR_A, DRVCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090075
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010076 write16 PCCR_A, PCCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090077
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010078 write16 PECR_A, PECR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090079
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010080 write16 PJCR_A, PJCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090081
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010082 write16 PXCR_A, PXCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090083
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010084 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090085
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010086 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090087
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010088 write32 CS2BCR_A, CS2BCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090089
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010090 write32 CS4BCR_A, CS4BCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090091
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010092 write32 CS5ABCR_A, CS5ABCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090093
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010094 write32 CS5BBCR_A, CS5BBCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090095
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010096 write32 CS6ABCR_A, CS6ABCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090097
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010098 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +090099
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100100 write32 CS2WCR_A, CS2WCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900101
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100102 write32 CS4WCR_A, CS4WCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900103
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100104 write32 CS5AWCR_A, CS5AWCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900105
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100106 write32 CS5BWCR_A, CS5BWCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900107
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100108 write32 CS6AWCR_A, CS6AWCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900109
110 ! SDRAM initialization
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100111 write32 SDCR_A, SDCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900112
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100113 write32 SDWCR_A, SDWCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900114
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100115 write32 SDPCR_A, SDPCR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900116
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100117 write32 RTCOR_A, RTCOR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900118
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100119 write32 RTCSR_A, RTCSR_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900120
Nobuhiro Iwamatsuc9935c92009-01-11 17:48:56 +0900121 write8 SDMR3_A, SDMR3_D
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900122
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100123 ! BL bit off (init = ON) (?!?)
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900124
125 stc sr, r0 ! BL bit off(init=ON)
126 mov.l SR_MASK_D, r1
127 and r1, r0
128 ldc r0, sr
129
130 rts
131 mov #0, r0
132
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900133 .align 2
134
Wolfgang Denk61fb15c52007-12-27 01:52:50 +0100135CCR_A: .long CCR
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900136MMUCR_A: .long MMUCR
137MSTPCR0_A: .long MSTPCR0
138MSTPCR2_A: .long MSTPCR2
139SBSCR_A: .long SBSCR
140PSCR_A: .long PSCR
141RWTCSR_A: .long RWTCSR
142RWTCNT_A: .long RWTCNT
143FRQCR_A: .long FRQCR
144
145CCR_D: .long 0x00000800
146CCR_D_2: .long 0x00000103
147MMUCR_D: .long 0x00000004
148MSTPCR0_D: .long 0x00001001
149MSTPCR2_D: .long 0xffffffff
150FRQCR_D: .long 0x07022538
151
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100152PSELA_A: .long 0xa405014E
153PSELA_D: .word 0x0A10
Wolfgang Denk61fb15c52007-12-27 01:52:50 +0100154 .align 2
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900155
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100156DRVCR_A: .long 0xa405018A
157DRVCR_D: .word 0x0554
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900158 .align 2
159
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100160PCCR_A: .long 0xa4050104
161PCCR_D: .word 0x8800
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900162 .align 2
163
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100164PECR_A: .long 0xa4050108
165PECR_D: .word 0x0000
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900166 .align 2
167
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100168PJCR_A: .long 0xa4050110
169PJCR_D: .word 0x1000
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900170 .align 2
171
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100172PXCR_A: .long 0xa4050148
173PXCR_D: .word 0x0AAA
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900174 .align 2
175
176CMNCR_A: .long CMNCR
177CMNCR_D: .long 0x00000013
178CS0BCR_A: .long CS0BCR ! Flash bank 1
179CS0BCR_D: .long 0x24920400
180CS2BCR_A: .long CS2BCR ! SRAM
181CS2BCR_D: .long 0x24920400
182CS4BCR_A: .long CS4BCR ! FPGA, PCMCIA, USB, ext slot
183CS4BCR_D: .long 0x24920400
184CS5ABCR_A: .long CS5ABCR ! Ext slot
185CS5ABCR_D: .long 0x24920400
186CS5BBCR_A: .long CS5BBCR ! USB controller
187CS5BBCR_D: .long 0x24920400
188CS6ABCR_A: .long CS6ABCR ! Ethernet
189CS6ABCR_D: .long 0x24920400
190
191CS0WCR_A: .long CS0WCR
192CS0WCR_D: .long 0x00000300
193CS2WCR_A: .long CS2WCR
194CS2WCR_D: .long 0x00000300
195CS4WCR_A: .long CS4WCR
196CS4WCR_D: .long 0x00000300
197CS5AWCR_A: .long CS5AWCR
198CS5AWCR_D: .long 0x00000300
199CS5BWCR_A: .long CS5BWCR
200CS5BWCR_D: .long 0x00000300
201CS6AWCR_A: .long CS6AWCR
202CS6AWCR_D: .long 0x00000300
203
204SDCR_A: .long SBSC_SDCR
205SDCR_D: .long 0x00020809
206SDWCR_A: .long SBSC_SDWCR
207SDWCR_D: .long 0x00164d0d
208SDPCR_A: .long SBSC_SDPCR
209SDPCR_D: .long 0x00000087
210RTCOR_A: .long SBSC_RTCOR
211RTCOR_D: .long 0xA55A0034
212RTCSR_A: .long SBSC_RTCSR
213RTCSR_D: .long 0xA55A0010
214SDMR3_A: .long 0xFE500180
Nobuhiro Iwamatsuc9935c92009-01-11 17:48:56 +0900215SDMR3_D: .long 0x0
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900216
217 .align 1
218
219SBSCR_D: .word 0x0040
220PSCR_D: .word 0x0000
221RWTCSR_D_1: .word 0xA507
222RWTCSR_D_2: .word 0xA507
223RWTCNT_D: .word 0x5A00
Nobuhiro Iwamatsub5d10a12008-09-18 19:34:36 +0900224 .align 2
Nobuhiro Iwamatsu6c0bbdc2007-09-23 02:31:13 +0900225
226SR_MASK_D: .long 0xEFFFFF0F