blob: 1b494faeb0e2a7b4a708b310f738f7d1d741f364 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
goda.yusukec2042f52008-01-25 20:46:36 +09002/*
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +09003 * Copyright (C) 2007-2008
goda.yusukec2042f52008-01-25 20:46:36 +09004 * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5 *
6 * Copyright (C) 2007
7 * Kenati Technologies, Inc.
8 *
9 * board/MigoR/lowlevel_init.S
goda.yusukec2042f52008-01-25 20:46:36 +090010 */
11
12#include <config.h>
goda.yusukec2042f52008-01-25 20:46:36 +090013
14#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010015#include <asm/macro.h>
goda.yusukec2042f52008-01-25 20:46:36 +090016
17/*
Jean-Christophe PLAGNIOL-VILLARDe4430772008-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.
goda.yusukec2042f52008-01-25 20:46:36 +090021 *
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010022 * (Note: As no stack is available, no subroutines can be called...).
goda.yusukec2042f52008-01-25 20:46:36 +090023 */
24
25 .global lowlevel_init
26
27 .text
28 .align 2
29
30lowlevel_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010031 write32 CCR_A, CCR_D ! Address of Cache Control Register
32 ! Instruction Cache Invalidate
goda.yusukec2042f52008-01-25 20:46:36 +090033
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010034 write32 MMUCR_A, MMUCR_D ! Address of MMU Control Register
35 ! TI == TLB Invalidate bit
goda.yusukec2042f52008-01-25 20:46:36 +090036
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010037 write32 MSTPCR0_A, MSTPCR0_D ! Address of Power Control Register 0
goda.yusukec2042f52008-01-25 20:46:36 +090038
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010039 write32 MSTPCR2_A, MSTPCR2_D ! Address of Power Control Register 2
goda.yusukec2042f52008-01-25 20:46:36 +090040
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010041 write16 PFC_PULCR_A, PFC_PULCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090042
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010043 write16 PFC_DRVCR_A, PFC_DRVCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090044
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010045 write16 SBSCR_A, SBSCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090046
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010047 write16 PSCR_A, PSCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090048
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010049 write16 RWTCSR_A, RWTCSR_D_1 ! 0xA4520004 (Watchdog Control / Status Register)
50 ! 0xA507 -> timer_STOP / WDT_CLK = max
goda.yusukec2042f52008-01-25 20:46:36 +090051
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010052 write16 RWTCNT_A, RWTCNT_D ! 0xA4520000 (Watchdog Count Register)
53 ! 0x5A00 -> Clear
goda.yusukec2042f52008-01-25 20:46:36 +090054
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010055 write16 RWTCSR_A, RWTCSR_D_2 ! 0xA4520004 (Watchdog Control / Status Register)
56 ! 0xA504 -> timer_STOP / CLK = 500ms
goda.yusukec2042f52008-01-25 20:46:36 +090057
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010058 write32 DLLFRQ_A, DLLFRQ_D ! 20080115
59 ! 20080115
goda.yusukec2042f52008-01-25 20:46:36 +090060
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010061 write32 FRQCR_A, FRQCR_D ! 0xA4150000 Frequency control register
62 ! 20080115
goda.yusukec2042f52008-01-25 20:46:36 +090063
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010064 write32 CCR_A, CCR_D_2 ! Address of Cache Control Register
65 ! ??
goda.yusukec2042f52008-01-25 20:46:36 +090066
67bsc_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010068 write32 CMNCR_A, CMNCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090069
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010070 write32 CS0BCR_A, CS0BCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090071
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010072 write32 CS4BCR_A, CS4BCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090073
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010074 write32 CS5ABCR_A, CS5ABCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090075
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010076 write32 CS5BBCR_A, CS5BBCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090077
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010078 write32 CS6ABCR_A, CS6ABCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090079
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010080 write32 CS0WCR_A, CS0WCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090081
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010082 write32 CS4WCR_A, CS4WCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090083
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010084 write32 CS5AWCR_A, CS5AWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090085
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010086 write32 CS5BWCR_A, CS5BWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090087
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010088 write32 CS6AWCR_A, CS6AWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090089
90 ! SDRAM initialization
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010091 write32 SDCR_A, SDCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090092
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010093 write32 SDWCR_A, SDWCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090094
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010095 write32 SDPCR_A, SDPCR_D
goda.yusukec2042f52008-01-25 20:46:36 +090096
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010097 write32 RTCOR_A, RTCOR_D
goda.yusukec2042f52008-01-25 20:46:36 +090098
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010099 write32 RTCNT_A, RTCNT_D
goda.yusukec2042f52008-01-25 20:46:36 +0900100
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100101 write32 RTCSR_A, RTCSR_D
goda.yusukec2042f52008-01-25 20:46:36 +0900102
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100103 write32 RFCR_A, RFCR_D
goda.yusukec2042f52008-01-25 20:46:36 +0900104
Nobuhiro Iwamatsuc9935c92009-01-11 17:48:56 +0900105 write8 SDMR3_A, SDMR3_D
goda.yusukec2042f52008-01-25 20:46:36 +0900106
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100107 ! BL bit off (init = ON) (?!?)
goda.yusukec2042f52008-01-25 20:46:36 +0900108
109 stc sr, r0 ! BL bit off(init=ON)
110 mov.l SR_MASK_D, r1
111 and r1, r0
112 ldc r0, sr
113
114 rts
115 mov #0, r0
116
goda.yusukec2042f52008-01-25 20:46:36 +0900117 .align 4
118
119CCR_A: .long CCR
120MMUCR_A: .long MMUCR
121MSTPCR0_A: .long MSTPCR0
122MSTPCR2_A: .long MSTPCR2
123PFC_PULCR_A: .long PULCR
124PFC_DRVCR_A: .long DRVCR
125SBSCR_A: .long SBSCR
126PSCR_A: .long PSCR
127RWTCSR_A: .long RWTCSR
128RWTCNT_A: .long RWTCNT
129FRQCR_A: .long FRQCR
130PLLCR_A: .long PLLCR
131DLLFRQ_A: .long DLLFRQ
132
133CCR_D: .long 0x00000800
134CCR_D_2: .long 0x00000103
135MMUCR_D: .long 0x00000004
136MSTPCR0_D: .long 0x00001001
137MSTPCR2_D: .long 0xffffffff
138PFC_PULCR_D: .long 0x6000
139PFC_DRVCR_D: .long 0x0464
140FRQCR_D: .long 0x07033639
141PLLCR_D: .long 0x00005000
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900142DLLFRQ_D: .long 0x000004F6
goda.yusukec2042f52008-01-25 20:46:36 +0900143
144CMNCR_A: .long CMNCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900145CMNCR_D: .long 0x0000001B
146CS0BCR_A: .long CS0BCR
goda.yusukec2042f52008-01-25 20:46:36 +0900147CS0BCR_D: .long 0x24920400
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900148CS4BCR_A: .long CS4BCR
149CS4BCR_D: .long 0x00003400
150CS5ABCR_A: .long CS5ABCR
goda.yusukec2042f52008-01-25 20:46:36 +0900151CS5ABCR_D: .long 0x24920400
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900152CS5BBCR_A: .long CS5BBCR
goda.yusukec2042f52008-01-25 20:46:36 +0900153CS5BBCR_D: .long 0x24920400
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900154CS6ABCR_A: .long CS6ABCR
goda.yusukec2042f52008-01-25 20:46:36 +0900155CS6ABCR_D: .long 0x24920400
156
157CS0WCR_A: .long CS0WCR
158CS0WCR_D: .long 0x00000380
159CS4WCR_A: .long CS4WCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900160CS4WCR_D: .long 0x00110080
goda.yusukec2042f52008-01-25 20:46:36 +0900161CS5AWCR_A: .long CS5AWCR
162CS5AWCR_D: .long 0x00000300
163CS5BWCR_A: .long CS5BWCR
164CS5BWCR_D: .long 0x00000300
165CS6AWCR_A: .long CS6AWCR
166CS6AWCR_D: .long 0x00000300
167
168SDCR_A: .long SBSC_SDCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900169SDCR_D: .long 0x80160809
goda.yusukec2042f52008-01-25 20:46:36 +0900170SDWCR_A: .long SBSC_SDWCR
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900171SDWCR_D: .long 0x0014450C
goda.yusukec2042f52008-01-25 20:46:36 +0900172SDPCR_A: .long SBSC_SDPCR
173SDPCR_D: .long 0x00000087
174RTCOR_A: .long SBSC_RTCOR
175RTCNT_A: .long SBSC_RTCNT
176RTCNT_D: .long 0xA55A0012
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900177RTCOR_D: .long 0xA55A001C
goda.yusukec2042f52008-01-25 20:46:36 +0900178RTCSR_A: .long SBSC_RTCSR
179RFCR_A: .long SBSC_RFCR
180RFCR_D: .long 0xA55A0221
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900181RTCSR_D: .long 0xA55A009a
182SDMR3_A: .long 0xFE581180
Nobuhiro Iwamatsuc9935c92009-01-11 17:48:56 +0900183SDMR3_D: .long 0x0
goda.yusukec2042f52008-01-25 20:46:36 +0900184
185SR_MASK_D: .long 0xEFFFFF0F
186
187 .align 2
188
189SBSCR_D: .word 0x0044
190PSCR_D: .word 0x0000
191RWTCSR_D_1: .word 0xA507
Nobuhiro Iwamatsub81786c2008-11-04 11:58:58 +0900192RWTCSR_D_2: .word 0xA504
goda.yusukec2042f52008-01-25 20:46:36 +0900193RWTCNT_D: .word 0x5A00