blob: ee472a42ba52a310061ee0965a84222c0a35392b [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>
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +09008
9#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010010#include <asm/macro.h>
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090011
12 .global lowlevel_init
13
14 .text
15 .align 2
16
17lowlevel_init:
18 /* Cache setting */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010019 write32 CCR1_A ,CCR1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090020
21 /* ConfigurePortPins */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010022 write16 PECRL3_A, PECRL3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090023
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010024 write16 PCCRL4_A, PCCRL4_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090025
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010026 write16 PECRL4_A, PECRL4_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090027
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010028 write16 PEIORL_A, PEIORL_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090029
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010030 write16 PCIORL_A, PCIORL_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090031
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010032 write16 PFCRH2_A, PFCRH2_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090033
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010034 write16 PFCRH3_A, PFCRH3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090035
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010036 write16 PFCRH1_A, PFCRH1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090037
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010038 write16 PFIORH_A, PFIORH_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090039
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010040 write16 PECRL1_A, PECRL1_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090041
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010042 write16 PEIORL_A, PEIORL_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090043
44 /* Configure Operating Frequency */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010045 write16 WTCSR_A, WTCSR_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090046
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010047 write16 WTCSR_A, WTCSR_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090048
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010049 write16 WTCNT_A, WTCNT_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090050
51 /* Set clock mode*/
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010052 write16 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090053
54 /* Configure Bus And Memory */
55init_bsc_cs0:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010056 write16 PCCRL4_A, PCCRL4_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090057
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010058 write16 PECRL1_A, PECRL1_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090059
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010060 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090061
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +090062 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090063
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010064 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090065
66init_bsc_cs1:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010067 write16 PECRL4_A, PECRL4_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090068
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010069 write32 CS1WCR_A, CS1WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090070
71init_sdram:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010072 write16 PCCRL2_A, PCCRL2_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090073
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010074 write16 PCCRL4_A, PCCRL4_D2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090075
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010076 write16 PCCRL1_A, PCCRL1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090077
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010078 write16 PCCRL3_A, PCCRL3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090079
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010080 write32 CS3BCR_A, CS3BCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090081
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010082 write32 CS3WCR_A, CS3WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090083
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010084 write32 SDCR_A, SDCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090085
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010086 write32 RTCOR_A, RTCOR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090087
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010088 write32 RTCSR_A, RTCSR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090089
90 /* wait 200us */
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010091 mov.l REPEAT_D, r3
92 mov #0, r2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090093repeat0:
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010094 add #1, r2
95 cmp/hs r3, r2
96 bf repeat0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090097 nop
98
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +010099 mov.l SDRAM_MODE, r1
100 mov #0, r0
101 mov.l r0, @r1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900102
103 nop
104 rts
105
106 .align 4
107
108CCR1_A: .long CCR1
109CCR1_D: .long 0x0000090B
110PCCRL4_A: .long 0xFFFE3910
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900111PCCRL4_D0: .word 0x0000
112.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900113PECRL4_A: .long 0xFFFE3A10
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900114PECRL4_D0: .word 0x0000
115.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900116PECRL3_A: .long 0xFFFE3A12
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900117PECRL3_D: .word 0x0000
118.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900119PEIORL_A: .long 0xFFFE3A06
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900120PEIORL_D0: .word 0x1C00
121PEIORL_D1: .word 0x1C02
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900122PCIORL_A: .long 0xFFFE3906
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900123PCIORL_D: .word 0x4000
124.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900125PFCRH2_A: .long 0xFFFE3A8C
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900126PFCRH2_D: .word 0x0000
127.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900128PFCRH3_A: .long 0xFFFE3A8A
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900129PFCRH3_D: .word 0x0000
130.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900131PFCRH1_A: .long 0xFFFE3A8E
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900132PFCRH1_D: .word 0x0000
133.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900134PFIORH_A: .long 0xFFFE3A84
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900135PFIORH_D: .word 0x0729
136.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900137PECRL1_A: .long 0xFFFE3A16
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900138PECRL1_D0: .word 0x0033
139.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900140
141
142WTCSR_A: .long 0xFFFE0000
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900143WTCSR_D0: .word 0xA518
144WTCSR_D1: .word 0xA51D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900145WTCNT_A: .long 0xFFFE0002
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900146WTCNT_D: .word 0x5A84
147.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900148FRQCR_A: .long 0xFFFE0010
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900149FRQCR_D: .word 0x0104
150.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900151
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900152PCCRL4_D1: .word 0x0010
153PECRL1_D1: .word 0x0133
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900154
155CMNCR_A: .long 0xFFFC0000
156CMNCR_D: .long 0x00001810
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900157CS0BCR_A: .long 0xFFFC0004
158CS0BCR_D: .long 0x10000400
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900159CS0WCR_A: .long 0xFFFC0028
160CS0WCR_D: .long 0x00000B41
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900161PECRL4_D1: .word 0x0100
162.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900163CS1WCR_A: .long 0xFFFC002C
164CS1WCR_D: .long 0x00000B01
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900165PCCRL4_D2: .word 0x0011
166.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900167PCCRL3_A: .long 0xFFFE3912
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900168PCCRL3_D: .word 0x0011
169.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900170PCCRL2_A: .long 0xFFFE3914
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900171PCCRL2_D: .word 0x1111
172.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900173PCCRL1_A: .long 0xFFFE3916
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900174PCCRL1_D: .word 0x1010
Phil Edworthyc4f07be2011-05-31 01:51:42 -0700175.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900176PDCRL4_A: .long 0xFFFE3990
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900177PDCRL4_D: .word 0x0011
178.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900179PDCRL3_A: .long 0xFFFE3992
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900180PDCRL3_D: .word 0x00011
181.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900182PDCRL2_A: .long 0xFFFE3994
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900183PDCRL2_D: .word 0x1111
184.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900185PDCRL1_A: .long 0xFFFE3996
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900186PDCRL1_D: .word 0x1000
187.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900188CS3BCR_A: .long 0xFFFC0010
189CS3BCR_D: .long 0x00004400
190CS3WCR_A: .long 0xFFFC0034
191CS3WCR_D: .long 0x00002892
192SDCR_A: .long 0xFFFC004C
193SDCR_D: .long 0x00000809
194RTCOR_A: .long 0xFFFC0058
195RTCOR_D: .long 0xA55A0041
196RTCSR_A: .long 0xFFFC0050
197RTCSR_D: .long 0xa55a0010
198
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900199SDRAM_MODE: .long 0xFFFC5040
200REPEAT_D: .long 0x00009C40