firmware: ti_sci: Add support for board configuration
[platform/kernel/u-boot.git] / drivers / firmware / ti_sci.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Texas Instruments System Control Interface (TISCI) Protocol
4  *
5  * Communication protocol with TI SCI hardware
6  * The system works in a message response protocol
7  * See: http://processors.wiki.ti.com/index.php/TISCI for details
8  *
9  * Copyright (C)  2018 Texas Instruments Incorporated - http://www.ti.com/
10  * Based on drivers/firmware/ti_sci.h from Linux.
11  *
12  */
13
14 #ifndef __TI_SCI_H
15 #define __TI_SCI_H
16
17 /* Generic Messages */
18 #define TI_SCI_MSG_ENABLE_WDT           0x0000
19 #define TI_SCI_MSG_WAKE_RESET           0x0001
20 #define TI_SCI_MSG_VERSION              0x0002
21 #define TI_SCI_MSG_WAKE_REASON          0x0003
22 #define TI_SCI_MSG_GOODBYE              0x0004
23 #define TI_SCI_MSG_SYS_RESET            0x0005
24 #define TI_SCI_MSG_BOARD_CONFIG         0x000b
25 #define TI_SCI_MSG_BOARD_CONFIG_RM      0x000c
26 #define TI_SCI_MSG_BOARD_CONFIG_SECURITY  0x000d
27 #define TI_SCI_MSG_BOARD_CONFIG_PM      0x000e
28
29 /**
30  * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
31  * @type:       Type of messages: One of TI_SCI_MSG* values
32  * @host:       Host of the message
33  * @seq:        Message identifier indicating a transfer sequence
34  * @flags:      Flag for the message
35  */
36 struct ti_sci_msg_hdr {
37         u16 type;
38         u8 host;
39         u8 seq;
40 #define TI_SCI_MSG_FLAG(val)                    (1 << (val))
41 #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE      0x0
42 #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED         TI_SCI_MSG_FLAG(0)
43 #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED        TI_SCI_MSG_FLAG(1)
44 #define TI_SCI_FLAG_RESP_GENERIC_NACK           0x0
45 #define TI_SCI_FLAG_RESP_GENERIC_ACK            TI_SCI_MSG_FLAG(1)
46         /* Additional Flags */
47         u32 flags;
48 } __packed;
49
50 /**
51  * struct ti_sci_secure_msg_hdr - Header that prefixes all TISCI messages sent
52  *                                via secure transport.
53  * @checksum:   crc16 checksum for the entire message
54  * @reserved:   Reserved for future use.
55  */
56 struct ti_sci_secure_msg_hdr {
57         u16 checksum;
58         u16 reserved;
59 } __packed;
60
61 /**
62  * struct ti_sci_msg_resp_version - Response for a message
63  * @hdr:                Generic header
64  * @firmware_description: String describing the firmware
65  * @firmware_revision:  Firmware revision
66  * @abi_major:          Major version of the ABI that firmware supports
67  * @abi_minor:          Minor version of the ABI that firmware supports
68  *
69  * In general, ABI version changes follow the rule that minor version increments
70  * are backward compatible. Major revision changes in ABI may not be
71  * backward compatible.
72  *
73  * Response to a generic message with message type TI_SCI_MSG_VERSION
74  */
75 struct ti_sci_msg_resp_version {
76         struct ti_sci_msg_hdr hdr;
77         char firmware_description[32];
78         u16 firmware_revision;
79         u8 abi_major;
80         u8 abi_minor;
81 } __packed;
82
83 /**
84  * struct ti_sci_msg_board_config - Board configuration message
85  * @hdr:                Generic Header
86  * @boardcfgp_low:      Lower 32 bit of the pointer pointing to the board
87  *                      configuration data
88  * @boardcfgp_high:     Upper 32 bit of the pointer pointing to the board
89  *                      configuration data
90  * @boardcfg_size:      Size of board configuration data object
91  * Request type is TI_SCI_MSG_BOARD_CONFIG, responded with a generic
92  * ACK/NACK message.
93  */
94 struct ti_sci_msg_board_config {
95         struct ti_sci_msg_hdr hdr;
96         u32 boardcfgp_low;
97         u32 boardcfgp_high;
98         u16 boardcfg_size;
99 } __packed;
100
101 #endif /* __TI_SCI_H */