2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2008-03-11 03:55:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007,2008 Nobuhiro Iwamatsu
|
|
|
|
*
|
|
|
|
* u-boot/board/r7780mp/lowlevel_init.S
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <asm/processor.h>
|
2008-12-20 18:29:49 +00:00
|
|
|
#include <asm/macro.h>
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/*
|
2008-12-20 18:29:48 +00:00
|
|
|
* Board specific low level init code, called _very_ early in the
|
|
|
|
* startup sequence. Relocation to SDRAM has not happened yet, no
|
|
|
|
* stack is available, bss section has not been initialised, etc.
|
2008-03-11 03:55:12 +00:00
|
|
|
*
|
2008-12-20 18:29:48 +00:00
|
|
|
* (Note: As no stack is available, no subroutines can be called...).
|
2008-03-11 03:55:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
.global lowlevel_init
|
|
|
|
|
|
|
|
.text
|
|
|
|
.align 2
|
|
|
|
|
|
|
|
lowlevel_init:
|
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CCR_A, CCR_D /* Address of Cache Control Register */
|
|
|
|
/* Instruction Cache Invalidate */
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 FRQCR_A, FRQCR_D /* Frequency control register */
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/* pin_multi_setting */
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMMR_A, BBG_PMMR_D_PMSR1
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMSR1_A, BBG_PMSR1_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMMR_A, BBG_PMMR_D_PMSR2
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMSR2_A, BBG_PMSR2_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMMR_A, BBG_PMMR_D_PMSR3
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMSR3_A, BBG_PMSR3_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMMR_A, BBG_PMMR_D_PMSR4
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMSR4_A, BBG_PMSR4_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMMR_A, BBG_PMMR_D_PMSRG
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BBG_PMSRG_A, BBG_PMSRG_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/* cpg_setting */
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 FRQCR_A, FRQCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 DLLCSR_A, DLLCSR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
|
|
|
/* wait 200us */
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l REPEAT0_R3, r3
|
|
|
|
mov #0, r2
|
2008-03-11 03:55:12 +00:00
|
|
|
repeat0:
|
2008-12-20 18:29:48 +00:00
|
|
|
add #1, r2
|
|
|
|
cmp/hs r3, r2
|
|
|
|
bf repeat0
|
2008-03-11 03:55:12 +00:00
|
|
|
nop
|
|
|
|
|
|
|
|
/* bsc_setting */
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 MMSELR_A, MMSELR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 BCR_A, BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS0BCR_A, CS0BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS1BCR_A, CS1BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS2BCR_A, CS2BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS4BCR_A, CS4BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS5BCR_A, CS5BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS6BCR_A, CS6BCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS0WCR_A, CS0WCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS1WCR_A, CS1WCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS2WCR_A, CS2WCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS4WCR_A, CS4WCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS5WCR_A, CS5WCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS6WCR_A, CS6WCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS5PCR_A, CS5PCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:49 +00:00
|
|
|
write32 CS6PCR_A, CS6PCR_D
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/* ddr_setting */
|
|
|
|
/* wait 200us */
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l REPEAT0_R3, r3
|
|
|
|
mov #0, r2
|
2008-03-11 03:55:12 +00:00
|
|
|
repeat1:
|
2008-12-20 18:29:48 +00:00
|
|
|
add #1, r2
|
|
|
|
cmp/hs r3, r2
|
|
|
|
bf repeat1
|
2008-03-11 03:55:12 +00:00
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l MIM_U_A, r0
|
|
|
|
mov.l MIM_U_D, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l MIM_L_A, r0
|
|
|
|
mov.l MIM_L_D0, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l STR_L_A, r0
|
|
|
|
mov.l STR_L_D, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SDR_L_A, r0
|
|
|
|
mov.l SDR_L_D, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SCR_L_A, r0
|
|
|
|
mov.l SCR_L_D0, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SCR_L_A, r0
|
|
|
|
mov.l SCR_L_D1, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l EMRS_A, r0
|
|
|
|
mov.l EMRS_D, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l MRS1_A, r0
|
|
|
|
mov.l MRS1_D, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SCR_L_A, r0
|
|
|
|
mov.l SCR_L_D2, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SCR_L_A, r0
|
|
|
|
mov.l SCR_L_D3, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SCR_L_A, r0
|
|
|
|
mov.l SCR_L_D4, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l MRS2_A, r0
|
|
|
|
mov.l MRS2_D, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l SCR_L_A, r0
|
|
|
|
mov.l SCR_L_D5, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
/* wait 200us */
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l REPEAT0_R1, r3
|
|
|
|
mov #0, r2
|
2008-03-11 03:55:12 +00:00
|
|
|
repeat2:
|
2008-12-20 18:29:48 +00:00
|
|
|
add #1, r2
|
|
|
|
cmp/hs r3, r2
|
|
|
|
bf repeat2
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
synco
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l MIM_L_A, r0
|
|
|
|
mov.l MIM_L_D1, r1
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
2008-12-20 18:29:48 +00:00
|
|
|
mov.l r1, @r0
|
2008-03-11 03:55:12 +00:00
|
|
|
synco
|
|
|
|
|
|
|
|
rts
|
|
|
|
nop
|
|
|
|
.align 4
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
RWTCSR_D_1: .word 0xA507
|
|
|
|
RWTCSR_D_2: .word 0xA507
|
|
|
|
RWTCNT_D: .word 0x5A00
|
2008-09-18 10:34:36 +00:00
|
|
|
.align 2
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
BBG_PMMR_A: .long 0xFF800010
|
|
|
|
BBG_PMSR1_A: .long 0xFF800014
|
|
|
|
BBG_PMSR2_A: .long 0xFF800018
|
|
|
|
BBG_PMSR3_A: .long 0xFF80001C
|
|
|
|
BBG_PMSR4_A: .long 0xFF800020
|
|
|
|
BBG_PMSRG_A: .long 0xFF800024
|
|
|
|
|
|
|
|
BBG_PMMR_D_PMSR1: .long 0xffffbffd
|
|
|
|
BBG_PMSR1_D: .long 0x00004002
|
|
|
|
BBG_PMMR_D_PMSR2: .long 0xfc21a7ff
|
|
|
|
BBG_PMSR2_D: .long 0x03de5800
|
|
|
|
BBG_PMMR_D_PMSR3: .long 0xfffffff8
|
|
|
|
BBG_PMSR3_D: .long 0x00000007
|
|
|
|
BBG_PMMR_D_PMSR4: .long 0xdffdfff9
|
|
|
|
BBG_PMSR4_D: .long 0x20020006
|
|
|
|
BBG_PMMR_D_PMSRG: .long 0xffffffff
|
|
|
|
BBG_PMSRG_D: .long 0x00000000
|
|
|
|
|
|
|
|
FRQCR_A: .long FRQCR
|
|
|
|
DLLCSR_A: .long 0xffc40010
|
|
|
|
FRQCR_D: .long 0x40233035
|
|
|
|
DLLCSR_D: .long 0x00000000
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/* for DDR-SDRAM */
|
2008-12-20 18:29:48 +00:00
|
|
|
MIM_U_A: .long MIM_1
|
|
|
|
MIM_L_A: .long MIM_2
|
|
|
|
SCR_U_A: .long SCR_1
|
|
|
|
SCR_L_A: .long SCR_2
|
|
|
|
STR_U_A: .long STR_1
|
|
|
|
STR_L_A: .long STR_2
|
|
|
|
SDR_U_A: .long SDR_1
|
|
|
|
SDR_L_A: .long SDR_2
|
|
|
|
|
|
|
|
EMRS_A: .long 0xFEC02000
|
|
|
|
MRS1_A: .long 0xFEC00B08
|
|
|
|
MRS2_A: .long 0xFEC00308
|
|
|
|
|
|
|
|
MIM_U_D: .long 0x00004000
|
|
|
|
MIM_L_D0: .long 0x03e80009
|
|
|
|
MIM_L_D1: .long 0x03e80209
|
|
|
|
SCR_L_D0: .long 0x3
|
|
|
|
SCR_L_D1: .long 0x2
|
|
|
|
SCR_L_D2: .long 0x2
|
|
|
|
SCR_L_D3: .long 0x4
|
|
|
|
SCR_L_D4: .long 0x4
|
|
|
|
SCR_L_D5: .long 0x0
|
|
|
|
STR_L_D: .long 0x000f0000
|
|
|
|
SDR_L_D: .long 0x00000400
|
|
|
|
EMRS_D: .long 0x0
|
|
|
|
MRS1_D: .long 0x0
|
|
|
|
MRS2_D: .long 0x0
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/* Cache Controller */
|
2008-12-20 18:29:48 +00:00
|
|
|
CCR_A: .long CCR
|
|
|
|
MMUCR_A: .long MMUCR
|
|
|
|
RWTCNT_A: .long WTCNT
|
2008-03-11 03:55:12 +00:00
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
CCR_D: .long 0x0000090b
|
|
|
|
CCR_D_2: .long 0x00000103
|
|
|
|
MMUCR_D: .long 0x00000004
|
|
|
|
MSTPCR0_D: .long 0x00001001
|
|
|
|
MSTPCR2_D: .long 0xffffffff
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
/* local Bus State Controller */
|
2008-12-20 18:29:48 +00:00
|
|
|
MMSELR_A: .long MMSELR
|
|
|
|
BCR_A: .long BCR
|
|
|
|
CS0BCR_A: .long CS0BCR
|
|
|
|
CS1BCR_A: .long CS1BCR
|
|
|
|
CS2BCR_A: .long CS2BCR
|
|
|
|
CS4BCR_A: .long CS4BCR
|
|
|
|
CS5BCR_A: .long CS5BCR
|
|
|
|
CS6BCR_A: .long CS6BCR
|
|
|
|
CS0WCR_A: .long CS0WCR
|
|
|
|
CS1WCR_A: .long CS1WCR
|
|
|
|
CS2WCR_A: .long CS2WCR
|
|
|
|
CS4WCR_A: .long CS4WCR
|
|
|
|
CS5WCR_A: .long CS5WCR
|
|
|
|
CS6WCR_A: .long CS6WCR
|
|
|
|
CS5PCR_A: .long CS5PCR
|
|
|
|
CS6PCR_A: .long CS6PCR
|
2008-03-11 03:55:12 +00:00
|
|
|
|
|
|
|
MMSELR_D: .long 0xA5A50003
|
|
|
|
BCR_D: .long 0x00000000
|
|
|
|
CS0BCR_D: .long 0x77777770
|
|
|
|
CS1BCR_D: .long 0x77777670
|
|
|
|
CS2BCR_D: .long 0x77777770
|
|
|
|
CS4BCR_D: .long 0x77777770
|
|
|
|
CS5BCR_D: .long 0x77777670
|
|
|
|
CS6BCR_D: .long 0x77777770
|
|
|
|
CS0WCR_D: .long 0x00020006
|
|
|
|
CS1WCR_D: .long 0x00232304
|
|
|
|
CS2WCR_D: .long 0x7777770F
|
|
|
|
CS4WCR_D: .long 0x7777770F
|
|
|
|
CS5WCR_D: .long 0x00101006
|
|
|
|
CS6WCR_D: .long 0x77777703
|
|
|
|
CS5PCR_D: .long 0x77000000
|
|
|
|
CS6PCR_D: .long 0x77000000
|
|
|
|
|
2008-12-20 18:29:48 +00:00
|
|
|
REPEAT0_R3: .long 0x00002000
|
|
|
|
REPEAT0_R1: .long 0x0000200
|