xref: /rk3399_ARM-atf/plat/allwinner/common/include/sunxi_private.h (revision 55b4c5ceb2c24798616748ba3f879700bf765c96)
14ec1a239SAndre Przywara /*
2a1d349beSSamuel Holland  * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
34ec1a239SAndre Przywara  *
44ec1a239SAndre Przywara  * SPDX-License-Identifier: BSD-3-Clause
54ec1a239SAndre Przywara  */
64ec1a239SAndre Przywara 
74ec1a239SAndre Przywara #ifndef SUNXI_PRIVATE_H
84ec1a239SAndre Przywara #define SUNXI_PRIVATE_H
94ec1a239SAndre Przywara 
10e2b18771SSamuel Holland #include <common/fdt_fixup.h>
11e2b18771SSamuel Holland 
12fe753c97SSamuel Holland #include <lib/psci/psci.h>
13fe753c97SSamuel Holland 
14e2b18771SSamuel Holland extern const struct psci_cpu_idle_state sunxi_idle_states[];
15e2b18771SSamuel Holland 
164ec1a239SAndre Przywara void sunxi_configure_mmu_el3(int flags);
174ec1a239SAndre Przywara 
185d4bd66dSSamuel Holland void sunxi_cpu_on(u_register_t mpidr);
19a1d349beSSamuel Holland void sunxi_cpu_power_off_others(void);
20a1d349beSSamuel Holland void sunxi_cpu_power_off_self(void);
21818e6732SSamuel Holland void sunxi_power_down(void);
224ec1a239SAndre Przywara 
23b23ab8ebSAndre Przywara #if SUNXI_PSCI_USE_NATIVE
24fe753c97SSamuel Holland void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops);
25b23ab8ebSAndre Przywara #else
sunxi_set_native_psci_ops(const plat_psci_ops_t ** psci_ops)26b23ab8ebSAndre Przywara static inline void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops)
27b23ab8ebSAndre Przywara {
28b23ab8ebSAndre Przywara }
29b23ab8ebSAndre Przywara #endif
30b23ab8ebSAndre Przywara #if SUNXI_PSCI_USE_SCPI
31e2b18771SSamuel Holland bool sunxi_psci_is_scpi(void);
32fe753c97SSamuel Holland int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops);
33b23ab8ebSAndre Przywara #else
sunxi_psci_is_scpi(void)34e2b18771SSamuel Holland static inline bool sunxi_psci_is_scpi(void)
35e2b18771SSamuel Holland {
36e2b18771SSamuel Holland 	return false;
37e2b18771SSamuel Holland }
sunxi_set_scpi_psci_ops(const plat_psci_ops_t ** psci_ops)38b23ab8ebSAndre Przywara static inline int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops)
39b23ab8ebSAndre Przywara {
40b23ab8ebSAndre Przywara 	return -1;
41b23ab8ebSAndre Przywara }
42b23ab8ebSAndre Przywara #endif
43fe753c97SSamuel Holland int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint);
44fe753c97SSamuel Holland 
45df301601SAndre Przywara int sunxi_pmic_setup(uint16_t socid, const void *fdt);
464ec1a239SAndre Przywara void sunxi_security_setup(void);
474ec1a239SAndre Przywara 
484ec1a239SAndre Przywara uint16_t sunxi_read_soc_id(void);
497020dca0SAndre Przywara void sunxi_set_gpio_out(char port, int pin, bool level_high);
50d5ddf67aSAndre Przywara int sunxi_init_platform_r_twi(uint16_t socid, bool use_rsb);
515cffedceSSamuel Holland void sunxi_execute_arisc_code(uint32_t *code, size_t size, uint16_t param);
524ec1a239SAndre Przywara 
536fa8e72eSAndre Przywara #if SUNXI_AMEND_DTB
540be10ee3SAndre Przywara void sunxi_prepare_dtb(void *fdt);
550be10ee3SAndre Przywara #else
sunxi_prepare_dtb(void * fdt)560be10ee3SAndre Przywara static inline void sunxi_prepare_dtb(void *fdt)
570be10ee3SAndre Przywara {
580be10ee3SAndre Przywara }
590be10ee3SAndre Przywara #endif
600be10ee3SAndre Przywara 
61*ee5b26fdSAndre Przywara #ifdef PLAT_sun50i_h616
62*ee5b26fdSAndre Przywara void sunxi_soc_fdt_fixup(void *dtb);
63*ee5b26fdSAndre Przywara #else
sunxi_soc_fdt_fixup(void * dtb)64*ee5b26fdSAndre Przywara static inline void sunxi_soc_fdt_fixup(void *dtb)
65*ee5b26fdSAndre Przywara {
66*ee5b26fdSAndre Przywara }
67*ee5b26fdSAndre Przywara #endif
68*ee5b26fdSAndre Przywara 
694ec1a239SAndre Przywara #endif /* SUNXI_PRIVATE_H */
70