blob: 322e17779e825abad817862d1983b3304de160be [file] [log] [blame]
goda.yusukec2042f52008-01-25 20:46:36 +09001/*
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +09002 * Copyright (C) 2007-2008
goda.yusukec2042f52008-01-25 20:46:36 +09003 * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4 *
5 * Copyright (C) 2007
6 * Kenati Technologies, Inc.
7 *
8 * board/MigoR/lowlevel_init.S
9 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020010 * SPDX-License-Identifier: GPL-2.0+
goda.yusukec2042f52008-01-25 20:46:36 +090011 */
12
13#include <config.h>
goda.yusukec2042f52008-01-25 20:46:36 +090014
15#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010016#include <asm/macro.h>
goda.yusukec2042f52008-01-25 20:46:36 +090017
18/*
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010019 * Board specific low level init code, called _very_ early in the
20 * startup sequence. Relocation to SDRAM has not happened yet, no
21 * stack is available, bss section has not been initialised, etc.
goda.yusukec2042f52008-01-25 20:46:36 +090022 *
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010023 * (Note: As no stack is available, no subroutines can be called...).
goda.yusukec2042f52008-01-25 20:46:36 +090024 */
25
26 .global lowlevel_init
27
28 .text
29 .align 2
30
31lowlevel_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010032 write32 CCR_A, CCR_D ! Address of Cache Control Register
33 ! Instruction Cache Invalidate
goda.yusukec2042f52008-01-25 20:46:36 +090034
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010035 write32 MMUCR_A, MMUCR_D ! Address of MMU Control Register
36 ! TI == TLB Invalidate bit
goda.yusukec2042f52008-01-25 20:46:36 +090037
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010038 write32 MSTPCR0_A, MSTPCR0_D ! Address of Power Control Register 0
goda.yusukec2042f52008-01-25 20:46:36 +090039
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010040 write32 MSTPCR2_A, MSTPCR2_D ! Address of Power Control Register 2
goda.yusukec2042f52008-01-25 20:46:36 +090041
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010042 write16 PFC_PULCR_A, PFC_PULCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090043
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010044 write16 PFC_DRVCR_A, PFC_DRVCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090045
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010046 write16 SBSCR_A, SBSCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090047
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010048 write16 PSCR_A, PSCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090049
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010050 write16 RWTCSR_A, RWTCSR_D_1 ! 0xA4520004 (Watchdog Control / Status Register)
51 ! 0xA507 -> timer_STOP / WDT_CLK = max
goda.yusukec2042f52008-01-25 20:46:36 +090052
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010053 write16 RWTCNT_A, RWTCNT_D ! 0xA4520000 (Watchdog Count Register)
54 ! 0x5A00 -> Clear
goda.yusukec2042f52008-01-25 20:46:36 +090055
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010056 write16 RWTCSR_A, RWTCSR_D_2 ! 0xA4520004 (Watchdog Control / Status Register)
57 ! 0xA504 -> timer_STOP / CLK = 500ms
goda.yusukec2042f52008-01-25 20:46:36 +090058
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010059 write32 DLLFRQ_A, DLLFRQ_D ! 20080115
60 ! 20080115
goda.yusukec2042f52008-01-25 20:46:36 +090061
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010062 write32 FRQCR_A, FRQCR_D ! 0xA4150000 Frequency control register
63 ! 20080115
goda.yusukec2042f52008-01-25 20:46:36 +090064
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010065 write32 CCR_A, CCR_D_2 ! Address of Cache Control Register
66 ! ??
goda.yusukec2042f52008-01-25 20:46:36 +090067
68bsc_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010069 write32 CMNCR_A, CMNCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090070
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010071 write32 CS0BCR_A, CS0BCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090072
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010073 write32 CS4BCR_A, CS4BCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090074
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010075 write32 CS5ABCR_A, CS5ABCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090076
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010077 write32 CS5BBCR_A, CS5BBCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090078
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010079 write32 CS6ABCR_A, CS6ABCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090080
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010081 write32 CS0WCR_A, CS0WCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090082
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010083 write32 CS4WCR_A, CS4WCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090084
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010085 write32 CS5AWCR_A, CS5AWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090086
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010087 write32 CS5BWCR_A, CS5BWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090088
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010089 write32 CS6AWCR_A, CS6AWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090090
91 ! SDRAM initialization
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010092 write32 SDCR_A, SDCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090093
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010094 write32 SDWCR_A, SDWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090095
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010096 write32 SDPCR_A, SDPCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090097
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010098 write32 RTCOR_A, RTCOR_D
goda.yusukec2042f52008-01-25 20:46:36 +090099
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100100 write32 RTCNT_A, RTCNT_D
goda.yusukec2042f52008-01-25 20:46:36 +0900101
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100102 write32 RTCSR_A, RTCSR_D
goda.yusukec2042f52008-01-25 20:46:36 +0900103
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100104 write32 RFCR_A, RFCR_D
goda.yusukec2042f52008-01-25 20:46:36 +0900105
Nobuhiro Iwamatsuc9935c92009-01-11 17:48:56 +0900106 write8 SDMR3_A, SDMR3_D
goda.yusukec2042f52008-01-25 20:46:36 +0900107
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100108 ! BL bit off (init = ON) (?!?)
goda.yusukec2042f52008-01-25 20:46:36 +0900109
110 stc sr, r0 ! BL bit off(init=ON)
111 mov.l SR_MASK_D, r1
112 and r1, r0
113 ldc r0, sr
114
115 rts
116 mov #0, r0
117
goda.yusukec2042f52008-01-25 20:46:36 +0900118 .align 4
119
120CCR_A: .long CCR
121MMUCR_A: .long MMUCR
122MSTPCR0_A: .long MSTPCR0
123MSTPCR2_A: .long MSTPCR2
124PFC_PULCR_A: .long PULCR
125PFC_DRVCR_A: .long DRVCR
126SBSCR_A: .long SBSCR
127PSCR_A: .long PSCR
128RWTCSR_A: .long RWTCSR
129RWTCNT_A: .long RWTCNT
130FRQCR_A: .long FRQCR
131PLLCR_A: .long PLLCR
132DLLFRQ_A: .long DLLFRQ
133
134CCR_D: .long 0x00000800
135CCR_D_2: .long 0x00000103
136MMUCR_D: .long 0x00000004
137MSTPCR0_D: .long 0x00001001
138MSTPCR2_D: .long 0xffffffff
139PFC_PULCR_D: .long 0x6000
140PFC_DRVCR_D: .long 0x0464
141FRQCR_D: .long 0x07033639
142PLLCR_D: .long 0x00005000
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900143DLLFRQ_D: .long 0x000004F6
goda.yusukec2042f52008-01-25 20:46:36 +0900144
145CMNCR_A: .long CMNCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900146CMNCR_D: .long 0x0000001B
147CS0BCR_A: .long CS0BCR
goda.yusukec2042f52008-01-25 20:46:36 +0900148CS0BCR_D: .long 0x24920400
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900149CS4BCR_A: .long CS4BCR
150CS4BCR_D: .long 0x00003400
151CS5ABCR_A: .long CS5ABCR
goda.yusukec2042f52008-01-25 20:46:36 +0900152CS5ABCR_D: .long 0x24920400
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900153CS5BBCR_A: .long CS5BBCR
goda.yusukec2042f52008-01-25 20:46:36 +0900154CS5BBCR_D: .long 0x24920400
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900155CS6ABCR_A: .long CS6ABCR
goda.yusukec2042f52008-01-25 20:46:36 +0900156CS6ABCR_D: .long 0x24920400
157
158CS0WCR_A: .long CS0WCR
159CS0WCR_D: .long 0x00000380
160CS4WCR_A: .long CS4WCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900161CS4WCR_D: .long 0x00110080
goda.yusukec2042f52008-01-25 20:46:36 +0900162CS5AWCR_A: .long CS5AWCR
163CS5AWCR_D: .long 0x00000300
164CS5BWCR_A: .long CS5BWCR
165CS5BWCR_D: .long 0x00000300
166CS6AWCR_A: .long CS6AWCR
167CS6AWCR_D: .long 0x00000300
168
169SDCR_A: .long SBSC_SDCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900170SDCR_D: .long 0x80160809
goda.yusukec2042f52008-01-25 20:46:36 +0900171SDWCR_A: .long SBSC_SDWCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900172SDWCR_D: .long 0x0014450C
goda.yusukec2042f52008-01-25 20:46:36 +0900173SDPCR_A: .long SBSC_SDPCR
174SDPCR_D: .long 0x00000087
175RTCOR_A: .long SBSC_RTCOR
176RTCNT_A: .long SBSC_RTCNT
177RTCNT_D: .long 0xA55A0012
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900178RTCOR_D: .long 0xA55A001C
goda.yusukec2042f52008-01-25 20:46:36 +0900179RTCSR_A: .long SBSC_RTCSR
180RFCR_A: .long SBSC_RFCR
181RFCR_D: .long 0xA55A0221
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900182RTCSR_D: .long 0xA55A009a
183SDMR3_A: .long 0xFE581180
Nobuhiro Iwamatsuc9935c92009-01-11 17:48:56 +0900184SDMR3_D: .long 0x0
goda.yusukec2042f52008-01-25 20:46:36 +0900185
186SR_MASK_D: .long 0xEFFFFF0F
187
188 .align 2
189
190SBSCR_D: .word 0x0044
191PSCR_D: .word 0x0000
192RWTCSR_D_1: .word 0xA507
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900193RWTCSR_D_2: .word 0xA504
goda.yusukec2042f52008-01-25 20:46:36 +0900194RWTCNT_D: .word 0x5A00