blob: e32a7afb49055ed6896a8d04521eb69cade9a30c [file] [log] [blame]
goda.yusukefd768072008-01-25 20:46:36 +09001/*
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +09002 * Copyright (C) 2007-2008
goda.yusukefd768072008-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 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
26#include <config.h>
27#include <version.h>
28
29#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010030#include <asm/macro.h>
goda.yusukefd768072008-01-25 20:46:36 +090031
32/*
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010033 * Board specific low level init code, called _very_ early in the
34 * startup sequence. Relocation to SDRAM has not happened yet, no
35 * stack is available, bss section has not been initialised, etc.
goda.yusukefd768072008-01-25 20:46:36 +090036 *
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010037 * (Note: As no stack is available, no subroutines can be called...).
goda.yusukefd768072008-01-25 20:46:36 +090038 */
39
40 .global lowlevel_init
41
42 .text
43 .align 2
44
45lowlevel_init:
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010046 write32 CCR_A, CCR_D ! Address of Cache Control Register
47 ! Instruction Cache Invalidate
goda.yusukefd768072008-01-25 20:46:36 +090048
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010049 write32 MMUCR_A, MMUCR_D ! Address of MMU Control Register
50 ! TI == TLB Invalidate bit
goda.yusukefd768072008-01-25 20:46:36 +090051
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010052 write32 MSTPCR0_A, MSTPCR0_D ! Address of Power Control Register 0
goda.yusukefd768072008-01-25 20:46:36 +090053
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010054 write32 MSTPCR2_A, MSTPCR2_D ! Address of Power Control Register 2
goda.yusukefd768072008-01-25 20:46:36 +090055
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010056 write16 PFC_PULCR_A, PFC_PULCR_D
goda.yusukefd768072008-01-25 20:46:36 +090057
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010058 write16 PFC_DRVCR_A, PFC_DRVCR_D
goda.yusukefd768072008-01-25 20:46:36 +090059
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010060 write16 SBSCR_A, SBSCR_D
goda.yusukefd768072008-01-25 20:46:36 +090061
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010062 write16 PSCR_A, PSCR_D
goda.yusukefd768072008-01-25 20:46:36 +090063
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010064 write16 RWTCSR_A, RWTCSR_D_1 ! 0xA4520004 (Watchdog Control / Status Register)
65 ! 0xA507 -> timer_STOP / WDT_CLK = max
goda.yusukefd768072008-01-25 20:46:36 +090066
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010067 write16 RWTCNT_A, RWTCNT_D ! 0xA4520000 (Watchdog Count Register)
68 ! 0x5A00 -> Clear
goda.yusukefd768072008-01-25 20:46:36 +090069
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010070 write16 RWTCSR_A, RWTCSR_D_2 ! 0xA4520004 (Watchdog Control / Status Register)
71 ! 0xA504 -> timer_STOP / CLK = 500ms
goda.yusukefd768072008-01-25 20:46:36 +090072
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010073 write32 DLLFRQ_A, DLLFRQ_D ! 20080115
74 ! 20080115
goda.yusukefd768072008-01-25 20:46:36 +090075
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010076 write32 FRQCR_A, FRQCR_D ! 0xA4150000 Frequency control register
77 ! 20080115
goda.yusukefd768072008-01-25 20:46:36 +090078
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010079 write32 CCR_A, CCR_D_2 ! Address of Cache Control Register
80 ! ??
goda.yusukefd768072008-01-25 20:46:36 +090081
82bsc_init:
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010083 write32 CMNCR_A, CMNCR_D
goda.yusukefd768072008-01-25 20:46:36 +090084
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010085 write32 CS0BCR_A, CS0BCR_D
goda.yusukefd768072008-01-25 20:46:36 +090086
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010087 write32 CS4BCR_A, CS4BCR_D
goda.yusukefd768072008-01-25 20:46:36 +090088
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010089 write32 CS5ABCR_A, CS5ABCR_D
goda.yusukefd768072008-01-25 20:46:36 +090090
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010091 write32 CS5BBCR_A, CS5BBCR_D
goda.yusukefd768072008-01-25 20:46:36 +090092
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010093 write32 CS6ABCR_A, CS6ABCR_D
goda.yusukefd768072008-01-25 20:46:36 +090094
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010095 write32 CS0WCR_A, CS0WCR_D
goda.yusukefd768072008-01-25 20:46:36 +090096
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010097 write32 CS4WCR_A, CS4WCR_D
goda.yusukefd768072008-01-25 20:46:36 +090098
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010099 write32 CS5AWCR_A, CS5AWCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900100
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100101 write32 CS5BWCR_A, CS5BWCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900102
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100103 write32 CS6AWCR_A, CS6AWCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900104
105 ! SDRAM initialization
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100106 write32 SDCR_A, SDCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900107
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100108 write32 SDWCR_A, SDWCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900109
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100110 write32 SDPCR_A, SDPCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900111
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100112 write32 RTCOR_A, RTCOR_D
goda.yusukefd768072008-01-25 20:46:36 +0900113
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100114 write32 RTCNT_A, RTCNT_D
goda.yusukefd768072008-01-25 20:46:36 +0900115
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100116 write32 RTCSR_A, RTCSR_D
goda.yusukefd768072008-01-25 20:46:36 +0900117
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +0100118 write32 RFCR_A, RFCR_D
goda.yusukefd768072008-01-25 20:46:36 +0900119
Nobuhiro Iwamatsufcbff802009-01-11 17:48:56 +0900120 write8 SDMR3_A, SDMR3_D
goda.yusukefd768072008-01-25 20:46:36 +0900121
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +0100122 ! BL bit off (init = ON) (?!?)
goda.yusukefd768072008-01-25 20:46:36 +0900123
124 stc sr, r0 ! BL bit off(init=ON)
125 mov.l SR_MASK_D, r1
126 and r1, r0
127 ldc r0, sr
128
129 rts
130 mov #0, r0
131
goda.yusukefd768072008-01-25 20:46:36 +0900132 .align 4
133
134CCR_A: .long CCR
135MMUCR_A: .long MMUCR
136MSTPCR0_A: .long MSTPCR0
137MSTPCR2_A: .long MSTPCR2
138PFC_PULCR_A: .long PULCR
139PFC_DRVCR_A: .long DRVCR
140SBSCR_A: .long SBSCR
141PSCR_A: .long PSCR
142RWTCSR_A: .long RWTCSR
143RWTCNT_A: .long RWTCNT
144FRQCR_A: .long FRQCR
145PLLCR_A: .long PLLCR
146DLLFRQ_A: .long DLLFRQ
147
148CCR_D: .long 0x00000800
149CCR_D_2: .long 0x00000103
150MMUCR_D: .long 0x00000004
151MSTPCR0_D: .long 0x00001001
152MSTPCR2_D: .long 0xffffffff
153PFC_PULCR_D: .long 0x6000
154PFC_DRVCR_D: .long 0x0464
155FRQCR_D: .long 0x07033639
156PLLCR_D: .long 0x00005000
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900157DLLFRQ_D: .long 0x000004F6
goda.yusukefd768072008-01-25 20:46:36 +0900158
159CMNCR_A: .long CMNCR
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900160CMNCR_D: .long 0x0000001B
161CS0BCR_A: .long CS0BCR
goda.yusukefd768072008-01-25 20:46:36 +0900162CS0BCR_D: .long 0x24920400
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900163CS4BCR_A: .long CS4BCR
164CS4BCR_D: .long 0x00003400
165CS5ABCR_A: .long CS5ABCR
goda.yusukefd768072008-01-25 20:46:36 +0900166CS5ABCR_D: .long 0x24920400
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900167CS5BBCR_A: .long CS5BBCR
goda.yusukefd768072008-01-25 20:46:36 +0900168CS5BBCR_D: .long 0x24920400
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900169CS6ABCR_A: .long CS6ABCR
goda.yusukefd768072008-01-25 20:46:36 +0900170CS6ABCR_D: .long 0x24920400
171
172CS0WCR_A: .long CS0WCR
173CS0WCR_D: .long 0x00000380
174CS4WCR_A: .long CS4WCR
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900175CS4WCR_D: .long 0x00110080
goda.yusukefd768072008-01-25 20:46:36 +0900176CS5AWCR_A: .long CS5AWCR
177CS5AWCR_D: .long 0x00000300
178CS5BWCR_A: .long CS5BWCR
179CS5BWCR_D: .long 0x00000300
180CS6AWCR_A: .long CS6AWCR
181CS6AWCR_D: .long 0x00000300
182
183SDCR_A: .long SBSC_SDCR
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900184SDCR_D: .long 0x80160809
goda.yusukefd768072008-01-25 20:46:36 +0900185SDWCR_A: .long SBSC_SDWCR
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900186SDWCR_D: .long 0x0014450C
goda.yusukefd768072008-01-25 20:46:36 +0900187SDPCR_A: .long SBSC_SDPCR
188SDPCR_D: .long 0x00000087
189RTCOR_A: .long SBSC_RTCOR
190RTCNT_A: .long SBSC_RTCNT
191RTCNT_D: .long 0xA55A0012
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900192RTCOR_D: .long 0xA55A001C
goda.yusukefd768072008-01-25 20:46:36 +0900193RTCSR_A: .long SBSC_RTCSR
194RFCR_A: .long SBSC_RFCR
195RFCR_D: .long 0xA55A0221
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900196RTCSR_D: .long 0xA55A009a
197SDMR3_A: .long 0xFE581180
Nobuhiro Iwamatsufcbff802009-01-11 17:48:56 +0900198SDMR3_D: .long 0x0
goda.yusukefd768072008-01-25 20:46:36 +0900199
200SR_MASK_D: .long 0xEFFFFF0F
201
202 .align 2
203
204SBSCR_D: .word 0x0044
205PSCR_D: .word 0x0000
206RWTCSR_D_1: .word 0xA507
Nobuhiro Iwamatsud22cf6a2008-11-04 11:58:58 +0900207RWTCSR_D_2: .word 0xA504
goda.yusukefd768072008-01-25 20:46:36 +0900208RWTCNT_D: .word 0x5A00