Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
65954be7
Unverified
Commit
65954be7
authored
Feb 27, 2019
by
Antonio Niño Díaz
Committed by
GitHub
Feb 27, 2019
Browse files
Merge pull request #1826 from smaeul/allwinner
allwinner: A few minor improvements
parents
ab3d2247
5d4bd66d
Changes
7
Hide whitespace changes
Inline
Side-by-side
plat/allwinner/common/include/sunxi_private.h
View file @
65954be7
...
...
@@ -9,9 +9,9 @@
void
sunxi_configure_mmu_el3
(
int
flags
);
void
sunxi_cpu_on
(
u
nsigned
int
cluster
,
unsigned
int
core
);
void
sunxi_cpu_off
(
u
nsigned
int
cluster
,
unsigned
int
core
);
void
sunxi_disable_secondary_cpus
(
u
nsigned
in
t
primary_
cpu
);
void
sunxi_cpu_on
(
u
_register_t
mpidr
);
void
sunxi_cpu_off
(
u
_register_t
mpidr
);
void
sunxi_disable_secondary_cpus
(
u
_register_
t
primary_
mpidr
);
void
__dead2
sunxi_power_down
(
void
);
int
sunxi_pmic_setup
(
uint16_t
socid
,
const
void
*
fdt
);
...
...
plat/allwinner/common/sunxi_bl31_setup.c
View file @
65954be7
...
...
@@ -11,6 +11,7 @@
#include <platform_def.h>
#include <arch.h>
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/arm/gicv2.h>
#include <drivers/console.h>
...
...
@@ -101,7 +102,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
SET_SECURITY_STATE
(
bl33_image_ep_info
.
h
.
attr
,
NON_SECURE
);
/* Turn off all secondary CPUs */
sunxi_disable_secondary_cpus
(
plat_my_core_pos
());
sunxi_disable_secondary_cpus
(
read_mpidr
());
}
void
bl31_plat_arch_setup
(
void
)
...
...
plat/allwinner/common/sunxi_common.c
View file @
65954be7
...
...
@@ -18,7 +18,7 @@
#include <sunxi_mmap.h>
#include <sunxi_private.h>
static
mmap_region_t
sunxi_mmap
[
PLATFORM_MMAP_REGIONS
+
1
]
=
{
static
const
mmap_region_t
sunxi_mmap
[
PLATFORM_MMAP_REGIONS
+
1
]
=
{
MAP_REGION_FLAT
(
SUNXI_SRAM_BASE
,
SUNXI_SRAM_SIZE
,
MT_MEMORY
|
MT_RW
|
MT_SECURE
),
MAP_REGION_FLAT
(
SUNXI_DEV_BASE
,
SUNXI_DEV_SIZE
,
...
...
plat/allwinner/common/sunxi_cpu_ops.c
View file @
65954be7
/*
* Copyright (c) 2017-201
8
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-201
9
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -45,9 +45,10 @@ static void sunxi_cpu_enable_power(unsigned int cluster, unsigned int core)
mmio_write_32
(
SUNXI_CPU_POWER_CLAMP_REG
(
cluster
,
core
),
0x00
);
}
void
sunxi_cpu_off
(
u
nsigned
int
cluster
,
unsigned
int
core
)
void
sunxi_cpu_off
(
u
_register_t
mpidr
)
{
int
corenr
=
cluster
*
PLATFORM_MAX_CPUS_PER_CLUSTER
+
core
;
unsigned
int
cluster
=
MPIDR_AFFLVL1_VAL
(
mpidr
);
unsigned
int
core
=
MPIDR_AFFLVL0_VAL
(
mpidr
);
VERBOSE
(
"PSCI: Powering off cluster %d core %d
\n
"
,
cluster
,
core
);
...
...
@@ -55,9 +56,9 @@ void sunxi_cpu_off(unsigned int cluster, unsigned int core)
mmio_clrbits_32
(
SUNXI_CPUCFG_DBG_REG0
,
BIT
(
core
));
/* We can't turn ourself off like this, but it works for other cores. */
if
(
plat_my_core_pos
()
!=
coren
r
)
{
if
(
read_mpidr
()
!=
mpid
r
)
{
/* Activate the core output clamps, but not for core 0. */
if
(
core
nr
!=
0
)
if
(
core
!=
0
)
mmio_setbits_32
(
SUNXI_POWEROFF_GATING_REG
(
cluster
),
BIT
(
core
));
/* Assert CPU power-on reset */
...
...
@@ -80,8 +81,11 @@ void sunxi_cpu_off(unsigned int cluster, unsigned int core)
0
,
BIT_32
(
core
));
}
void
sunxi_cpu_on
(
u
nsigned
int
cluster
,
unsigned
int
core
)
void
sunxi_cpu_on
(
u
_register_t
mpidr
)
{
unsigned
int
cluster
=
MPIDR_AFFLVL1_VAL
(
mpidr
);
unsigned
int
core
=
MPIDR_AFFLVL0_VAL
(
mpidr
);
VERBOSE
(
"PSCI: Powering on cluster %d core %d
\n
"
,
cluster
,
core
);
/* Assert CPU core reset */
...
...
@@ -102,12 +106,18 @@ void sunxi_cpu_on(unsigned int cluster, unsigned int core)
mmio_setbits_32
(
SUNXI_CPUCFG_DBG_REG0
,
BIT
(
core
));
}
void
sunxi_disable_secondary_cpus
(
u
nsigned
in
t
primary_
cpu
)
void
sunxi_disable_secondary_cpus
(
u
_register_
t
primary_
mpidr
)
{
for
(
unsigned
int
cpu
=
0
;
cpu
<
PLATFORM_CORE_COUNT
;
cpu
+=
1
)
{
if
(
cpu
==
primary_cpu
)
continue
;
sunxi_cpu_off
(
cpu
/
PLATFORM_MAX_CPUS_PER_CLUSTER
,
cpu
%
PLATFORM_MAX_CPUS_PER_CLUSTER
);
unsigned
int
cluster
;
unsigned
int
core
;
for
(
cluster
=
0
;
cluster
<
PLATFORM_CLUSTER_COUNT
;
++
cluster
)
{
for
(
core
=
0
;
core
<
PLATFORM_MAX_CPUS_PER_CLUSTER
;
++
core
)
{
u_register_t
mpidr
=
(
cluster
<<
MPIDR_AFF1_SHIFT
)
|
(
core
<<
MPIDR_AFF0_SHIFT
)
|
BIT
(
31
);
if
(
mpidr
!=
primary_mpidr
)
sunxi_cpu_off
(
mpidr
);
}
}
}
plat/allwinner/common/sunxi_pm.c
View file @
65954be7
...
...
@@ -35,7 +35,7 @@ static int sunxi_pwr_domain_on(u_register_t mpidr)
if
(
mpidr_is_valid
(
mpidr
)
==
0
)
return
PSCI_E_INTERN_FAIL
;
sunxi_cpu_on
(
MPIDR_AFFLVL1_VAL
(
mpidr
),
MPIDR_AFFLVL0_VAL
(
mpidr
)
);
sunxi_cpu_on
(
mpidr
);
return
PSCI_E_SUCCESS
;
}
...
...
@@ -47,9 +47,7 @@ static void sunxi_pwr_domain_off(const psci_power_state_t *target_state)
static
void
__dead2
sunxi_pwr_down_wfi
(
const
psci_power_state_t
*
target_state
)
{
u_register_t
mpidr
=
read_mpidr
();
sunxi_cpu_off
(
MPIDR_AFFLVL1_VAL
(
mpidr
),
MPIDR_AFFLVL0_VAL
(
mpidr
));
sunxi_cpu_off
(
read_mpidr
());
while
(
1
)
wfi
();
...
...
@@ -64,7 +62,7 @@ static void sunxi_pwr_domain_on_finish(const psci_power_state_t *target_state)
static
void
__dead2
sunxi_system_off
(
void
)
{
/* Turn off all secondary CPUs */
sunxi_disable_secondary_cpus
(
plat_my_core_pos
());
sunxi_disable_secondary_cpus
(
read_mpidr
());
sunxi_power_down
();
}
...
...
plat/allwinner/common/sunxi_topology.c
View file @
65954be7
...
...
@@ -9,7 +9,7 @@
#include <arch.h>
#include <plat/common/platform.h>
static
unsigned
char
plat_power_domain_tree_desc
[
PLAT_MAX_PWR_LVL
+
1
]
=
{
static
const
unsigned
char
plat_power_domain_tree_desc
[
PLAT_MAX_PWR_LVL
+
1
]
=
{
/* One root node for the SoC */
1
,
/* One node for each cluster */
...
...
plat/allwinner/sun50i_a64/sunxi_power.c
View file @
65954be7
...
...
@@ -175,7 +175,7 @@ static int fdt_get_regulator_millivolt(const void *fdt, int node)
#define NO_SPLIT 0xff
struct
axp_regulator
{
static
const
struct
axp_regulator
{
char
*
dt_name
;
uint16_t
min_volt
;
uint16_t
max_volt
;
...
...
@@ -247,7 +247,7 @@ static void setup_axp803_rails(const void *fdt)
for
(
node
=
fdt_first_subnode
(
fdt
,
node
);
node
!=
-
FDT_ERR_NOTFOUND
;
node
=
fdt_next_subnode
(
fdt
,
node
))
{
struct
axp_regulator
*
reg
;
const
struct
axp_regulator
*
reg
;
const
char
*
name
;
int
length
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment