blob: f82dd7dc05b005c0b98b2191976dc4db9238968d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +09002/*
3 * Copyright (C) 2008 Nobuhiro Iwamatsu
4 * Copyright (C) 2008 Renesas Solutions Corp.
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +09005 */
6#include <config.h>
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +09007
8#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +01009#include <asm/macro.h>
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090010
11 .global lowlevel_init
12
13 .text
14 .align 2
15
16lowlevel_init:
17 /* Cache setting */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010018 write32 CCR1_A ,CCR1_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090019
20 /* ConfigurePortPins */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010021 write16 PECRL3_A, PECRL3_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090022
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010023 write16 PCCRL4_A, PCCRL4_D0
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090024
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010025 write16 PECRL4_A, PECRL4_D0
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090026
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010027 write16 PEIORL_A, PEIORL_D0
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090028
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010029 write16 PCIORL_A, PCIORL_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090030
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010031 write16 PFCRH2_A, PFCRH2_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090032
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010033 write16 PFCRH3_A, PFCRH3_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090034
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010035 write16 PFCRH1_A, PFCRH1_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090036
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010037 write16 PFIORH_A, PFIORH_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090038
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010039 write16 PECRL1_A, PECRL1_D0
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090040
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010041 write16 PEIORL_A, PEIORL_D1
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090042
43 /* Configure Operating Frequency */
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010044 write16 WTCSR_A, WTCSR_D0
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090045
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010046 write16 WTCSR_A, WTCSR_D1
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090047
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010048 write16 WTCNT_A, WTCNT_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090049
50 /* Set clock mode*/
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010051 write16 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090052
53 /* Configure Bus And Memory */
54init_bsc_cs0:
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010055 write16 PCCRL4_A, PCCRL4_D1
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090056
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010057 write16 PECRL1_A, PECRL1_D1
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090058
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010059 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090060
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +090061 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090062
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010063 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090064
65init_bsc_cs1:
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010066 write16 PECRL4_A, PECRL4_D1
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090067
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010068 write32 CS1WCR_A, CS1WCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090069
70init_sdram:
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010071 write16 PCCRL2_A, PCCRL2_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090072
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010073 write16 PCCRL4_A, PCCRL4_D2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090074
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010075 write16 PCCRL1_A, PCCRL1_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090076
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010077 write16 PCCRL3_A, PCCRL3_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090078
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010079 write32 CS3BCR_A, CS3BCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090080
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010081 write32 CS3WCR_A, CS3WCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090082
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010083 write32 SDCR_A, SDCR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090084
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010085 write32 RTCOR_A, RTCOR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090086
Jean-Christophe PLAGNIOL-VILLARDb9c21722008-12-20 19:29:49 +010087 write32 RTCSR_A, RTCSR_D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090088
89 /* wait 200us */
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010090 mov.l REPEAT_D, r3
91 mov #0, r2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090092repeat0:
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010093 add #1, r2
94 cmp/hs r3, r2
95 bf repeat0
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090096 nop
97
Jean-Christophe PLAGNIOL-VILLARDbd963702008-12-20 19:29:48 +010098 mov.l SDRAM_MODE, r1
99 mov #0, r0
100 mov.l r0, @r1
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900101
102 nop
103 rts
104
105 .align 4
106
107CCR1_A: .long CCR1
108CCR1_D: .long 0x0000090B
109PCCRL4_A: .long 0xFFFE3910
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900110PCCRL4_D0: .word 0x0000
111.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900112PECRL4_A: .long 0xFFFE3A10
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900113PECRL4_D0: .word 0x0000
114.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900115PECRL3_A: .long 0xFFFE3A12
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900116PECRL3_D: .word 0x0000
117.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900118PEIORL_A: .long 0xFFFE3A06
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900119PEIORL_D0: .word 0x1C00
120PEIORL_D1: .word 0x1C02
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900121PCIORL_A: .long 0xFFFE3906
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900122PCIORL_D: .word 0x4000
123.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900124PFCRH2_A: .long 0xFFFE3A8C
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900125PFCRH2_D: .word 0x0000
126.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900127PFCRH3_A: .long 0xFFFE3A8A
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900128PFCRH3_D: .word 0x0000
129.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900130PFCRH1_A: .long 0xFFFE3A8E
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900131PFCRH1_D: .word 0x0000
132.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900133PFIORH_A: .long 0xFFFE3A84
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900134PFIORH_D: .word 0x0729
135.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900136PECRL1_A: .long 0xFFFE3A16
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900137PECRL1_D0: .word 0x0033
138.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900139
140
141WTCSR_A: .long 0xFFFE0000
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900142WTCSR_D0: .word 0xA518
143WTCSR_D1: .word 0xA51D
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900144WTCNT_A: .long 0xFFFE0002
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900145WTCNT_D: .word 0x5A84
146.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900147FRQCR_A: .long 0xFFFE0010
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900148FRQCR_D: .word 0x0104
149.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900150
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900151PCCRL4_D1: .word 0x0010
152PECRL1_D1: .word 0x0133
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900153
154CMNCR_A: .long 0xFFFC0000
155CMNCR_D: .long 0x00001810
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900156CS0BCR_A: .long 0xFFFC0004
157CS0BCR_D: .long 0x10000400
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900158CS0WCR_A: .long 0xFFFC0028
159CS0WCR_D: .long 0x00000B41
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900160PECRL4_D1: .word 0x0100
161.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900162CS1WCR_A: .long 0xFFFC002C
163CS1WCR_D: .long 0x00000B01
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900164PCCRL4_D2: .word 0x0011
165.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900166PCCRL3_A: .long 0xFFFE3912
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900167PCCRL3_D: .word 0x0011
168.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900169PCCRL2_A: .long 0xFFFE3914
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900170PCCRL2_D: .word 0x1111
171.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900172PCCRL1_A: .long 0xFFFE3916
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900173PCCRL1_D: .word 0x1010
Phil Edworthy542f75c2011-05-31 01:51:42 -0700174.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900175PDCRL4_A: .long 0xFFFE3990
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900176PDCRL4_D: .word 0x0011
177.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900178PDCRL3_A: .long 0xFFFE3992
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900179PDCRL3_D: .word 0x00011
180.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900181PDCRL2_A: .long 0xFFFE3994
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900182PDCRL2_D: .word 0x1111
183.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900184PDCRL1_A: .long 0xFFFE3996
Nobuhiro Iwamatsud398fca2010-07-22 11:19:17 +0900185PDCRL1_D: .word 0x1000
186.align 2
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900187CS3BCR_A: .long 0xFFFC0010
188CS3BCR_D: .long 0x00004400
189CS3WCR_A: .long 0xFFFC0034
190CS3WCR_D: .long 0x00002892
191SDCR_A: .long 0xFFFC004C
192SDCR_D: .long 0x00000809
193RTCOR_A: .long 0xFFFC0058
194RTCOR_D: .long 0xA55A0041
195RTCSR_A: .long 0xFFFC0050
196RTCSR_D: .long 0xa55a0010
197
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +0900198SDRAM_MODE: .long 0xFFFC5040
199REPEAT_D: .long 0x00009C40