xref: /rk3399_ARM-atf/plat/nvidia/tegra/include/drivers/flowctrl.h (revision 2ed09b1ee2a3c9d6e19f067e0bdf5af1d4f59114)
108438e24SVarun Wadekar /*
2*2ed09b1eSVarun Wadekar  * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
308438e24SVarun Wadekar  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
508438e24SVarun Wadekar  */
608438e24SVarun Wadekar 
7c3cf06f1SAntonio Nino Diaz #ifndef FLOWCTRL_H
8c3cf06f1SAntonio Nino Diaz #define FLOWCTRL_H
908438e24SVarun Wadekar 
1009d40e0eSAntonio Nino Diaz #include <lib/mmio.h>
1109d40e0eSAntonio Nino Diaz 
1208438e24SVarun Wadekar #include <tegra_def.h>
1308438e24SVarun Wadekar 
1450e91633SAnthony Zhou #define FLOWCTRL_HALT_CPU0_EVENTS	0x0U
1550e91633SAnthony Zhou #define  FLOWCTRL_WAITEVENT		(2U << 29)
1650e91633SAnthony Zhou #define  FLOWCTRL_WAIT_FOR_INTERRUPT	(4U << 29)
1750e91633SAnthony Zhou #define  FLOWCTRL_JTAG_RESUME		(1U << 28)
1850e91633SAnthony Zhou #define  FLOWCTRL_HALT_SCLK		(1U << 27)
1950e91633SAnthony Zhou #define  FLOWCTRL_HALT_LIC_IRQ		(1U << 11)
2050e91633SAnthony Zhou #define  FLOWCTRL_HALT_LIC_FIQ		(1U << 10)
2150e91633SAnthony Zhou #define  FLOWCTRL_HALT_GIC_IRQ		(1U << 9)
2250e91633SAnthony Zhou #define  FLOWCTRL_HALT_GIC_FIQ		(1U << 8)
2350e91633SAnthony Zhou #define FLOWCTRL_HALT_BPMP_EVENTS	0x4U
2450e91633SAnthony Zhou #define FLOWCTRL_CPU0_CSR		0x8U
2550e91633SAnthony Zhou #define  FLOW_CTRL_CSR_PWR_OFF_STS	(1U << 16)
2650e91633SAnthony Zhou #define  FLOWCTRL_CSR_INTR_FLAG		(1U << 15)
2750e91633SAnthony Zhou #define  FLOWCTRL_CSR_EVENT_FLAG	(1U << 14)
2850e91633SAnthony Zhou #define  FLOWCTRL_CSR_IMMEDIATE_WAKE	(1U << 3)
2950e91633SAnthony Zhou #define  FLOWCTRL_CSR_ENABLE		(1U << 0)
3050e91633SAnthony Zhou #define FLOWCTRL_HALT_CPU1_EVENTS	0x14U
3150e91633SAnthony Zhou #define FLOWCTRL_CPU1_CSR		0x18U
32*2ed09b1eSVarun Wadekar #define FLOW_CTLR_FLOW_DBG_QUAL		0x50U
33*2ed09b1eSVarun Wadekar #define  FLOWCTRL_FIQ2CCPLEX_ENABLE	(1U << 28)
3450e91633SAnthony Zhou #define FLOWCTRL_CC4_CORE0_CTRL		0x6cU
3550e91633SAnthony Zhou #define FLOWCTRL_WAIT_WFI_BITMAP	0x100U
3650e91633SAnthony Zhou #define FLOWCTRL_L2_FLUSH_CONTROL	0x94U
3750e91633SAnthony Zhou #define FLOWCTRL_BPMP_CLUSTER_CONTROL	0x98U
3850e91633SAnthony Zhou #define  FLOWCTRL_BPMP_CLUSTER_PWRON_LOCK	(1U << 2)
3908438e24SVarun Wadekar 
4050e91633SAnthony Zhou #define FLOWCTRL_ENABLE_EXT		12U
4150e91633SAnthony Zhou #define FLOWCTRL_ENABLE_EXT_MASK	3U
4250e91633SAnthony Zhou #define FLOWCTRL_PG_CPU_NONCPU		0x1U
4350e91633SAnthony Zhou #define FLOWCTRL_TURNOFF_CPURAIL	0x2U
4408438e24SVarun Wadekar 
4508438e24SVarun Wadekar static inline uint32_t tegra_fc_read_32(uint32_t off)
4608438e24SVarun Wadekar {
4708438e24SVarun Wadekar 	return mmio_read_32(TEGRA_FLOWCTRL_BASE + off);
4808438e24SVarun Wadekar }
4908438e24SVarun Wadekar 
5008438e24SVarun Wadekar static inline void tegra_fc_write_32(uint32_t off, uint32_t val)
5108438e24SVarun Wadekar {
5208438e24SVarun Wadekar 	mmio_write_32(TEGRA_FLOWCTRL_BASE + off, val);
5308438e24SVarun Wadekar }
5408438e24SVarun Wadekar 
5508438e24SVarun Wadekar void tegra_fc_cluster_idle(uint32_t midr);
56864ab0fdSVarun Wadekar void tegra_fc_cpu_powerdn(uint32_t mpidr);
5708438e24SVarun Wadekar void tegra_fc_cluster_powerdn(uint32_t midr);
5808438e24SVarun Wadekar void tegra_fc_cpu_on(int cpu);
5908438e24SVarun Wadekar void tegra_fc_cpu_off(int cpu);
60*2ed09b1eSVarun Wadekar void tegra_fc_disable_fiq_to_ccplex_routing(void);
61*2ed09b1eSVarun Wadekar void tegra_fc_enable_fiq_to_ccplex_routing(void);
6208438e24SVarun Wadekar void tegra_fc_lock_active_cluster(void);
6308438e24SVarun Wadekar void tegra_fc_reset_bpmp(void);
64*2ed09b1eSVarun Wadekar void tegra_fc_soc_powerdn(uint32_t midr);
6508438e24SVarun Wadekar 
66c3cf06f1SAntonio Nino Diaz #endif /* FLOWCTRL_H */
67