xref: /openbmc/linux/arch/mips/include/asm/pm-cps.h (revision 929d4f51e6b87900c9179eb62d6b43db6ce4930d)
13179d37eSPaul Burton /*
23179d37eSPaul Burton  * Copyright (C) 2014 Imagination Technologies
33179d37eSPaul Burton  * Author: Paul Burton <paul.burton@imgtec.com>
43179d37eSPaul Burton  *
53179d37eSPaul Burton  * This program is free software; you can redistribute it and/or modify it
63179d37eSPaul Burton  * under the terms of the GNU General Public License as published by the
73179d37eSPaul Burton  * Free Software Foundation;  either version 2 of the  License, or (at your
83179d37eSPaul Burton  * option) any later version.
93179d37eSPaul Burton  */
103179d37eSPaul Burton 
113179d37eSPaul Burton #ifndef __MIPS_ASM_PM_CPS_H__
123179d37eSPaul Burton #define __MIPS_ASM_PM_CPS_H__
133179d37eSPaul Burton 
143179d37eSPaul Burton /*
153179d37eSPaul Burton  * The CM & CPC can only handle coherence & power control on a per-core basis,
16*929d4f51SMatt Redfearn  * thus in an MT system the VP(E)s within each core are coupled and can only
173179d37eSPaul Burton  * enter or exit states requiring CM or CPC assistance in unison.
183179d37eSPaul Burton  */
19*929d4f51SMatt Redfearn #if defined(CONFIG_CPU_MIPSR6)
20*929d4f51SMatt Redfearn # define coupled_coherence cpu_has_vp
21*929d4f51SMatt Redfearn #elif defined(CONFIG_MIPS_MT)
223179d37eSPaul Burton # define coupled_coherence cpu_has_mipsmt
233179d37eSPaul Burton #else
243179d37eSPaul Burton # define coupled_coherence 0
253179d37eSPaul Burton #endif
263179d37eSPaul Burton 
273179d37eSPaul Burton /* Enumeration of possible PM states */
283179d37eSPaul Burton enum cps_pm_state {
293179d37eSPaul Burton 	CPS_PM_NC_WAIT,		/* MIPS wait instruction, non-coherent */
303179d37eSPaul Burton 	CPS_PM_CLOCK_GATED,	/* Core clock gated */
313179d37eSPaul Burton 	CPS_PM_POWER_GATED,	/* Core power gated */
323179d37eSPaul Burton 	CPS_PM_STATE_COUNT,
333179d37eSPaul Burton };
343179d37eSPaul Burton 
353179d37eSPaul Burton /**
363179d37eSPaul Burton  * cps_pm_support_state - determine whether the system supports a PM state
373179d37eSPaul Burton  * @state: the state to test for support
383179d37eSPaul Burton  *
393179d37eSPaul Burton  * Returns true if the system supports the given state, otherwise false.
403179d37eSPaul Burton  */
413179d37eSPaul Burton extern bool cps_pm_support_state(enum cps_pm_state state);
423179d37eSPaul Burton 
433179d37eSPaul Burton /**
443179d37eSPaul Burton  * cps_pm_enter_state - enter a PM state
453179d37eSPaul Burton  * @state: the state to enter
463179d37eSPaul Burton  *
473179d37eSPaul Burton  * Enter the given PM state. If coupled_coherence is non-zero then it is
483179d37eSPaul Burton  * expected that this function be called at approximately the same time on
493179d37eSPaul Burton  * each coupled CPU. Returns 0 on successful entry & exit, otherwise -errno.
503179d37eSPaul Burton  */
513179d37eSPaul Burton extern int cps_pm_enter_state(enum cps_pm_state state);
523179d37eSPaul Burton 
533179d37eSPaul Burton #endif /* __MIPS_ASM_PM_CPS_H__ */
54