190792Sgshapiro/* SPDX-License-Identifier: GPL-2.0-or-later */ 290792Sgshapiro/* 390792Sgshapiro * Copyright (C) 2014 Imagination Technologies 490792Sgshapiro * Author: Paul Burton <paul.burton@mips.com> 590792Sgshapiro */ 690792Sgshapiro 790792Sgshapiro#ifndef __MIPS_ASM_PM_CPS_H__ 890792Sgshapiro#define __MIPS_ASM_PM_CPS_H__ 990792Sgshapiro 1090792Sgshapiro/* 1198121Sgshapiro * The CM & CPC can only handle coherence & power control on a per-core basis, 1290792Sgshapiro * thus in an MT system the VP(E)s within each core are coupled and can only 1390792Sgshapiro * enter or exit states requiring CM or CPC assistance in unison. 1490792Sgshapiro */ 1590792Sgshapiro#if defined(CONFIG_CPU_MIPSR6) 1690792Sgshapiro# define coupled_coherence cpu_has_vp 1790792Sgshapiro#elif defined(CONFIG_MIPS_MT) 1890792Sgshapiro# define coupled_coherence cpu_has_mipsmt 1990792Sgshapiro#else 2090792Sgshapiro# define coupled_coherence 0 2190792Sgshapiro#endif 2290792Sgshapiro 2390792Sgshapiro/* Enumeration of possible PM states */ 2490792Sgshapiroenum cps_pm_state { 2590792Sgshapiro CPS_PM_NC_WAIT, /* MIPS wait instruction, non-coherent */ 2690792Sgshapiro CPS_PM_CLOCK_GATED, /* Core clock gated */ 2790792Sgshapiro CPS_PM_POWER_GATED, /* Core power gated */ 2890792Sgshapiro CPS_PM_STATE_COUNT, 2990792Sgshapiro}; 3090792Sgshapiro 3190792Sgshapiro/** 3290792Sgshapiro * cps_pm_support_state - determine whether the system supports a PM state 3390792Sgshapiro * @state: the state to test for support 3490792Sgshapiro * 3590792Sgshapiro * Returns true if the system supports the given state, otherwise false. 3690792Sgshapiro */ 3790792Sgshapiroextern bool cps_pm_support_state(enum cps_pm_state state); 3890792Sgshapiro 3990792Sgshapiro/** 4090792Sgshapiro * cps_pm_enter_state - enter a PM state 4190792Sgshapiro * @state: the state to enter 4290792Sgshapiro * 4390792Sgshapiro * Enter the given PM state. If coupled_coherence is non-zero then it is 4490792Sgshapiro * expected that this function be called at approximately the same time on 4590792Sgshapiro * each coupled CPU. Returns 0 on successful entry & exit, otherwise -errno. 4690792Sgshapiro */ 4790792Sgshapiroextern int cps_pm_enter_state(enum cps_pm_state state); 4890792Sgshapiro 4990792Sgshapiro#endif /* __MIPS_ASM_PM_CPS_H__ */ 5090792Sgshapiro