blob: ef4e3419c1cbc4e47edfb3bec950525234e21922 [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 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
19 */
20#include <config.h>
21#include <version.h>
22
23#include <asm/processor.h>
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010024#include <asm/macro.h>
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090025
26 .global lowlevel_init
27
28 .text
29 .align 2
30
31lowlevel_init:
32 /* Cache setting */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010033 write32 CCR1_A ,CCR1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090034
35 /* ConfigurePortPins */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010036 write16 PECRL3_A, PECRL3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090037
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010038 write16 PCCRL4_A, PCCRL4_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090039
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010040 write16 PECRL4_A, PECRL4_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090041
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010042 write16 PEIORL_A, PEIORL_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090043
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010044 write16 PCIORL_A, PCIORL_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090045
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010046 write16 PFCRH2_A, PFCRH2_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090047
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010048 write16 PFCRH3_A, PFCRH3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090049
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010050 write16 PFCRH1_A, PFCRH1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090051
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010052 write16 PFIORH_A, PFIORH_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090053
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010054 write16 PECRL1_A, PECRL1_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090055
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010056 write16 PEIORL_A, PEIORL_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090057
58 /* Configure Operating Frequency */
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010059 write16 WTCSR_A, WTCSR_D0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090060
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010061 write16 WTCSR_A, WTCSR_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090062
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010063 write16 WTCNT_A, WTCNT_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090064
65 /* Set clock mode*/
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010066 write16 FRQCR_A, FRQCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090067
68 /* Configure Bus And Memory */
69init_bsc_cs0:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010070 write16 PCCRL4_A, PCCRL4_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090071
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010072 write16 PECRL1_A, PECRL1_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090073
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010074 write32 CMNCR_A, CMNCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090075
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +090076 write32 CS0BCR_A, CS0BCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090077
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010078 write32 CS0WCR_A, CS0WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090079
80init_bsc_cs1:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010081 write16 PECRL4_A, PECRL4_D1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090082
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010083 write32 CS1WCR_A, CS1WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090084
85init_sdram:
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010086 write16 PCCRL2_A, PCCRL2_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090087
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010088 write16 PCCRL4_A, PCCRL4_D2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090089
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010090 write16 PCCRL1_A, PCCRL1_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090091
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010092 write16 PCCRL3_A, PCCRL3_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090093
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010094 write32 CS3BCR_A, CS3BCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090095
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010096 write32 CS3WCR_A, CS3WCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090097
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +010098 write32 SDCR_A, SDCR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +090099
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100100 write32 RTCOR_A, RTCOR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900101
Jean-Christophe PLAGNIOL-VILLARDf7e78f32008-12-20 19:29:49 +0100102 write32 RTCSR_A, RTCSR_D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900103
104 /* wait 200us */
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100105 mov.l REPEAT_D, r3
106 mov #0, r2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900107repeat0:
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100108 add #1, r2
109 cmp/hs r3, r2
110 bf repeat0
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900111 nop
112
Jean-Christophe PLAGNIOL-VILLARDe4430772008-12-20 19:29:48 +0100113 mov.l SDRAM_MODE, r1
114 mov #0, r0
115 mov.l r0, @r1
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900116
117 nop
118 rts
119
120 .align 4
121
122CCR1_A: .long CCR1
123CCR1_D: .long 0x0000090B
124PCCRL4_A: .long 0xFFFE3910
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900125PCCRL4_D0: .word 0x0000
126.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900127PECRL4_A: .long 0xFFFE3A10
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900128PECRL4_D0: .word 0x0000
129.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900130PECRL3_A: .long 0xFFFE3A12
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900131PECRL3_D: .word 0x0000
132.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900133PEIORL_A: .long 0xFFFE3A06
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900134PEIORL_D0: .word 0x1C00
135PEIORL_D1: .word 0x1C02
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900136PCIORL_A: .long 0xFFFE3906
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900137PCIORL_D: .word 0x4000
138.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900139PFCRH2_A: .long 0xFFFE3A8C
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900140PFCRH2_D: .word 0x0000
141.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900142PFCRH3_A: .long 0xFFFE3A8A
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900143PFCRH3_D: .word 0x0000
144.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900145PFCRH1_A: .long 0xFFFE3A8E
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900146PFCRH1_D: .word 0x0000
147.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900148PFIORH_A: .long 0xFFFE3A84
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900149PFIORH_D: .word 0x0729
150.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900151PECRL1_A: .long 0xFFFE3A16
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900152PECRL1_D0: .word 0x0033
153.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900154
155
156WTCSR_A: .long 0xFFFE0000
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900157WTCSR_D0: .word 0xA518
158WTCSR_D1: .word 0xA51D
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900159WTCNT_A: .long 0xFFFE0002
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900160WTCNT_D: .word 0x5A84
161.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900162FRQCR_A: .long 0xFFFE0010
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900163FRQCR_D: .word 0x0104
164.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900165
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900166PCCRL4_D1: .word 0x0010
167PECRL1_D1: .word 0x0133
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900168
169CMNCR_A: .long 0xFFFC0000
170CMNCR_D: .long 0x00001810
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900171CS0BCR_A: .long 0xFFFC0004
172CS0BCR_D: .long 0x10000400
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900173CS0WCR_A: .long 0xFFFC0028
174CS0WCR_D: .long 0x00000B41
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900175PECRL4_D1: .word 0x0100
176.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900177CS1WCR_A: .long 0xFFFC002C
178CS1WCR_D: .long 0x00000B01
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900179PCCRL4_D2: .word 0x0011
180.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900181PCCRL3_A: .long 0xFFFE3912
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900182PCCRL3_D: .word 0x0011
183.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900184PCCRL2_A: .long 0xFFFE3914
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900185PCCRL2_D: .word 0x1111
186.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900187PCCRL1_A: .long 0xFFFE3916
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900188PCCRL1_D: .word 0x1010
Phil Edworthyc4f07be2011-05-31 01:51:42 -0700189.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900190PDCRL4_A: .long 0xFFFE3990
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900191PDCRL4_D: .word 0x0011
192.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900193PDCRL3_A: .long 0xFFFE3992
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900194PDCRL3_D: .word 0x00011
195.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900196PDCRL2_A: .long 0xFFFE3994
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900197PDCRL2_D: .word 0x1111
198.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900199PDCRL1_A: .long 0xFFFE3996
Nobuhiro Iwamatsued56fb12010-07-22 11:19:17 +0900200PDCRL1_D: .word 0x1000
201.align 2
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900202CS3BCR_A: .long 0xFFFC0010
203CS3BCR_D: .long 0x00004400
204CS3WCR_A: .long 0xFFFC0034
205CS3WCR_D: .long 0x00002892
206SDCR_A: .long 0xFFFC004C
207SDCR_D: .long 0x00000809
208RTCOR_A: .long 0xFFFC0058
209RTCOR_D: .long 0xA55A0041
210RTCSR_A: .long 0xFFFC0050
211RTCSR_D: .long 0xa55a0010
212
Nobuhiro Iwamatsuc655fad2008-08-31 23:02:04 +0900213SDRAM_MODE: .long 0xFFFC5040
214REPEAT_D: .long 0x00009C40