blob: 867ca51225b43bd7388116f4816a103e61318fd9 [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>
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090011#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010012#include <asm/macro.h>
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090013
14/*
15 * Board specific low level init code, called _very_ early in the
16 * startup sequence. Relocation to SDRAM has not happened yet, no
17 * stack is available, bss section has not been initialised, etc.
18 *
19 * (Note: As no stack is available, no subroutines can be called...).
20 */
21
22 .global lowlevel_init
23
24 .text
25 .align 2
26
27lowlevel_init:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010028 write16 DRVCRA_A, DRVCRA_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090029
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010030 write16 DRVCRB_A, DRVCRB_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090031
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010032 write16 RWTCSR_A, RWTCSR_D1
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090033
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010034 write16 RWTCNT_A, RWTCNT_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090035
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010036 write16 RWTCSR_A, RWTCSR_D2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090037
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010038 write32 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090039
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010040 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090041
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010042 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090043
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010044 write32 CS4BCR_A, CS4BCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090045
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010046 write32 CS5ABCR_A, CS5ABCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090047
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010048 write32 CS5BBCR_A, CS5BBCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090049
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010050 write32 CS6ABCR_A, CS6ABCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090051
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010052 write32 CS6BBCR_A, CS6BBCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090053
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010054 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090055
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010056 write32 CS4WCR_A, CS4WCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090057
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010058 write32 CS5AWCR_A, CS5AWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090059
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010060 write32 CS5BWCR_A, CS5BWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090061
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010062 write32 CS6AWCR_A, CS6AWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090063
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010064 write32 CS6BWCR_A, CS6BWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090065
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010066 write32 SBSC_SDCR_A, SBSC_SDCR_D1
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090067
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010068 write32 SBSC_SDWCR_A, SBSC_SDWCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090069
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010070 write32 SBSC_SDPCR_A, SBSC_SDPCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090071
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010072 write32 SBSC_RTCSR_A, SBSC_RTCSR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090073
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010074 write32 SBSC_RTCNT_A, SBSC_RTCNT_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090075
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010076 write32 SBSC_RTCOR_A, SBSC_RTCOR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090077
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010078 write8 SBSC_SDMR3_A1, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090079
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010080 write8 SBSC_SDMR3_A2, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090081
82 mov.l SLEEP_CNT, r1
832: tst r1, r1
84 nop
85 bf/s 2b
86 dt r1
87
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010088 write8 SBSC_SDMR3_A3, SBSC_SDMR3_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090089
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010090 write32 SBSC_SDCR_A, SBSC_SDCR_D2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090091
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010092 write32 CCR_A, CCR_D
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090093
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010094 ! BL bit off (init = ON) (?!?)
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +090095
96 stc sr, r0 ! BL bit off(init=ON)
97 mov.l SR_MASK_D, r1
98 and r1, r0
99 ldc r0, sr
100
101 rts
102 mov #0, r0
103
104 .align 2
105
106DRVCRA_A: .long DRVCRA
107DRVCRB_A: .long DRVCRB
Nobuhiro Iwamatsue77ff552010-07-22 15:22:10 +0900108DRVCRA_D: .word 0x4555
109DRVCRB_D: .word 0x0005
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900110
111RWTCSR_A: .long RWTCSR
112RWTCNT_A: .long RWTCNT
113FRQCR_A: .long FRQCR
Nobuhiro Iwamatsue77ff552010-07-22 15:22:10 +0900114RWTCSR_D1: .word 0xa507
115RWTCSR_D2: .word 0xa504
116RWTCNT_D: .word 0x5a00
Nobuhiro Iwamatsu72d5cdb2010-07-22 16:04:08 +0900117.align 2
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900118FRQCR_D: .long 0x0b04474a
119
120SBSC_SDCR_A: .long SBSC_SDCR
121SBSC_SDWCR_A: .long SBSC_SDWCR
122SBSC_SDPCR_A: .long SBSC_SDPCR
123SBSC_RTCSR_A: .long SBSC_RTCSR
124SBSC_RTCNT_A: .long SBSC_RTCNT
125SBSC_RTCOR_A: .long SBSC_RTCOR
126SBSC_SDMR3_A1: .long 0xfe510000
127SBSC_SDMR3_A2: .long 0xfe500242
128SBSC_SDMR3_A3: .long 0xfe5c0042
129
130SBSC_SDCR_D1: .long 0x92810112
131SBSC_SDCR_D2: .long 0x92810912
132SBSC_SDWCR_D: .long 0x05162482
133SBSC_SDPCR_D: .long 0x00300087
134SBSC_RTCSR_D: .long 0xa55a0212
135SBSC_RTCNT_D: .long 0xa55a0000
136SBSC_RTCOR_D: .long 0xa55a0040
137SBSC_SDMR3_D: .long 0x00
138
139CMNCR_A: .long CMNCR
140CS0BCR_A: .long CS0BCR
141CS4BCR_A: .long CS4BCR
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100142CS5ABCR_A: .long CS5ABCR
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900143CS5BBCR_A: .long CS5BBCR
144CS6ABCR_A: .long CS6ABCR
145CS6BBCR_A: .long CS6BBCR
146CS0WCR_A: .long CS0WCR
147CS4WCR_A: .long CS4WCR
148CS5AWCR_A: .long CS5AWCR
149CS5BWCR_A: .long CS5BWCR
150CS6AWCR_A: .long CS6AWCR
151CS6BWCR_A: .long CS6BWCR
152
153CMNCR_D: .long 0x00000013
154CS0BCR_D: .long 0x24920400
155CS4BCR_D: .long 0x24920400
156CS5ABCR_D: .long 0x24920400
157CS5BBCR_D: .long 0x7fff0600
158CS6ABCR_D: .long 0x24920400
159CS6BBCR_D: .long 0x24920600
160CS0WCR_D: .long 0x00000480
161CS4WCR_D: .long 0x00000480
162CS5AWCR_D: .long 0x00000380
Yusuke.Goda94a35362009-03-13 16:08:18 +0900163CS5BWCR_D: .long 0x00000080
Nobuhiro Iwamatsu6f0da492008-08-22 17:39:09 +0900164CS6AWCR_D: .long 0x00000300
165CS6BWCR_D: .long 0x00000540
166
167CCR_A: .long 0xff00001c
168CCR_D: .long 0x0000090d
169
170SLEEP_CNT: .long 0x00000800
171SR_MASK_D: .long 0xEFFFFF0F