blob: 04cfef1fdd2702b0419db4d4a268482fc5c4d243 [file] [log] [blame]
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +09001/*
2 * Copyright (C) 2008 Renesas Solutions Corp.
3 * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
4 *
5 * board/ap325rxa/lowlevel_init.S
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23#include <config.h>
24#include <version.h>
25#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010026#include <asm/macro.h>
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090027
28/*
29 * Board specific low level init code, called _very_ early in the
30 * startup sequence. Relocation to SDRAM has not happened yet, no
31 * stack is available, bss section has not been initialised, etc.
32 *
33 * (Note: As no stack is available, no subroutines can be called...).
34 */
35
36 .global lowlevel_init
37
38 .text
39 .align 2
40
41lowlevel_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010042 write16 DRVCRA_A, DRVCRA_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090043
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010044 write16 DRVCRB_A, DRVCRB_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090045
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010046 write16 RWTCSR_A, RWTCSR_D1
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090047
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010048 write16 RWTCNT_A, RWTCNT_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090049
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010050 write16 RWTCSR_A, RWTCSR_D2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090051
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010052 write32 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090053
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010054 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090055
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010056 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090057
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010058 write32 CS4BCR_A, CS4BCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090059
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010060 write32 CS5ABCR_A, CS5ABCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090061
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010062 write32 CS5BBCR_A, CS5BBCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090063
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010064 write32 CS6ABCR_A, CS6ABCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090065
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010066 write32 CS6BBCR_A, CS6BBCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090067
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010068 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090069
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010070 write32 CS4WCR_A, CS4WCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090071
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010072 write32 CS5AWCR_A, CS5AWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090073
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010074 write32 CS5BWCR_A, CS5BWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090075
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010076 write32 CS6AWCR_A, CS6AWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090077
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010078 write32 CS6BWCR_A, CS6BWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090079
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010080 write32 SBSC_SDCR_A, SBSC_SDCR_D1
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090081
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010082 write32 SBSC_SDWCR_A, SBSC_SDWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090083
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010084 write32 SBSC_SDPCR_A, SBSC_SDPCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090085
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010086 write32 SBSC_RTCSR_A, SBSC_RTCSR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090087
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010088 write32 SBSC_RTCNT_A, SBSC_RTCNT_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090089
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010090 write32 SBSC_RTCOR_A, SBSC_RTCOR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090091
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010092 write8 SBSC_SDMR3_A1, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090093
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010094 write8 SBSC_SDMR3_A2, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090095
96 mov.l SLEEP_CNT, r1
972: tst r1, r1
98 nop
99 bf/s 2b
100 dt r1
101
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100102 write8 SBSC_SDMR3_A3, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900103
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100104 write32 SBSC_SDCR_A, SBSC_SDCR_D2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900105
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100106 write32 CCR_A, CCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900107
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100108 ! BL bit off (init = ON) (?!?)
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +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
118 .align 2
119
120DRVCRA_A: .long DRVCRA
121DRVCRB_A: .long DRVCRB
Nobuhiro Iwamatsue77ff552010-07-22 15:22:10 +0900122DRVCRA_D: .word 0x4555
123DRVCRB_D: .word 0x0005
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900124
125RWTCSR_A: .long RWTCSR
126RWTCNT_A: .long RWTCNT
127FRQCR_A: .long FRQCR
Nobuhiro Iwamatsue77ff552010-07-22 15:22:10 +0900128RWTCSR_D1: .word 0xa507
129RWTCSR_D2: .word 0xa504
130RWTCNT_D: .word 0x5a00
Nobuhiro Iwamatsu72d5cdb2010-07-22 16:04:08 +0900131.align 2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900132FRQCR_D: .long 0x0b04474a
133
134SBSC_SDCR_A: .long SBSC_SDCR
135SBSC_SDWCR_A: .long SBSC_SDWCR
136SBSC_SDPCR_A: .long SBSC_SDPCR
137SBSC_RTCSR_A: .long SBSC_RTCSR
138SBSC_RTCNT_A: .long SBSC_RTCNT
139SBSC_RTCOR_A: .long SBSC_RTCOR
140SBSC_SDMR3_A1: .long 0xfe510000
141SBSC_SDMR3_A2: .long 0xfe500242
142SBSC_SDMR3_A3: .long 0xfe5c0042
143
144SBSC_SDCR_D1: .long 0x92810112
145SBSC_SDCR_D2: .long 0x92810912
146SBSC_SDWCR_D: .long 0x05162482
147SBSC_SDPCR_D: .long 0x00300087
148SBSC_RTCSR_D: .long 0xa55a0212
149SBSC_RTCNT_D: .long 0xa55a0000
150SBSC_RTCOR_D: .long 0xa55a0040
151SBSC_SDMR3_D: .long 0x00
152
153CMNCR_A: .long CMNCR
154CS0BCR_A: .long CS0BCR
155CS4BCR_A: .long CS4BCR
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100156CS5ABCR_A: .long CS5ABCR
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900157CS5BBCR_A: .long CS5BBCR
158CS6ABCR_A: .long CS6ABCR
159CS6BBCR_A: .long CS6BBCR
160CS0WCR_A: .long CS0WCR
161CS4WCR_A: .long CS4WCR
162CS5AWCR_A: .long CS5AWCR
163CS5BWCR_A: .long CS5BWCR
164CS6AWCR_A: .long CS6AWCR
165CS6BWCR_A: .long CS6BWCR
166
167CMNCR_D: .long 0x00000013
168CS0BCR_D: .long 0x24920400
169CS4BCR_D: .long 0x24920400
170CS5ABCR_D: .long 0x24920400
171CS5BBCR_D: .long 0x7fff0600
172CS6ABCR_D: .long 0x24920400
173CS6BBCR_D: .long 0x24920600
174CS0WCR_D: .long 0x00000480
175CS4WCR_D: .long 0x00000480
176CS5AWCR_D: .long 0x00000380
Yusuke.Goda94a35362009-03-13 16:08:18 +0900177CS5BWCR_D: .long 0x00000080
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900178CS6AWCR_D: .long 0x00000300
179CS6BWCR_D: .long 0x00000540
180
181CCR_A: .long 0xff00001c
182CCR_D: .long 0x0000090d
183
184SLEEP_CNT: .long 0x00000800
185SR_MASK_D: .long 0xEFFFFF0F