blob: c8494ccf3864e47f40cf380acb77e3048e9cba7d [file] [log] [blame]
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +09001/*
2 * Copyright (C) 2008 Nobuhiro Iwamatsu
3 * Copyright (C) 2008 Renesas Solutions Corp.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +09006 */
7#include <config.h>
8#include <version.h>
9
10#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010011#include <asm/macro.h>
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090012
13 .global lowlevel_init
14
15 .text
16 .align 2
17
18lowlevel_init:
19 /* Cache setting */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010020 write32 CCR1_A ,CCR1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090021
22 /* ConfigurePortPins */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010023 write16 PECRL3_A, PECRL3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090024
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010025 write16 PCCRL4_A, PCCRL4_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090026
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010027 write16 PECRL4_A, PECRL4_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090028
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010029 write16 PEIORL_A, PEIORL_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090030
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010031 write16 PCIORL_A, PCIORL_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090032
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010033 write16 PFCRH2_A, PFCRH2_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090034
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010035 write16 PFCRH3_A, PFCRH3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090036
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010037 write16 PFCRH1_A, PFCRH1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090038
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010039 write16 PFIORH_A, PFIORH_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090040
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010041 write16 PECRL1_A, PECRL1_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090042
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010043 write16 PEIORL_A, PEIORL_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090044
45 /* Configure Operating Frequency */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010046 write16 WTCSR_A, WTCSR_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090047
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010048 write16 WTCSR_A, WTCSR_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090049
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010050 write16 WTCNT_A, WTCNT_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090051
52 /* Set clock mode*/
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010053 write16 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090054
55 /* Configure Bus And Memory */
56init_bsc_cs0:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010057 write16 PCCRL4_A, PCCRL4_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090058
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010059 write16 PECRL1_A, PECRL1_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090060
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010061 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090062
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +090063 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090064
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010065 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090066
67init_bsc_cs1:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010068 write16 PECRL4_A, PECRL4_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090069
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010070 write32 CS1WCR_A, CS1WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090071
72init_sdram:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010073 write16 PCCRL2_A, PCCRL2_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090074
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010075 write16 PCCRL4_A, PCCRL4_D2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090076
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010077 write16 PCCRL1_A, PCCRL1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090078
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010079 write16 PCCRL3_A, PCCRL3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090080
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010081 write32 CS3BCR_A, CS3BCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090082
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010083 write32 CS3WCR_A, CS3WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090084
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010085 write32 SDCR_A, SDCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090086
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010087 write32 RTCOR_A, RTCOR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090088
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010089 write32 RTCSR_A, RTCSR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090090
91 /* wait 200us */
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010092 mov.l REPEAT_D, r3
93 mov #0, r2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090094repeat0:
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010095 add #1, r2
96 cmp/hs r3, r2
97 bf repeat0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090098 nop
99
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100100 mov.l SDRAM_MODE, r1
101 mov #0, r0
102 mov.l r0, @r1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900103
104 nop
105 rts
106
107 .align 4
108
109CCR1_A: .long CCR1
110CCR1_D: .long 0x0000090B
111PCCRL4_A: .long 0xFFFE3910
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900112PCCRL4_D0: .word 0x0000
113.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900114PECRL4_A: .long 0xFFFE3A10
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900115PECRL4_D0: .word 0x0000
116.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900117PECRL3_A: .long 0xFFFE3A12
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900118PECRL3_D: .word 0x0000
119.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900120PEIORL_A: .long 0xFFFE3A06
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900121PEIORL_D0: .word 0x1C00
122PEIORL_D1: .word 0x1C02
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900123PCIORL_A: .long 0xFFFE3906
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900124PCIORL_D: .word 0x4000
125.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900126PFCRH2_A: .long 0xFFFE3A8C
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900127PFCRH2_D: .word 0x0000
128.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900129PFCRH3_A: .long 0xFFFE3A8A
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900130PFCRH3_D: .word 0x0000
131.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900132PFCRH1_A: .long 0xFFFE3A8E
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900133PFCRH1_D: .word 0x0000
134.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900135PFIORH_A: .long 0xFFFE3A84
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900136PFIORH_D: .word 0x0729
137.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900138PECRL1_A: .long 0xFFFE3A16
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900139PECRL1_D0: .word 0x0033
140.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900141
142
143WTCSR_A: .long 0xFFFE0000
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900144WTCSR_D0: .word 0xA518
145WTCSR_D1: .word 0xA51D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900146WTCNT_A: .long 0xFFFE0002
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900147WTCNT_D: .word 0x5A84
148.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900149FRQCR_A: .long 0xFFFE0010
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900150FRQCR_D: .word 0x0104
151.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900152
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900153PCCRL4_D1: .word 0x0010
154PECRL1_D1: .word 0x0133
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900155
156CMNCR_A: .long 0xFFFC0000
157CMNCR_D: .long 0x00001810
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900158CS0BCR_A: .long 0xFFFC0004
159CS0BCR_D: .long 0x10000400
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900160CS0WCR_A: .long 0xFFFC0028
161CS0WCR_D: .long 0x00000B41
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900162PECRL4_D1: .word 0x0100
163.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900164CS1WCR_A: .long 0xFFFC002C
165CS1WCR_D: .long 0x00000B01
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900166PCCRL4_D2: .word 0x0011
167.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900168PCCRL3_A: .long 0xFFFE3912
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900169PCCRL3_D: .word 0x0011
170.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900171PCCRL2_A: .long 0xFFFE3914
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900172PCCRL2_D: .word 0x1111
173.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900174PCCRL1_A: .long 0xFFFE3916
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900175PCCRL1_D: .word 0x1010
Phil Edworthyc4f07be2011-05-31 01:51:42 -0700176.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900177PDCRL4_A: .long 0xFFFE3990
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900178PDCRL4_D: .word 0x0011
179.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900180PDCRL3_A: .long 0xFFFE3992
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900181PDCRL3_D: .word 0x00011
182.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900183PDCRL2_A: .long 0xFFFE3994
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900184PDCRL2_D: .word 0x1111
185.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900186PDCRL1_A: .long 0xFFFE3996
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900187PDCRL1_D: .word 0x1000
188.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900189CS3BCR_A: .long 0xFFFC0010
190CS3BCR_D: .long 0x00004400
191CS3WCR_A: .long 0xFFFC0034
192CS3WCR_D: .long 0x00002892
193SDCR_A: .long 0xFFFC004C
194SDCR_D: .long 0x00000809
195RTCOR_A: .long 0xFFFC0058
196RTCOR_D: .long 0xA55A0041
197RTCSR_A: .long 0xFFFC0050
198RTCSR_D: .long 0xa55a0010
199
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900200SDRAM_MODE: .long 0xFFFC5040
201REPEAT_D: .long 0x00009C40