Nishanth Menon | aa27678 | 2016-10-18 18:08:34 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * Texas Instruments System Control Interface (TISCI) Protocol |
| 3 | * |
| 4 | * Communication protocol with TI SCI hardware |
| 5 | * The system works in a message response protocol |
| 6 | * See: http://processors.wiki.ti.com/index.php/TISCI for details |
| 7 | * |
| 8 | * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions |
| 12 | * are met: |
| 13 | * |
| 14 | * Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer. |
| 16 | * |
| 17 | * Redistributions in binary form must reproduce the above copyright |
| 18 | * notice, this list of conditions and the following disclaimer in the |
| 19 | * documentation and/or other materials provided with the |
| 20 | * distribution. |
| 21 | * |
| 22 | * Neither the name of Texas Instruments Incorporated nor the names of |
| 23 | * its contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 30 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 32 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 33 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 34 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 35 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 36 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 37 | * |
| 38 | */ |
| 39 | |
| 40 | #ifndef __TI_SCI_H |
| 41 | #define __TI_SCI_H |
| 42 | |
| 43 | /* Generic Messages */ |
| 44 | #define TI_SCI_MSG_ENABLE_WDT 0x0000 |
| 45 | #define TI_SCI_MSG_WAKE_RESET 0x0001 |
| 46 | #define TI_SCI_MSG_VERSION 0x0002 |
| 47 | #define TI_SCI_MSG_WAKE_REASON 0x0003 |
| 48 | #define TI_SCI_MSG_GOODBYE 0x0004 |
| 49 | |
| 50 | /** |
| 51 | * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses |
| 52 | * @type: Type of messages: One of TI_SCI_MSG* values |
| 53 | * @host: Host of the message |
| 54 | * @seq: Message identifier indicating a transfer sequence |
| 55 | * @flags: Flag for the message |
| 56 | */ |
| 57 | struct ti_sci_msg_hdr { |
| 58 | u16 type; |
| 59 | u8 host; |
| 60 | u8 seq; |
| 61 | #define TI_SCI_MSG_FLAG(val) (1 << (val)) |
| 62 | #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE 0x0 |
| 63 | #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED TI_SCI_MSG_FLAG(0) |
| 64 | #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED TI_SCI_MSG_FLAG(1) |
| 65 | #define TI_SCI_FLAG_RESP_GENERIC_NACK 0x0 |
| 66 | #define TI_SCI_FLAG_RESP_GENERIC_ACK TI_SCI_MSG_FLAG(1) |
| 67 | /* Additional Flags */ |
| 68 | u32 flags; |
| 69 | } __packed; |
| 70 | |
| 71 | /** |
| 72 | * struct ti_sci_msg_resp_version - Response for a message |
| 73 | * @hdr: Generic header |
| 74 | * @firmware_description: String describing the firmware |
| 75 | * @firmware_revision: Firmware revision |
| 76 | * @abi_major: Major version of the ABI that firmware supports |
| 77 | * @abi_minor: Minor version of the ABI that firmware supports |
| 78 | * |
| 79 | * In general, ABI version changes follow the rule that minor version increments |
| 80 | * are backward compatible. Major revision changes in ABI may not be |
| 81 | * backward compatible. |
| 82 | * |
| 83 | * Response to a generic message with message type TI_SCI_MSG_VERSION |
| 84 | */ |
| 85 | struct ti_sci_msg_resp_version { |
| 86 | struct ti_sci_msg_hdr hdr; |
| 87 | char firmware_description[32]; |
| 88 | u16 firmware_revision; |
| 89 | u8 abi_major; |
| 90 | u8 abi_minor; |
| 91 | } __packed; |
| 92 | |
| 93 | #endif /* __TI_SCI_H */ |