Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
37cdad2a
Unverified
Commit
37cdad2a
authored
6 years ago
by
Antonio Niño Díaz
Committed by
GitHub
6 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #1821 from Yann-lms/stm32mp1_2019-02-14
Series of new patches for STM32MP1
parents
83321666
6c1e71e1
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
plat/st/stm32mp1/stm32mp1_gic.c
+0
-3
plat/st/stm32mp1/stm32mp1_gic.c
plat/st/stm32mp1/stm32mp1_helper.S
+6
-7
plat/st/stm32mp1/stm32mp1_helper.S
plat/st/stm32mp1/stm32mp1_pm.c
+9
-22
plat/st/stm32mp1/stm32mp1_pm.c
plat/st/stm32mp1/stm32mp1_private.c
+55
-0
plat/st/stm32mp1/stm32mp1_private.c
plat/st/stm32mp1/stm32mp1_security.c
+6
-16
plat/st/stm32mp1/stm32mp1_security.c
with
76 additions
and
48 deletions
+76
-48
plat/st/stm32mp1/stm32mp1_gic.c
View file @
37cdad2a
...
@@ -15,9 +15,6 @@
...
@@ -15,9 +15,6 @@
#include <lib/utils.h>
#include <lib/utils.h>
#include <plat/common/platform.h>
#include <plat/common/platform.h>
#include <stm32mp1_dt.h>
#include <stm32mp1_private.h>
struct
stm32_gic_instance
{
struct
stm32_gic_instance
{
uint32_t
cells
;
uint32_t
cells
;
uint32_t
phandle_node
;
uint32_t
phandle_node
;
...
...
This diff is collapsed.
Click to expand it.
plat/st/stm32mp1/stm32mp1_helper.S
View file @
37cdad2a
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include <asm_macros.S>
#include <asm_macros.S>
#include <common/bl_common.h>
#include <common/bl_common.h>
#include <drivers/st/stm32_gpio.h>
#include <drivers/st/stm32_gpio.h>
#include <drivers/st/stm32mp1_rcc.h>
#define GPIO_TX_SHIFT (DEBUG_UART_TX_GPIO_PORT << 1)
#define GPIO_TX_SHIFT (DEBUG_UART_TX_GPIO_PORT << 1)
#define GPIO_TX_ALT_SHIFT ((DEBUG_UART_TX_GPIO_PORT - GPIO_ALT_LOWER_LIMIT) << 2)
#define GPIO_TX_ALT_SHIFT ((DEBUG_UART_TX_GPIO_PORT - GPIO_ALT_LOWER_LIMIT) << 2)
...
@@ -74,7 +73,7 @@ func plat_is_my_cpu_primary
...
@@ -74,7 +73,7 @@ func plat_is_my_cpu_primary
ldcopr
r0
,
MPIDR
ldcopr
r0
,
MPIDR
ldr
r1
,
=(
MPIDR_CLUSTER_MASK
|
MPIDR_CPU_MASK
)
ldr
r1
,
=(
MPIDR_CLUSTER_MASK
|
MPIDR_CPU_MASK
)
and
r0
,
r1
and
r0
,
r1
cmp
r0
,
#
STM32MP
1
_PRIMARY_CPU
cmp
r0
,
#
STM32MP_PRIMARY_CPU
moveq
r0
,
#
1
moveq
r0
,
#
1
movne
r0
,
#
0
movne
r0
,
#
0
bx
lr
bx
lr
...
@@ -143,9 +142,9 @@ func plat_crash_console_init
...
@@ -143,9 +142,9 @@ func plat_crash_console_init
orr
r2
,
r2
,
#
DEBUG_UART_TX_EN
orr
r2
,
r2
,
#
DEBUG_UART_TX_EN
str
r2
,
[
r1
]
str
r2
,
[
r1
]
ldr
r0
,
=
STM32MP
1
_DEBUG_USART_BASE
ldr
r0
,
=
STM32MP_DEBUG_USART_BASE
ldr
r1
,
=
STM32MP
1
_DEBUG_USART_CLK_FRQ
ldr
r1
,
=
STM32MP_DEBUG_USART_CLK_FRQ
ldr
r2
,
=
STM32MP
1
_UART_BAUDRATE
ldr
r2
,
=
STM32MP_UART_BAUDRATE
b
console_stm32_core_init
b
console_stm32_core_init
endfunc
plat_crash_console_init
endfunc
plat_crash_console_init
...
@@ -156,7 +155,7 @@ endfunc plat_crash_console_init
...
@@ -156,7 +155,7 @@ endfunc plat_crash_console_init
*
---------------------------------------------
*
---------------------------------------------
*/
*/
func
plat_crash_console_flush
func
plat_crash_console_flush
ldr
r1
,
=
STM32MP
1
_DEBUG_USART_BASE
ldr
r1
,
=
STM32MP_DEBUG_USART_BASE
b
console_stm32_core_flush
b
console_stm32_core_flush
endfunc
plat_crash_console_flush
endfunc
plat_crash_console_flush
...
@@ -172,6 +171,6 @@ endfunc plat_crash_console_flush
...
@@ -172,6 +171,6 @@ endfunc plat_crash_console_flush
*
---------------------------------------------
*
---------------------------------------------
*/
*/
func
plat_crash_console_putc
func
plat_crash_console_putc
ldr
r1
,
=
STM32MP
1
_DEBUG_USART_BASE
ldr
r1
,
=
STM32MP_DEBUG_USART_BASE
b
console_stm32_core_putc
b
console_stm32_core_putc
endfunc
plat_crash_console_putc
endfunc
plat_crash_console_putc
This diff is collapsed.
Click to expand it.
plat/st/stm32mp1/stm32mp1_pm.c
View file @
37cdad2a
...
@@ -14,15 +14,11 @@
...
@@ -14,15 +14,11 @@
#include <drivers/arm/gic_common.h>
#include <drivers/arm/gic_common.h>
#include <drivers/arm/gicv2.h>
#include <drivers/arm/gicv2.h>
#include <drivers/st/stm32mp1_clk.h>
#include <drivers/st/stm32mp1_clk.h>
#include <drivers/st/stm32mp1_rcc.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
#include <lib/mmio.h>
#include <lib/mmio.h>
#include <lib/psci/psci.h>
#include <lib/psci/psci.h>
#include <plat/common/platform.h>
#include <plat/common/platform.h>
#include <boot_api.h>
#include <stm32mp1_private.h>
static
uintptr_t
stm32_sec_entrypoint
;
static
uintptr_t
stm32_sec_entrypoint
;
static
uint32_t
cntfrq_core0
;
static
uint32_t
cntfrq_core0
;
...
@@ -63,7 +59,6 @@ static void stm32_cpu_standby(plat_local_state_t cpu_state)
...
@@ -63,7 +59,6 @@ static void stm32_cpu_standby(plat_local_state_t cpu_state)
static
int
stm32_pwr_domain_on
(
u_register_t
mpidr
)
static
int
stm32_pwr_domain_on
(
u_register_t
mpidr
)
{
{
unsigned
long
current_cpu_mpidr
=
read_mpidr_el1
();
unsigned
long
current_cpu_mpidr
=
read_mpidr_el1
();
uint32_t
tamp_clk_off
=
0
;
uint32_t
bkpr_core1_addr
=
uint32_t
bkpr_core1_addr
=
tamp_bkpr
(
BOOT_API_CORE1_BRANCH_ADDRESS_TAMP_BCK_REG_IDX
);
tamp_bkpr
(
BOOT_API_CORE1_BRANCH_ADDRESS_TAMP_BCK_REG_IDX
);
uint32_t
bkpr_core1_magic
=
uint32_t
bkpr_core1_magic
=
...
@@ -73,18 +68,13 @@ static int stm32_pwr_domain_on(u_register_t mpidr)
...
@@ -73,18 +68,13 @@ static int stm32_pwr_domain_on(u_register_t mpidr)
return
PSCI_E_INVALID_PARAMS
;
return
PSCI_E_INVALID_PARAMS
;
}
}
if
((
stm32_sec_entrypoint
<
STM32MP
1
_SRAM_BASE
)
||
if
((
stm32_sec_entrypoint
<
STM32MP_
SY
SRAM_BASE
)
||
(
stm32_sec_entrypoint
>
(
STM32MP
1
_SRAM_BASE
+
(
stm32_sec_entrypoint
>
(
STM32MP_
SY
SRAM_BASE
+
(
STM32MP
1
_SRAM_SIZE
-
1
))))
{
(
STM32MP_
SY
SRAM_SIZE
-
1
))))
{
return
PSCI_E_INVALID_ADDRESS
;
return
PSCI_E_INVALID_ADDRESS
;
}
}
if
(
!
stm32mp1_clk_is_enabled
(
RTCAPB
))
{
stm32mp_clk_enable
(
RTCAPB
);
tamp_clk_off
=
1
;
if
(
stm32mp1_clk_enable
(
RTCAPB
)
!=
0
)
{
panic
();
}
}
cntfrq_core0
=
read_cntfrq_el0
();
cntfrq_core0
=
read_cntfrq_el0
();
...
@@ -94,14 +84,10 @@ static int stm32_pwr_domain_on(u_register_t mpidr)
...
@@ -94,14 +84,10 @@ static int stm32_pwr_domain_on(u_register_t mpidr)
/* Write magic number in backup register */
/* Write magic number in backup register */
mmio_write_32
(
bkpr_core1_magic
,
BOOT_API_A7_CORE1_MAGIC_NUMBER
);
mmio_write_32
(
bkpr_core1_magic
,
BOOT_API_A7_CORE1_MAGIC_NUMBER
);
if
(
tamp_clk_off
!=
0U
)
{
stm32mp_clk_disable
(
RTCAPB
);
if
(
stm32mp1_clk_disable
(
RTCAPB
)
!=
0
)
{
panic
();
}
}
/* Generate an IT to core 1 */
/* Generate an IT to core 1 */
gicv2_raise_sgi
(
ARM_IRQ_SEC_SGI_0
,
STM32MP
1
_SECONDARY_CPU
);
gicv2_raise_sgi
(
ARM_IRQ_SEC_SGI_0
,
STM32MP_SECONDARY_CPU
);
return
PSCI_E_SUCCESS
;
return
PSCI_E_SUCCESS
;
}
}
...
@@ -163,7 +149,8 @@ static void __dead2 stm32_system_off(void)
...
@@ -163,7 +149,8 @@ static void __dead2 stm32_system_off(void)
static
void
__dead2
stm32_system_reset
(
void
)
static
void
__dead2
stm32_system_reset
(
void
)
{
{
mmio_setbits_32
(
RCC_BASE
+
RCC_MP_GRSTCSETR
,
RCC_MP_GRSTCSETR_MPSYSRST
);
mmio_setbits_32
(
stm32mp_rcc_base
()
+
RCC_MP_GRSTCSETR
,
RCC_MP_GRSTCSETR_MPSYSRST
);
/* Loop in case system reset is not immediately caught */
/* Loop in case system reset is not immediately caught */
for
(
;
;
)
{
for
(
;
;
)
{
...
@@ -197,7 +184,7 @@ static int stm32_validate_power_state(unsigned int power_state,
...
@@ -197,7 +184,7 @@ static int stm32_validate_power_state(unsigned int power_state,
static
int
stm32_validate_ns_entrypoint
(
uintptr_t
entrypoint
)
static
int
stm32_validate_ns_entrypoint
(
uintptr_t
entrypoint
)
{
{
/* The non-secure entry point must be in DDR */
/* The non-secure entry point must be in DDR */
if
(
entrypoint
<
STM32MP
1
_DDR_BASE
)
{
if
(
entrypoint
<
STM32MP_DDR_BASE
)
{
return
PSCI_E_INVALID_ADDRESS
;
return
PSCI_E_INVALID_ADDRESS
;
}
}
...
...
This diff is collapsed.
Click to expand it.
plat/st/stm32mp1/stm32mp1_
common
.c
→
plat/st/stm32mp1/stm32mp1_
private
.c
View file @
37cdad2a
...
@@ -4,23 +4,12 @@
...
@@ -4,23 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
#include <assert.h>
#include <platform_def.h>
#include <platform_def.h>
#include <arch_helpers.h>
#include <common/bl_common.h>
#include <common/debug.h>
#include <drivers/arm/gicv2.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
#include <lib/mmio.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <plat/common/platform.h>
#include <stm32mp1_private.h>
#define MAP_SRAM MAP_REGION_FLAT(STM32MP
1
_SRAM_BASE, \
#define MAP_SRAM MAP_REGION_FLAT(STM32MP_
SY
SRAM_BASE, \
STM32MP
1
_SRAM_SIZE, \
STM32MP_
SY
SRAM_SIZE, \
MT_MEMORY | \
MT_MEMORY | \
MT_RW | \
MT_RW | \
MT_SECURE | \
MT_SECURE | \
...
@@ -64,60 +53,3 @@ void configure_mmu(void)
...
@@ -64,60 +53,3 @@ void configure_mmu(void)
enable_mmu_svc_mon
(
0
);
enable_mmu_svc_mon
(
0
);
}
}
uintptr_t
plat_get_ns_image_entrypoint
(
void
)
{
return
BL33_BASE
;
}
unsigned
int
plat_get_syscnt_freq2
(
void
)
{
return
read_cntfrq_el0
();
}
/* Functions to save and get boot context address given by ROM code */
static
uintptr_t
boot_ctx_address
;
void
stm32mp1_save_boot_ctx_address
(
uintptr_t
address
)
{
boot_ctx_address
=
address
;
}
uintptr_t
stm32mp1_get_boot_ctx_address
(
void
)
{
return
boot_ctx_address
;
}
uintptr_t
stm32_get_gpio_bank_base
(
unsigned
int
bank
)
{
switch
(
bank
)
{
case
GPIO_BANK_A
...
GPIO_BANK_K
:
return
GPIOA_BASE
+
(
bank
*
GPIO_BANK_OFFSET
);
case
GPIO_BANK_Z
:
return
GPIOZ_BASE
;
default:
panic
();
}
}
/* Return clock ID on success, negative value on error */
unsigned
long
stm32_get_gpio_bank_clock
(
unsigned
int
bank
)
{
switch
(
bank
)
{
case
GPIO_BANK_A
...
GPIO_BANK_K
:
return
GPIOA
+
(
bank
-
GPIO_BANK_A
);
case
GPIO_BANK_Z
:
return
GPIOZ
;
default:
panic
();
}
}
uint32_t
stm32_get_gpio_bank_offset
(
unsigned
int
bank
)
{
if
(
bank
==
GPIO_BANK_Z
)
{
return
0
;
}
else
{
return
bank
*
GPIO_BANK_OFFSET
;
}
}
This diff is collapsed.
Click to expand it.
plat/st/stm32mp1/stm32mp1_security.c
View file @
37cdad2a
...
@@ -11,13 +11,9 @@
...
@@ -11,13 +11,9 @@
#include <common/debug.h>
#include <common/debug.h>
#include <drivers/arm/tzc400.h>
#include <drivers/arm/tzc400.h>
#include <drivers/st/stm32mp1_clk.h>
#include <drivers/st/stm32mp1_clk.h>
#include <drivers/st/stm32mp1_rcc.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
#include <lib/mmio.h>
#include <lib/mmio.h>
#include <stm32mp1_dt.h>
#include <stm32mp1_private.h>
/*******************************************************************************
/*******************************************************************************
* Initialize the TrustZone Controller. Configure Region 0 with Secure RW access
* Initialize the TrustZone Controller. Configure Region 0 with Secure RW access
* and allow Non-Secure masters full access.
* and allow Non-Secure masters full access.
...
@@ -25,7 +21,7 @@
...
@@ -25,7 +21,7 @@
static
void
init_tzc400
(
void
)
static
void
init_tzc400
(
void
)
{
{
unsigned
long
long
region_base
,
region_top
;
unsigned
long
long
region_base
,
region_top
;
unsigned
long
long
ddr_base
=
STM32MP
1
_DDR_BASE
;
unsigned
long
long
ddr_base
=
STM32MP_DDR_BASE
;
unsigned
long
long
ddr_size
=
(
unsigned
long
long
)
dt_get_ddr_size
();
unsigned
long
long
ddr_size
=
(
unsigned
long
long
)
dt_get_ddr_size
();
tzc400_init
(
STM32MP1_TZC_BASE
);
tzc400_init
(
STM32MP1_TZC_BASE
);
...
@@ -65,14 +61,8 @@ static void init_tzc400(void)
...
@@ -65,14 +61,8 @@ static void init_tzc400(void)
******************************************************************************/
******************************************************************************/
static
void
early_init_tzc400
(
void
)
static
void
early_init_tzc400
(
void
)
{
{
if
(
stm32mp1_clk_enable
(
TZC1
)
!=
0
)
{
stm32mp_clk_enable
(
TZC1
);
ERROR
(
"Cannot enable TZC1 clock
\n
"
);
stm32mp_clk_enable
(
TZC2
);
panic
();
}
if
(
stm32mp1_clk_enable
(
TZC2
)
!=
0
)
{
ERROR
(
"Cannot enable TZC2 clock
\n
"
);
panic
();
}
tzc400_init
(
STM32MP1_TZC_BASE
);
tzc400_init
(
STM32MP1_TZC_BASE
);
...
@@ -83,9 +73,9 @@ static void early_init_tzc400(void)
...
@@ -83,9 +73,9 @@ static void early_init_tzc400(void)
* same configuration to all filters in the TZC.
* same configuration to all filters in the TZC.
*/
*/
tzc400_configure_region
(
STM32MP1_FILTER_BIT_ALL
,
1
,
tzc400_configure_region
(
STM32MP1_FILTER_BIT_ALL
,
1
,
STM32MP
1
_DDR_BASE
,
STM32MP_DDR_BASE
,
STM32MP
1
_DDR_BASE
+
STM32MP_DDR_BASE
+
(
STM32MP
1
_DDR_MAX_SIZE
-
1U
),
(
STM32MP_DDR_MAX_SIZE
-
1U
),
TZC_REGION_S_RDWR
,
TZC_REGION_S_RDWR
,
TZC_REGION_ACCESS_RDWR
(
STM32MP1_TZC_A7_ID
)
|
TZC_REGION_ACCESS_RDWR
(
STM32MP1_TZC_A7_ID
)
|
TZC_REGION_ACCESS_RDWR
(
STM32MP1_TZC_SDMMC_ID
));
TZC_REGION_ACCESS_RDWR
(
STM32MP1_TZC_SDMMC_ID
));
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
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
Menu
Projects
Groups
Snippets
Help