2008-08-31 14:02:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 Nobuhiro Iwamatsu
|
|
|
|
* Copyright (C) 2008 Renesas Solutions Corp.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include <version.h>
|
|
|
|
|
|
|
|
#include <asm/processor.h>
|
2008-12-20 18:29:49 +00:00
|
|
|
#include <asm/macro.h>
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
.global lowlevel_init
|
|
|
|
|
|
|
|
.text
|
|
|
|
.align 2
|
|
|
|
|
|
|
|
lowlevel_init:
|
|
|
|
/* Cache setting */
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CCR1_A ,CCR1_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
/* ConfigurePortPins */
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PECRL3_A, PECRL3_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCCRL4_A, PCCRL4_D0
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PECRL4_A, PECRL4_D0
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PEIORL_A, PEIORL_D0
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCIORL_A, PCIORL_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PFCRH2_A, PFCRH2_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PFCRH3_A, PFCRH3_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PFCRH1_A, PFCRH1_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PFIORH_A, PFIORH_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PECRL1_A, PECRL1_D0
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PEIORL_A, PEIORL_D1
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
/* Configure Operating Frequency */
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 WTCSR_A, WTCSR_D0
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 WTCSR_A, WTCSR_D1
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 WTCNT_A, WTCNT_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
/* Set clock mode*/
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 FRQCR_A, FRQCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
/* Configure Bus And Memory */
|
|
|
|
init_bsc_cs0:
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCCRL4_A, PCCRL4_D1
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PECRL1_A, PECRL1_D1
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CMNCR_A, CMNCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2010-07-22 02:19:17 +00:00
|
|
|
write32 CS0BCR_A, CS0BCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS0WCR_A, CS0WCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
init_bsc_cs1:
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PECRL4_A, PECRL4_D1
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS1WCR_A, CS1WCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
init_sdram:
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCCRL2_A, PCCRL2_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCCRL4_A, PCCRL4_D2
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCCRL1_A, PCCRL1_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write16 PCCRL3_A, PCCRL3_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS3BCR_A, CS3BCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS3WCR_A, CS3WCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 SDCR_A, SDCR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 RTCOR_A, RTCOR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 RTCSR_A, RTCSR_D
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
/* wait 200us */
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l REPEAT_D, r3
|
|
|
|
mov #0, r2
|
2008-08-31 14:02:04 +00:00
|
|
|
repeat0:
|
2008-12-20 18:29:48 +00:00
|
|
|
add #1, r2
|
|
|
|
cmp/hs r3, r2
|
|
|
|
bf repeat0
|
2008-08-31 14:02:04 +00:00
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SDRAM_MODE, r1
|
|
|
|
mov #0, r0
|
|
|
|
mov.l r0, @r1
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
nop
|
|
|
|
rts
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
|
|
|
|
CCR1_A: .long CCR1
|
|
|
|
CCR1_D: .long 0x0000090B
|
|
|
|
PCCRL4_A: .long 0xFFFE3910
|
2010-07-22 02:19:17 +00:00
|
|
|
PCCRL4_D0: .word 0x0000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PECRL4_A: .long 0xFFFE3A10
|
2010-07-22 02:19:17 +00:00
|
|
|
PECRL4_D0: .word 0x0000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PECRL3_A: .long 0xFFFE3A12
|
2010-07-22 02:19:17 +00:00
|
|
|
PECRL3_D: .word 0x0000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PEIORL_A: .long 0xFFFE3A06
|
2010-07-22 02:19:17 +00:00
|
|
|
PEIORL_D0: .word 0x1C00
|
|
|
|
PEIORL_D1: .word 0x1C02
|
2008-08-31 14:02:04 +00:00
|
|
|
PCIORL_A: .long 0xFFFE3906
|
2010-07-22 02:19:17 +00:00
|
|
|
PCIORL_D: .word 0x4000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PFCRH2_A: .long 0xFFFE3A8C
|
2010-07-22 02:19:17 +00:00
|
|
|
PFCRH2_D: .word 0x0000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PFCRH3_A: .long 0xFFFE3A8A
|
2010-07-22 02:19:17 +00:00
|
|
|
PFCRH3_D: .word 0x0000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PFCRH1_A: .long 0xFFFE3A8E
|
2010-07-22 02:19:17 +00:00
|
|
|
PFCRH1_D: .word 0x0000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PFIORH_A: .long 0xFFFE3A84
|
2010-07-22 02:19:17 +00:00
|
|
|
PFIORH_D: .word 0x0729
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PECRL1_A: .long 0xFFFE3A16
|
2010-07-22 02:19:17 +00:00
|
|
|
PECRL1_D0: .word 0x0033
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
WTCSR_A: .long 0xFFFE0000
|
2010-07-22 02:19:17 +00:00
|
|
|
WTCSR_D0: .word 0xA518
|
|
|
|
WTCSR_D1: .word 0xA51D
|
2008-08-31 14:02:04 +00:00
|
|
|
WTCNT_A: .long 0xFFFE0002
|
2010-07-22 02:19:17 +00:00
|
|
|
WTCNT_D: .word 0x5A84
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
FRQCR_A: .long 0xFFFE0010
|
2010-07-22 02:19:17 +00:00
|
|
|
FRQCR_D: .word 0x0104
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
|
2010-07-22 02:19:17 +00:00
|
|
|
PCCRL4_D1: .word 0x0010
|
|
|
|
PECRL1_D1: .word 0x0133
|
2008-08-31 14:02:04 +00:00
|
|
|
|
|
|
|
CMNCR_A: .long 0xFFFC0000
|
|
|
|
CMNCR_D: .long 0x00001810
|
2010-07-22 02:19:17 +00:00
|
|
|
CS0BCR_A: .long 0xFFFC0004
|
|
|
|
CS0BCR_D: .long 0x10000400
|
2008-08-31 14:02:04 +00:00
|
|
|
CS0WCR_A: .long 0xFFFC0028
|
|
|
|
CS0WCR_D: .long 0x00000B41
|
2010-07-22 02:19:17 +00:00
|
|
|
PECRL4_D1: .word 0x0100
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
CS1WCR_A: .long 0xFFFC002C
|
|
|
|
CS1WCR_D: .long 0x00000B01
|
2010-07-22 02:19:17 +00:00
|
|
|
PCCRL4_D2: .word 0x0011
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PCCRL3_A: .long 0xFFFE3912
|
2010-07-22 02:19:17 +00:00
|
|
|
PCCRL3_D: .word 0x0011
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PCCRL2_A: .long 0xFFFE3914
|
2010-07-22 02:19:17 +00:00
|
|
|
PCCRL2_D: .word 0x1111
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PCCRL1_A: .long 0xFFFE3916
|
2010-07-22 02:19:17 +00:00
|
|
|
PCCRL1_D: .word 0x1010
|
2008-08-31 14:02:04 +00:00
|
|
|
PDCRL4_A: .long 0xFFFE3990
|
2010-07-22 02:19:17 +00:00
|
|
|
PDCRL4_D: .word 0x0011
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PDCRL3_A: .long 0xFFFE3992
|
2010-07-22 02:19:17 +00:00
|
|
|
PDCRL3_D: .word 0x00011
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PDCRL2_A: .long 0xFFFE3994
|
2010-07-22 02:19:17 +00:00
|
|
|
PDCRL2_D: .word 0x1111
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
PDCRL1_A: .long 0xFFFE3996
|
2010-07-22 02:19:17 +00:00
|
|
|
PDCRL1_D: .word 0x1000
|
|
|
|
.align 2
|
2008-08-31 14:02:04 +00:00
|
|
|
CS3BCR_A: .long 0xFFFC0010
|
|
|
|
CS3BCR_D: .long 0x00004400
|
|
|
|
CS3WCR_A: .long 0xFFFC0034
|
|
|
|
CS3WCR_D: .long 0x00002892
|
|
|
|
SDCR_A: .long 0xFFFC004C
|
|
|
|
SDCR_D: .long 0x00000809
|
|
|
|
RTCOR_A: .long 0xFFFC0058
|
|
|
|
RTCOR_D: .long 0xA55A0041
|
|
|
|
RTCSR_A: .long 0xFFFC0050
|
|
|
|
RTCSR_D: .long 0xa55a0010
|
|
|
|
|
|
|
|
SDRAM_MODE: .long 0xFFFC5040
|
|
|
|
REPEAT_D: .long 0x00009C40
|