blob: aa13f878cfc63176af30592973bc86af40a515f3 [file] [log] [blame]
Caesar Wang3e3c5b02016-05-25 19:03:04 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Caesar Wang3e3c5b02016-05-25 19:03:04 +08005 */
6
7#ifndef __PLAT_PARAMS_H__
8#define __PLAT_PARAMS_H__
9
10#include <stdint.h>
11
12/*
13 * We defined several plat parameter structs for BL2 to pass platform related
14 * parameters to Rockchip BL31 platform code. All plat parameters start with
15 * a common header, which has a type field to indicate the parameter type, and
16 * a next pointer points to next parameter. If the parameter is the last one in
17 * the list, next pointer will points to NULL. After the header comes the
18 * variable-sized members that describe the parameter. The picture below shows
19 * how the parameters are kept in memory.
20 *
21 * head of list ---> +----------------+ --+
22 * | type | |
23 * +----------------+ |--> struct bl31_plat_param
24 * +----| next | |
25 * | +----------------+ --+
26 * | | parameter data |
27 * | +----------------+
28 * |
29 * +--> +----------------+ --+
30 * | type | |
31 * +----------------+ |--> struct bl31_plat_param
32 * NULL <---| next | |
33 * +----------------+ --+
34 * | parameter data |
35 * +----------------+
36 *
37 * Note: The SCTLR_EL3.A bit (Alignment fault check enable) of ARM TF is set,
38 * so be sure each parameter struct starts on 64-bit aligned address. If not,
39 * alignment fault will occur during accessing its data member.
40 */
41
Caesar Wangef180072016-09-10 02:43:15 +080042#define BL31_GPIO_DIR_OUT 0
43#define BL31_GPIO_DIR_IN 1
44
45#define BL31_GPIO_LEVEL_LOW 0
46#define BL31_GPIO_LEVEL_HIGH 1
47
48#define BL31_GPIO_PULL_NONE 0
49#define BL31_GPIO_PULL_UP 1
50#define BL31_GPIO_PULL_DOWN 2
51
Caesar Wang3e3c5b02016-05-25 19:03:04 +080052/* param type */
53enum {
54 PARAM_NONE = 0,
55 PARAM_RESET,
56 PARAM_POWEROFF,
Caesar Wangef180072016-09-10 02:43:15 +080057 PARAM_SUSPEND_GPIO,
Caesar Wang5045a1c2016-09-10 02:47:53 +080058 PARAM_SUSPEND_APIO,
Caesar Wang3e3c5b02016-05-25 19:03:04 +080059};
60
Caesar Wang5045a1c2016-09-10 02:47:53 +080061struct apio_info {
62 uint8_t apio1 : 1;
63 uint8_t apio2 : 1;
64 uint8_t apio3 : 1;
65 uint8_t apio4 : 1;
66 uint8_t apio5 : 1;
67};
68
Caesar Wang3e3c5b02016-05-25 19:03:04 +080069struct gpio_info {
70 uint8_t polarity;
71 uint8_t direction;
72 uint8_t pull_mode;
73 uint32_t index;
74};
75
76/* common header for all plat parameter type */
77struct bl31_plat_param {
78 uint64_t type;
79 void *next;
80};
81
82struct bl31_gpio_param {
83 struct bl31_plat_param h;
84 struct gpio_info gpio;
85};
86
Caesar Wang5045a1c2016-09-10 02:47:53 +080087struct bl31_apio_param {
88 struct bl31_plat_param h;
89 struct apio_info apio;
90};
91
Caesar Wang3e3c5b02016-05-25 19:03:04 +080092#endif /* __PLAT_PARAMS_H__ */