Lokesh Vutla | 32cd251 | 2018-08-27 15:57:32 +0530 | [diff] [blame^] | 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 | |
| 26 | /** |
| 27 | * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses |
| 28 | * @type: Type of messages: One of TI_SCI_MSG* values |
| 29 | * @host: Host of the message |
| 30 | * @seq: Message identifier indicating a transfer sequence |
| 31 | * @flags: Flag for the message |
| 32 | */ |
| 33 | struct ti_sci_msg_hdr { |
| 34 | u16 type; |
| 35 | u8 host; |
| 36 | u8 seq; |
| 37 | #define TI_SCI_MSG_FLAG(val) (1 << (val)) |
| 38 | #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE 0x0 |
| 39 | #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED TI_SCI_MSG_FLAG(0) |
| 40 | #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED TI_SCI_MSG_FLAG(1) |
| 41 | #define TI_SCI_FLAG_RESP_GENERIC_NACK 0x0 |
| 42 | #define TI_SCI_FLAG_RESP_GENERIC_ACK TI_SCI_MSG_FLAG(1) |
| 43 | /* Additional Flags */ |
| 44 | u32 flags; |
| 45 | } __packed; |
| 46 | |
| 47 | /** |
| 48 | * struct ti_sci_secure_msg_hdr - Header that prefixes all TISCI messages sent |
| 49 | * via secure transport. |
| 50 | * @checksum: crc16 checksum for the entire message |
| 51 | * @reserved: Reserved for future use. |
| 52 | */ |
| 53 | struct ti_sci_secure_msg_hdr { |
| 54 | u16 checksum; |
| 55 | u16 reserved; |
| 56 | } __packed; |
| 57 | |
| 58 | /** |
| 59 | * struct ti_sci_msg_resp_version - Response for a message |
| 60 | * @hdr: Generic header |
| 61 | * @firmware_description: String describing the firmware |
| 62 | * @firmware_revision: Firmware revision |
| 63 | * @abi_major: Major version of the ABI that firmware supports |
| 64 | * @abi_minor: Minor version of the ABI that firmware supports |
| 65 | * |
| 66 | * In general, ABI version changes follow the rule that minor version increments |
| 67 | * are backward compatible. Major revision changes in ABI may not be |
| 68 | * backward compatible. |
| 69 | * |
| 70 | * Response to a generic message with message type TI_SCI_MSG_VERSION |
| 71 | */ |
| 72 | struct ti_sci_msg_resp_version { |
| 73 | struct ti_sci_msg_hdr hdr; |
| 74 | char firmware_description[32]; |
| 75 | u16 firmware_revision; |
| 76 | u8 abi_major; |
| 77 | u8 abi_minor; |
| 78 | } __packed; |
| 79 | |
| 80 | #endif /* __TI_SCI_H */ |