blob: 1e067c2a6d71f28d5c4f3524eb80da6aad2b2960 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <platform.h>
9#include <psci.h>
10#include <stddef.h>
11
12/*
13 * State IDs for local power states on Juno.
14 */
15#define JUNO_RUN_STATE_ID 0 /* Valid for CPUs and Clusters */
16#define JUNO_RETENTION_STATE_ID 1 /* Valid for only CPUs */
17#define JUNO_OFF_STATE_ID 2 /* Valid for CPUs and Clusters */
18
19/*
20 * Suspend depth definitions for each power state
21 */
22typedef enum {
23 JUNO_RUN_DEPTH = 0,
24 JUNO_RETENTION_DEPTH,
25 JUNO_OFF_DEPTH,
26} suspend_depth_t;
27
28/* The state property array with details of idle state possible for the core */
29static const plat_state_prop_t core_state_prop[] = {
30 {JUNO_RETENTION_DEPTH, JUNO_RETENTION_STATE_ID, PSTATE_TYPE_STANDBY},
31 {JUNO_OFF_DEPTH, JUNO_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN},
32 {0},
33};
34
35/*
36 * The state property array with details of idle state possible
37 * for the cluster
38 */
39static const plat_state_prop_t cluster_state_prop[] = {
40 {JUNO_OFF_DEPTH, JUNO_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN},
41 {0},
42};
43
44/*
45 * The state property array with details of idle state possible
46 * for the system. Currently Juno does not support CPU SUSPEND
47 * at system power level.
48 */
49static const plat_state_prop_t system_state_prop[] = {
50 {JUNO_OFF_DEPTH, JUNO_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN},
51 {0},
52};
53
54const plat_state_prop_t *plat_get_state_prop(unsigned int level)
55{
56 switch (level) {
57 case MPIDR_AFFLVL0:
58 return core_state_prop;
59 case MPIDR_AFFLVL1:
60 return cluster_state_prop;
61 case MPIDR_AFFLVL2:
62 return system_state_prop;
63 default:
64 return NULL;
65 }
66}