2013-11-21 08:06:45 +00:00
|
|
|
/*
|
|
|
|
* arch/arm/cpu/armv7/rmobile/lowlevel_init_ca15.S
|
|
|
|
* This file is lager low level initialize.
|
|
|
|
*
|
2014-03-28 00:43:36 +00:00
|
|
|
* Copyright (C) 2013, 2014 Renesas Electronics Corporation
|
2013-11-21 08:06:45 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
|
|
|
|
ENTRY(lowlevel_init)
|
|
|
|
mrc p15, 0, r4, c0, c0, 5 /* mpidr */
|
|
|
|
orr r4, r4, r4, lsr #6
|
|
|
|
and r4, r4, #7 /* id 0-3 = ca15.0,1,2,3 */
|
|
|
|
|
|
|
|
b do_lowlevel_init
|
|
|
|
|
|
|
|
.pool
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CPU ID #1-#3 come here
|
|
|
|
*/
|
|
|
|
.align 4
|
|
|
|
do_cpu_waiting:
|
|
|
|
ldr r1, =0xe6180000 /* sysc */
|
|
|
|
1: ldr r0, [r1, #0x20] /* sbar */
|
|
|
|
tst r0, r0
|
|
|
|
beq 1b
|
|
|
|
bx r0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Only CPU ID #0 comes here
|
|
|
|
*/
|
|
|
|
.align 4
|
|
|
|
do_lowlevel_init:
|
2014-08-07 23:44:02 +00:00
|
|
|
ldr r2, =0xFF000044 /* PRR */
|
|
|
|
ldr r1, [r2]
|
|
|
|
and r1, r1, #0x7F00
|
|
|
|
lsrs r1, r1, #8
|
|
|
|
cmp r1, #0x4C /* 0x4C is ID of r8a7794 */
|
2015-01-23 00:31:57 +00:00
|
|
|
beq _enable_actlr_smp
|
2014-08-07 23:44:02 +00:00
|
|
|
|
2013-11-21 08:06:45 +00:00
|
|
|
/* surpress wfe if ca15 */
|
2014-03-28 00:43:36 +00:00
|
|
|
tst r4, #4
|
2013-11-21 08:06:45 +00:00
|
|
|
mrceq p15, 0, r0, c1, c0, 1 /* actlr */
|
|
|
|
orreq r0, r0, #(1<<7)
|
|
|
|
mcreq p15, 0, r0, c1, c0, 1
|
2014-03-28 00:43:36 +00:00
|
|
|
|
2013-11-21 08:06:45 +00:00
|
|
|
/* and set l2 latency */
|
2014-03-28 00:43:36 +00:00
|
|
|
mrc p15, 0, r0, c0, c0, 5 /* r0 = MPIDR */
|
|
|
|
and r0, r0, #0xf00
|
|
|
|
lsr r0, r0, #8
|
|
|
|
tst r0, #1 /* only need for cluster 0 */
|
|
|
|
bne _exit_init_l2_a15
|
|
|
|
|
|
|
|
mrc p15, 1, r0, c9, c0, 2 /* r0 = L2CTLR */
|
|
|
|
and r1, r0, #7
|
|
|
|
cmp r1, #3 /* has already been set up */
|
|
|
|
bicne r0, r0, #0xe7
|
|
|
|
orrne r0, r0, #0x83 /* L2CTLR[7:6] + L2CTLR[2:0] */
|
2014-10-31 07:07:16 +00:00
|
|
|
#if defined(CONFIG_R8A7790)
|
2014-08-07 23:41:15 +00:00
|
|
|
orrne r0, r0, #0x20 /* L2CTLR[5] */
|
2014-10-31 07:07:16 +00:00
|
|
|
#endif
|
2014-03-28 00:43:36 +00:00
|
|
|
mcrne p15, 1, r0, c9, c0, 2
|
2015-01-23 00:31:57 +00:00
|
|
|
|
|
|
|
b _exit_init_l2_a15
|
|
|
|
|
|
|
|
_enable_actlr_smp: /* R8A7794 only (CA7) */
|
|
|
|
#ifndef CONFIG_DCACHE_OFF
|
|
|
|
mrc p15, 0, r0, c1, c0, 1
|
|
|
|
orr r0, r0, #0x40
|
|
|
|
mcr p15, 0, r0, c1, c0, 1
|
|
|
|
#endif
|
|
|
|
|
2014-03-28 00:43:36 +00:00
|
|
|
_exit_init_l2_a15:
|
2013-11-21 08:06:45 +00:00
|
|
|
ldr r3, =(CONFIG_SYS_INIT_SP_ADDR)
|
|
|
|
sub sp, r3, #4
|
|
|
|
str lr, [sp]
|
|
|
|
|
|
|
|
/* initialize system */
|
|
|
|
bl s_init
|
|
|
|
|
|
|
|
ldr lr, [sp]
|
|
|
|
mov pc, lr
|
|
|
|
nop
|
|
|
|
ENDPROC(lowlevel_init)
|
|
|
|
.ltorg
|