xref: /linux/arch/arm/mach-highbank/pm.c (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
19952f691SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
28b61f374SRob Herring /*
38b61f374SRob Herring  * Copyright 2011 Calxeda, Inc.
48b61f374SRob Herring  */
58b61f374SRob Herring 
61ddda1cdSRob Herring #include <linux/cpu_pm.h>
78b61f374SRob Herring #include <linux/init.h>
8be120397SMark Rutland #include <linux/psci.h>
98b61f374SRob Herring #include <linux/suspend.h>
108b61f374SRob Herring 
118b61f374SRob Herring #include <asm/suspend.h>
12be120397SMark Rutland 
13be120397SMark Rutland #include <uapi/linux/psci.h>
14be120397SMark Rutland 
15*774f60ddSArnd Bergmann #include "core.h"
16*774f60ddSArnd Bergmann 
17be120397SMark Rutland #define HIGHBANK_SUSPEND_PARAM \
18be120397SMark Rutland 	((0 << PSCI_0_2_POWER_STATE_ID_SHIFT) | \
19be120397SMark Rutland 	 (1 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) | \
20be120397SMark Rutland 	 (PSCI_POWER_STATE_TYPE_POWER_DOWN << PSCI_0_2_POWER_STATE_TYPE_SHIFT))
218b61f374SRob Herring 
highbank_suspend_finish(unsigned long val)228b61f374SRob Herring static int highbank_suspend_finish(unsigned long val)
238b61f374SRob Herring {
24be120397SMark Rutland 	return psci_ops.cpu_suspend(HIGHBANK_SUSPEND_PARAM, __pa(cpu_resume));
258b61f374SRob Herring }
268b61f374SRob Herring 
highbank_pm_enter(suspend_state_t state)278b61f374SRob Herring static int highbank_pm_enter(suspend_state_t state)
288b61f374SRob Herring {
291ddda1cdSRob Herring 	cpu_pm_enter();
301ddda1cdSRob Herring 	cpu_cluster_pm_enter();
311ddda1cdSRob Herring 
328b61f374SRob Herring 	cpu_suspend(0, highbank_suspend_finish);
338b61f374SRob Herring 
341ddda1cdSRob Herring 	cpu_cluster_pm_exit();
351ddda1cdSRob Herring 	cpu_pm_exit();
361ddda1cdSRob Herring 
378b61f374SRob Herring 	return 0;
388b61f374SRob Herring }
398b61f374SRob Herring 
408b61f374SRob Herring static const struct platform_suspend_ops highbank_pm_ops = {
418b61f374SRob Herring 	.enter = highbank_pm_enter,
428b61f374SRob Herring 	.valid = suspend_valid_only_mem,
438b61f374SRob Herring };
448b61f374SRob Herring 
highbank_pm_init(void)45a283580cSRob Herring void __init highbank_pm_init(void)
468b61f374SRob Herring {
47dd68eb02SRob Herring 	if (!psci_ops.cpu_suspend)
48dd68eb02SRob Herring 		return;
49dd68eb02SRob Herring 
508b61f374SRob Herring 	suspend_set_ops(&highbank_pm_ops);
518b61f374SRob Herring }
52