2017-08-12 10:07:39 +01:00
|
|
|
/*
|
2021-01-24 12:37:29 +00:00
|
|
|
* Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
|
2017-08-12 10:07:39 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
2018-10-14 12:02:02 +01:00
|
|
|
#ifndef SUNXI_PRIVATE_H
|
|
|
|
#define SUNXI_PRIVATE_H
|
2017-08-12 10:07:39 +01:00
|
|
|
|
2022-01-23 05:37:12 +00:00
|
|
|
#include <common/fdt_fixup.h>
|
|
|
|
|
allwinner: Split native and SCPI-based PSCI implementations
In order to keep SCP firmware as optional, the original, limited native
PSCI implementation was kept around as a fallback. This turned out to be
a good decision, as some newer SoCs omit the ARISC, and thus cannot run
SCP firmware.
However, keeping the two implementations in one file makes things
unnecessarily messy. First, it is difficult to compile out the
SCPI-based implementation where it is not applicable. Second the check
is done in each callback, while scpi_available is only updated at boot.
This makes the individual callbacks unnecessarily complicated.
It is cleaner to provide two entirely separate implementations in two
separate files. The native implementation does not support any kind of
CPU suspend, so its callbacks are greatly simplified. One function,
sunxi_validate_ns_entrypoint, is shared between the two implementations.
Finally, the logic for choosing between implementations is kept in a
third file, to provide for platforms where only one implementation is
applicable and the other is compiled out.
Change-Id: I4914f07d8e693dbce218e0e2394bef15c42945f8
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-01-16 06:56:48 +00:00
|
|
|
#include <lib/psci/psci.h>
|
|
|
|
|
2022-01-23 05:37:12 +00:00
|
|
|
extern const struct psci_cpu_idle_state sunxi_idle_states[];
|
|
|
|
|
2017-08-12 10:07:39 +01:00
|
|
|
void sunxi_configure_mmu_el3(int flags);
|
2018-10-14 12:02:02 +01:00
|
|
|
|
2019-02-17 21:33:33 +00:00
|
|
|
void sunxi_cpu_on(u_register_t mpidr);
|
2021-01-24 12:37:29 +00:00
|
|
|
void sunxi_cpu_power_off_others(void);
|
|
|
|
void sunxi_cpu_power_off_self(void);
|
2019-10-20 21:06:57 +01:00
|
|
|
void sunxi_power_down(void);
|
2017-08-12 10:07:39 +01:00
|
|
|
|
2021-01-20 00:09:44 +00:00
|
|
|
#if SUNXI_PSCI_USE_NATIVE
|
allwinner: Split native and SCPI-based PSCI implementations
In order to keep SCP firmware as optional, the original, limited native
PSCI implementation was kept around as a fallback. This turned out to be
a good decision, as some newer SoCs omit the ARISC, and thus cannot run
SCP firmware.
However, keeping the two implementations in one file makes things
unnecessarily messy. First, it is difficult to compile out the
SCPI-based implementation where it is not applicable. Second the check
is done in each callback, while scpi_available is only updated at boot.
This makes the individual callbacks unnecessarily complicated.
It is cleaner to provide two entirely separate implementations in two
separate files. The native implementation does not support any kind of
CPU suspend, so its callbacks are greatly simplified. One function,
sunxi_validate_ns_entrypoint, is shared between the two implementations.
Finally, the logic for choosing between implementations is kept in a
third file, to provide for platforms where only one implementation is
applicable and the other is compiled out.
Change-Id: I4914f07d8e693dbce218e0e2394bef15c42945f8
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-01-16 06:56:48 +00:00
|
|
|
void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops);
|
2021-01-20 00:09:44 +00:00
|
|
|
#else
|
|
|
|
static inline void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if SUNXI_PSCI_USE_SCPI
|
2022-01-23 05:37:12 +00:00
|
|
|
bool sunxi_psci_is_scpi(void);
|
allwinner: Split native and SCPI-based PSCI implementations
In order to keep SCP firmware as optional, the original, limited native
PSCI implementation was kept around as a fallback. This turned out to be
a good decision, as some newer SoCs omit the ARISC, and thus cannot run
SCP firmware.
However, keeping the two implementations in one file makes things
unnecessarily messy. First, it is difficult to compile out the
SCPI-based implementation where it is not applicable. Second the check
is done in each callback, while scpi_available is only updated at boot.
This makes the individual callbacks unnecessarily complicated.
It is cleaner to provide two entirely separate implementations in two
separate files. The native implementation does not support any kind of
CPU suspend, so its callbacks are greatly simplified. One function,
sunxi_validate_ns_entrypoint, is shared between the two implementations.
Finally, the logic for choosing between implementations is kept in a
third file, to provide for platforms where only one implementation is
applicable and the other is compiled out.
Change-Id: I4914f07d8e693dbce218e0e2394bef15c42945f8
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-01-16 06:56:48 +00:00
|
|
|
int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops);
|
2021-01-20 00:09:44 +00:00
|
|
|
#else
|
2022-01-23 05:37:12 +00:00
|
|
|
static inline bool sunxi_psci_is_scpi(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2021-01-20 00:09:44 +00:00
|
|
|
static inline int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
allwinner: Split native and SCPI-based PSCI implementations
In order to keep SCP firmware as optional, the original, limited native
PSCI implementation was kept around as a fallback. This turned out to be
a good decision, as some newer SoCs omit the ARISC, and thus cannot run
SCP firmware.
However, keeping the two implementations in one file makes things
unnecessarily messy. First, it is difficult to compile out the
SCPI-based implementation where it is not applicable. Second the check
is done in each callback, while scpi_available is only updated at boot.
This makes the individual callbacks unnecessarily complicated.
It is cleaner to provide two entirely separate implementations in two
separate files. The native implementation does not support any kind of
CPU suspend, so its callbacks are greatly simplified. One function,
sunxi_validate_ns_entrypoint, is shared between the two implementations.
Finally, the logic for choosing between implementations is kept in a
third file, to provide for platforms where only one implementation is
applicable and the other is compiled out.
Change-Id: I4914f07d8e693dbce218e0e2394bef15c42945f8
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-01-16 06:56:48 +00:00
|
|
|
int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint);
|
|
|
|
|
2018-09-08 19:18:37 +01:00
|
|
|
int sunxi_pmic_setup(uint16_t socid, const void *fdt);
|
2018-06-01 02:01:39 +01:00
|
|
|
void sunxi_security_setup(void);
|
|
|
|
|
2018-10-14 12:02:02 +01:00
|
|
|
uint16_t sunxi_read_soc_id(void);
|
2018-10-14 12:03:23 +01:00
|
|
|
void sunxi_set_gpio_out(char port, int pin, bool level_high);
|
2018-10-14 22:13:53 +01:00
|
|
|
int sunxi_init_platform_r_twi(uint16_t socid, bool use_rsb);
|
2019-10-20 20:18:48 +01:00
|
|
|
void sunxi_execute_arisc_code(uint32_t *code, size_t size, uint16_t param);
|
2018-07-22 14:52:50 +01:00
|
|
|
|
2021-12-19 13:39:40 +00:00
|
|
|
#if SUNXI_AMEND_DTB
|
2020-12-14 12:06:24 +00:00
|
|
|
void sunxi_prepare_dtb(void *fdt);
|
|
|
|
#else
|
|
|
|
static inline void sunxi_prepare_dtb(void *fdt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-10-14 12:02:02 +01:00
|
|
|
#endif /* SUNXI_PRIVATE_H */
|