blob: ead5310a4bb73b8c980a0711e02c4c7c1aae0e58 [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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +09008 */
9
10#include <config.h>
11#include <version.h>
12#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010013#include <asm/macro.h>
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090014
15/*
16 * Board specific low level init code, called _very_ early in the
17 * startup sequence. Relocation to SDRAM has not happened yet, no
18 * stack is available, bss section has not been initialised, etc.
19 *
20 * (Note: As no stack is available, no subroutines can be called...).
21 */
22
23 .global lowlevel_init
24
25 .text
26 .align 2
27
28lowlevel_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010029 write16 DRVCRA_A, DRVCRA_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090030
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010031 write16 DRVCRB_A, DRVCRB_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090032
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010033 write16 RWTCSR_A, RWTCSR_D1
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090034
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010035 write16 RWTCNT_A, RWTCNT_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090036
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010037 write16 RWTCSR_A, RWTCSR_D2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090038
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010039 write32 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090040
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010041 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090042
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010043 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090044
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010045 write32 CS4BCR_A, CS4BCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090046
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010047 write32 CS5ABCR_A, CS5ABCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090048
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010049 write32 CS5BBCR_A, CS5BBCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090050
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010051 write32 CS6ABCR_A, CS6ABCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090052
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010053 write32 CS6BBCR_A, CS6BBCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090054
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010055 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090056
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010057 write32 CS4WCR_A, CS4WCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090058
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010059 write32 CS5AWCR_A, CS5AWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090060
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010061 write32 CS5BWCR_A, CS5BWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090062
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010063 write32 CS6AWCR_A, CS6AWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090064
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010065 write32 CS6BWCR_A, CS6BWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090066
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010067 write32 SBSC_SDCR_A, SBSC_SDCR_D1
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090068
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010069 write32 SBSC_SDWCR_A, SBSC_SDWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090070
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010071 write32 SBSC_SDPCR_A, SBSC_SDPCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090072
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010073 write32 SBSC_RTCSR_A, SBSC_RTCSR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090074
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010075 write32 SBSC_RTCNT_A, SBSC_RTCNT_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090076
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010077 write32 SBSC_RTCOR_A, SBSC_RTCOR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090078
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010079 write8 SBSC_SDMR3_A1, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090080
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010081 write8 SBSC_SDMR3_A2, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090082
83 mov.l SLEEP_CNT, r1
842: tst r1, r1
85 nop
86 bf/s 2b
87 dt r1
88
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010089 write8 SBSC_SDMR3_A3, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090090
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010091 write32 SBSC_SDCR_A, SBSC_SDCR_D2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090092
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010093 write32 CCR_A, CCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090094
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010095 ! BL bit off (init = ON) (?!?)
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090096
97 stc sr, r0 ! BL bit off(init=ON)
98 mov.l SR_MASK_D, r1
99 and r1, r0
100 ldc r0, sr
101
102 rts
103 mov #0, r0
104
105 .align 2
106
107DRVCRA_A: .long DRVCRA
108DRVCRB_A: .long DRVCRB
Nobuhiro Iwamatsue77ff552010-07-22 15:22:10 +0900109DRVCRA_D: .word 0x4555
110DRVCRB_D: .word 0x0005
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900111
112RWTCSR_A: .long RWTCSR
113RWTCNT_A: .long RWTCNT
114FRQCR_A: .long FRQCR
Nobuhiro Iwamatsue77ff552010-07-22 15:22:10 +0900115RWTCSR_D1: .word 0xa507
116RWTCSR_D2: .word 0xa504
117RWTCNT_D: .word 0x5a00
Nobuhiro Iwamatsu72d5cdb2010-07-22 16:04:08 +0900118.align 2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900119FRQCR_D: .long 0x0b04474a
120
121SBSC_SDCR_A: .long SBSC_SDCR
122SBSC_SDWCR_A: .long SBSC_SDWCR
123SBSC_SDPCR_A: .long SBSC_SDPCR
124SBSC_RTCSR_A: .long SBSC_RTCSR
125SBSC_RTCNT_A: .long SBSC_RTCNT
126SBSC_RTCOR_A: .long SBSC_RTCOR
127SBSC_SDMR3_A1: .long 0xfe510000
128SBSC_SDMR3_A2: .long 0xfe500242
129SBSC_SDMR3_A3: .long 0xfe5c0042
130
131SBSC_SDCR_D1: .long 0x92810112
132SBSC_SDCR_D2: .long 0x92810912
133SBSC_SDWCR_D: .long 0x05162482
134SBSC_SDPCR_D: .long 0x00300087
135SBSC_RTCSR_D: .long 0xa55a0212
136SBSC_RTCNT_D: .long 0xa55a0000
137SBSC_RTCOR_D: .long 0xa55a0040
138SBSC_SDMR3_D: .long 0x00
139
140CMNCR_A: .long CMNCR
141CS0BCR_A: .long CS0BCR
142CS4BCR_A: .long CS4BCR
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100143CS5ABCR_A: .long CS5ABCR
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900144CS5BBCR_A: .long CS5BBCR
145CS6ABCR_A: .long CS6ABCR
146CS6BBCR_A: .long CS6BBCR
147CS0WCR_A: .long CS0WCR
148CS4WCR_A: .long CS4WCR
149CS5AWCR_A: .long CS5AWCR
150CS5BWCR_A: .long CS5BWCR
151CS6AWCR_A: .long CS6AWCR
152CS6BWCR_A: .long CS6BWCR
153
154CMNCR_D: .long 0x00000013
155CS0BCR_D: .long 0x24920400
156CS4BCR_D: .long 0x24920400
157CS5ABCR_D: .long 0x24920400
158CS5BBCR_D: .long 0x7fff0600
159CS6ABCR_D: .long 0x24920400
160CS6BBCR_D: .long 0x24920600
161CS0WCR_D: .long 0x00000480
162CS4WCR_D: .long 0x00000480
163CS5AWCR_D: .long 0x00000380
Yusuke.Goda94a35362009-03-13 16:08:18 +0900164CS5BWCR_D: .long 0x00000080
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900165CS6AWCR_D: .long 0x00000300
166CS6BWCR_D: .long 0x00000540
167
168CCR_A: .long 0xff00001c
169CCR_D: .long 0x0000090d
170
171SLEEP_CNT: .long 0x00000800
172SR_MASK_D: .long 0xEFFFFF0F