blob: 6a3865745777b688b1fea06bba0c05791bfaf994 [file] [log] [blame]
Samuel Holland58032582017-08-12 04:07:39 -05001/*
Samuel Hollanda1d349b2021-01-24 06:37:29 -06002 * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
Samuel Holland58032582017-08-12 04:07:39 -05003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Andre Przywara4ec1a232018-10-14 12:02:02 +01007#ifndef SUNXI_PRIVATE_H
8#define SUNXI_PRIVATE_H
Samuel Holland58032582017-08-12 04:07:39 -05009
Samuel Hollande2b18772022-01-22 23:37:12 -060010#include <common/fdt_fixup.h>
11
Samuel Hollandfe753c92021-01-16 00:56:48 -060012#include <lib/psci/psci.h>
13
Samuel Hollande2b18772022-01-22 23:37:12 -060014extern const struct psci_cpu_idle_state sunxi_idle_states[];
15
Samuel Holland58032582017-08-12 04:07:39 -050016void sunxi_configure_mmu_el3(int flags);
Andre Przywara4ec1a232018-10-14 12:02:02 +010017
Samuel Holland5d4bd662019-02-17 15:33:33 -060018void sunxi_cpu_on(u_register_t mpidr);
Samuel Hollanda1d349b2021-01-24 06:37:29 -060019void sunxi_cpu_power_off_others(void);
20void sunxi_cpu_power_off_self(void);
Samuel Holland818e6732019-10-20 15:06:57 -050021void sunxi_power_down(void);
Andre Przywara4ec1a232018-10-14 12:02:02 +010022
Andre Przywarab23ab8e2021-01-20 00:09:44 +000023#if SUNXI_PSCI_USE_NATIVE
Samuel Hollandfe753c92021-01-16 00:56:48 -060024void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops);
Andre Przywarab23ab8e2021-01-20 00:09:44 +000025#else
26static inline void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops)
27{
28}
29#endif
30#if SUNXI_PSCI_USE_SCPI
Samuel Hollande2b18772022-01-22 23:37:12 -060031bool sunxi_psci_is_scpi(void);
Samuel Hollandfe753c92021-01-16 00:56:48 -060032int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops);
Andre Przywarab23ab8e2021-01-20 00:09:44 +000033#else
Samuel Hollande2b18772022-01-22 23:37:12 -060034static inline bool sunxi_psci_is_scpi(void)
35{
36 return false;
37}
Andre Przywarab23ab8e2021-01-20 00:09:44 +000038static inline int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops)
39{
40 return -1;
41}
42#endif
Samuel Hollandfe753c92021-01-16 00:56:48 -060043int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint);
44
Andre Przywaradf301602018-09-08 19:18:37 +010045int sunxi_pmic_setup(uint16_t socid, const void *fdt);
Andre Przywara4ec1a232018-10-14 12:02:02 +010046void sunxi_security_setup(void);
Samuel Holland58032582017-08-12 04:07:39 -050047
Andre Przywarac4143b72018-06-22 00:47:08 +010048uint16_t sunxi_read_soc_id(void);
Andre Przywara7020dca2018-10-14 12:03:23 +010049void sunxi_set_gpio_out(char port, int pin, bool level_high);
Andre Przywarad5ddf672018-10-14 22:13:53 +010050int sunxi_init_platform_r_twi(uint16_t socid, bool use_rsb);
Samuel Holland5cffedc2019-10-20 14:18:48 -050051void sunxi_execute_arisc_code(uint32_t *code, size_t size, uint16_t param);
Icenowy Zheng7c26b6e2018-07-21 20:41:12 +080052
Andre Przywara6fa8e722021-12-19 13:39:40 +000053#if SUNXI_AMEND_DTB
Andre Przywara0be10ee2020-12-14 12:06:24 +000054void sunxi_prepare_dtb(void *fdt);
55#else
56static inline void sunxi_prepare_dtb(void *fdt)
57{
58}
59#endif
60
Andre Przywara4ec1a232018-10-14 12:02:02 +010061#endif /* SUNXI_PRIVATE_H */