1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 23179d37eSPaul Burton /* 33179d37eSPaul Burton * Copyright (C) 2014 Imagination Technologies 4fb615d61SPaul Burton * Author: Paul Burton <paul.burton@mips.com> 53179d37eSPaul Burton */ 63179d37eSPaul Burton 73179d37eSPaul Burton #ifndef __MIPS_ASM_PM_CPS_H__ 83179d37eSPaul Burton #define __MIPS_ASM_PM_CPS_H__ 93179d37eSPaul Burton 103179d37eSPaul Burton /* 113179d37eSPaul Burton * The CM & CPC can only handle coherence & power control on a per-core basis, 12929d4f51SMatt Redfearn * thus in an MT system the VP(E)s within each core are coupled and can only 133179d37eSPaul Burton * enter or exit states requiring CM or CPC assistance in unison. 143179d37eSPaul Burton */ 15929d4f51SMatt Redfearn #if defined(CONFIG_CPU_MIPSR6) 16929d4f51SMatt Redfearn # define coupled_coherence cpu_has_vp 17929d4f51SMatt Redfearn #elif defined(CONFIG_MIPS_MT) 183179d37eSPaul Burton # define coupled_coherence cpu_has_mipsmt 193179d37eSPaul Burton #else 203179d37eSPaul Burton # define coupled_coherence 0 213179d37eSPaul Burton #endif 223179d37eSPaul Burton 233179d37eSPaul Burton /* Enumeration of possible PM states */ 243179d37eSPaul Burton enum cps_pm_state { 253179d37eSPaul Burton CPS_PM_NC_WAIT, /* MIPS wait instruction, non-coherent */ 263179d37eSPaul Burton CPS_PM_CLOCK_GATED, /* Core clock gated */ 273179d37eSPaul Burton CPS_PM_POWER_GATED, /* Core power gated */ 283179d37eSPaul Burton CPS_PM_STATE_COUNT, 293179d37eSPaul Burton }; 303179d37eSPaul Burton 313179d37eSPaul Burton /** 323179d37eSPaul Burton * cps_pm_support_state - determine whether the system supports a PM state 333179d37eSPaul Burton * @state: the state to test for support 343179d37eSPaul Burton * 353179d37eSPaul Burton * Returns true if the system supports the given state, otherwise false. 363179d37eSPaul Burton */ 373179d37eSPaul Burton extern bool cps_pm_support_state(enum cps_pm_state state); 383179d37eSPaul Burton 393179d37eSPaul Burton /** 403179d37eSPaul Burton * cps_pm_enter_state - enter a PM state 413179d37eSPaul Burton * @state: the state to enter 423179d37eSPaul Burton * 433179d37eSPaul Burton * Enter the given PM state. If coupled_coherence is non-zero then it is 443179d37eSPaul Burton * expected that this function be called at approximately the same time on 453179d37eSPaul Burton * each coupled CPU. Returns 0 on successful entry & exit, otherwise -errno. 463179d37eSPaul Burton */ 473179d37eSPaul Burton extern int cps_pm_enter_state(enum cps_pm_state state); 483179d37eSPaul Burton 493179d37eSPaul Burton #endif /* __MIPS_ASM_PM_CPS_H__ */ 50