11e0a6014SLokesh Vutla // SPDX-License-Identifier: BSD-3-Clause 2aa276781SNishanth Menon /* 3aa276781SNishanth Menon * Texas Instruments System Control Interface (TISCI) Protocol 4aa276781SNishanth Menon * 5aa276781SNishanth Menon * Communication protocol with TI SCI hardware 6aa276781SNishanth Menon * The system works in a message response protocol 7aa276781SNishanth Menon * See: http://processors.wiki.ti.com/index.php/TISCI for details 8aa276781SNishanth Menon * 9aa276781SNishanth Menon * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 10aa276781SNishanth Menon */ 11aa276781SNishanth Menon 12aa276781SNishanth Menon #ifndef __TI_SCI_H 13aa276781SNishanth Menon #define __TI_SCI_H 14aa276781SNishanth Menon 15aa276781SNishanth Menon /* Generic Messages */ 16aa276781SNishanth Menon #define TI_SCI_MSG_ENABLE_WDT 0x0000 17aa276781SNishanth Menon #define TI_SCI_MSG_WAKE_RESET 0x0001 18aa276781SNishanth Menon #define TI_SCI_MSG_VERSION 0x0002 19aa276781SNishanth Menon #define TI_SCI_MSG_WAKE_REASON 0x0003 20aa276781SNishanth Menon #define TI_SCI_MSG_GOODBYE 0x0004 21912cffb4SNishanth Menon #define TI_SCI_MSG_SYS_RESET 0x0005 22aa276781SNishanth Menon 239e7d756dSNishanth Menon /* Device requests */ 249e7d756dSNishanth Menon #define TI_SCI_MSG_SET_DEVICE_STATE 0x0200 259e7d756dSNishanth Menon #define TI_SCI_MSG_GET_DEVICE_STATE 0x0201 269e7d756dSNishanth Menon #define TI_SCI_MSG_SET_DEVICE_RESETS 0x0202 279e7d756dSNishanth Menon 289f723220SNishanth Menon /* Clock requests */ 299f723220SNishanth Menon #define TI_SCI_MSG_SET_CLOCK_STATE 0x0100 309f723220SNishanth Menon #define TI_SCI_MSG_GET_CLOCK_STATE 0x0101 319f723220SNishanth Menon #define TI_SCI_MSG_SET_CLOCK_PARENT 0x0102 329f723220SNishanth Menon #define TI_SCI_MSG_GET_CLOCK_PARENT 0x0103 339f723220SNishanth Menon #define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104 349f723220SNishanth Menon #define TI_SCI_MSG_SET_CLOCK_FREQ 0x010c 359f723220SNishanth Menon #define TI_SCI_MSG_QUERY_CLOCK_FREQ 0x010d 369f723220SNishanth Menon #define TI_SCI_MSG_GET_CLOCK_FREQ 0x010e 379f723220SNishanth Menon 38*9c19fb68SLokesh Vutla /* Resource Management Requests */ 39*9c19fb68SLokesh Vutla #define TI_SCI_MSG_GET_RESOURCE_RANGE 0x1500 40*9c19fb68SLokesh Vutla 41aa276781SNishanth Menon /** 42aa276781SNishanth Menon * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses 43aa276781SNishanth Menon * @type: Type of messages: One of TI_SCI_MSG* values 44aa276781SNishanth Menon * @host: Host of the message 45aa276781SNishanth Menon * @seq: Message identifier indicating a transfer sequence 46aa276781SNishanth Menon * @flags: Flag for the message 47aa276781SNishanth Menon */ 48aa276781SNishanth Menon struct ti_sci_msg_hdr { 49aa276781SNishanth Menon u16 type; 50aa276781SNishanth Menon u8 host; 51aa276781SNishanth Menon u8 seq; 52aa276781SNishanth Menon #define TI_SCI_MSG_FLAG(val) (1 << (val)) 53aa276781SNishanth Menon #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE 0x0 54aa276781SNishanth Menon #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED TI_SCI_MSG_FLAG(0) 55aa276781SNishanth Menon #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED TI_SCI_MSG_FLAG(1) 56aa276781SNishanth Menon #define TI_SCI_FLAG_RESP_GENERIC_NACK 0x0 57aa276781SNishanth Menon #define TI_SCI_FLAG_RESP_GENERIC_ACK TI_SCI_MSG_FLAG(1) 58aa276781SNishanth Menon /* Additional Flags */ 59aa276781SNishanth Menon u32 flags; 60aa276781SNishanth Menon } __packed; 61aa276781SNishanth Menon 62aa276781SNishanth Menon /** 63aa276781SNishanth Menon * struct ti_sci_msg_resp_version - Response for a message 64aa276781SNishanth Menon * @hdr: Generic header 65aa276781SNishanth Menon * @firmware_description: String describing the firmware 66aa276781SNishanth Menon * @firmware_revision: Firmware revision 67aa276781SNishanth Menon * @abi_major: Major version of the ABI that firmware supports 68aa276781SNishanth Menon * @abi_minor: Minor version of the ABI that firmware supports 69aa276781SNishanth Menon * 70aa276781SNishanth Menon * In general, ABI version changes follow the rule that minor version increments 71aa276781SNishanth Menon * are backward compatible. Major revision changes in ABI may not be 72aa276781SNishanth Menon * backward compatible. 73aa276781SNishanth Menon * 74aa276781SNishanth Menon * Response to a generic message with message type TI_SCI_MSG_VERSION 75aa276781SNishanth Menon */ 76aa276781SNishanth Menon struct ti_sci_msg_resp_version { 77aa276781SNishanth Menon struct ti_sci_msg_hdr hdr; 78aa276781SNishanth Menon char firmware_description[32]; 79aa276781SNishanth Menon u16 firmware_revision; 80aa276781SNishanth Menon u8 abi_major; 81aa276781SNishanth Menon u8 abi_minor; 82aa276781SNishanth Menon } __packed; 83aa276781SNishanth Menon 849e7d756dSNishanth Menon /** 85912cffb4SNishanth Menon * struct ti_sci_msg_req_reboot - Reboot the SoC 86912cffb4SNishanth Menon * @hdr: Generic Header 87912cffb4SNishanth Menon * 88912cffb4SNishanth Menon * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic 89912cffb4SNishanth Menon * ACK/NACK message. 90912cffb4SNishanth Menon */ 91912cffb4SNishanth Menon struct ti_sci_msg_req_reboot { 92912cffb4SNishanth Menon struct ti_sci_msg_hdr hdr; 93912cffb4SNishanth Menon } __packed; 94912cffb4SNishanth Menon 95912cffb4SNishanth Menon /** 969e7d756dSNishanth Menon * struct ti_sci_msg_req_set_device_state - Set the desired state of the device 979e7d756dSNishanth Menon * @hdr: Generic header 989e7d756dSNishanth Menon * @id: Indicates which device to modify 999e7d756dSNishanth Menon * @reserved: Reserved space in message, must be 0 for backward compatibility 1009e7d756dSNishanth Menon * @state: The desired state of the device. 1019e7d756dSNishanth Menon * 1029e7d756dSNishanth Menon * Certain flags can also be set to alter the device state: 1039e7d756dSNishanth Menon * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source. 1049e7d756dSNishanth Menon * The meaning of this flag will vary slightly from device to device and from 1059e7d756dSNishanth Menon * SoC to SoC but it generally allows the device to wake the SoC out of deep 1069e7d756dSNishanth Menon * suspend states. 1079e7d756dSNishanth Menon * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device. 1089e7d756dSNishanth Menon * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed 1099e7d756dSNishanth Menon * with STATE_RETENTION or STATE_ON, it will claim the device exclusively. 1109e7d756dSNishanth Menon * If another host already has this device set to STATE_RETENTION or STATE_ON, 1119e7d756dSNishanth Menon * the message will fail. Once successful, other hosts attempting to set 1129e7d756dSNishanth Menon * STATE_RETENTION or STATE_ON will fail. 1139e7d756dSNishanth Menon * 1149e7d756dSNishanth Menon * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic 1159e7d756dSNishanth Menon * ACK/NACK message. 1169e7d756dSNishanth Menon */ 1179e7d756dSNishanth Menon struct ti_sci_msg_req_set_device_state { 1189e7d756dSNishanth Menon /* Additional hdr->flags options */ 1199e7d756dSNishanth Menon #define MSG_FLAG_DEVICE_WAKE_ENABLED TI_SCI_MSG_FLAG(8) 1209e7d756dSNishanth Menon #define MSG_FLAG_DEVICE_RESET_ISO TI_SCI_MSG_FLAG(9) 1219e7d756dSNishanth Menon #define MSG_FLAG_DEVICE_EXCLUSIVE TI_SCI_MSG_FLAG(10) 1229e7d756dSNishanth Menon struct ti_sci_msg_hdr hdr; 1239e7d756dSNishanth Menon u32 id; 1249e7d756dSNishanth Menon u32 reserved; 1259e7d756dSNishanth Menon 1269e7d756dSNishanth Menon #define MSG_DEVICE_SW_STATE_AUTO_OFF 0 1279e7d756dSNishanth Menon #define MSG_DEVICE_SW_STATE_RETENTION 1 1289e7d756dSNishanth Menon #define MSG_DEVICE_SW_STATE_ON 2 1299e7d756dSNishanth Menon u8 state; 1309e7d756dSNishanth Menon } __packed; 1319e7d756dSNishanth Menon 1329e7d756dSNishanth Menon /** 1339e7d756dSNishanth Menon * struct ti_sci_msg_req_get_device_state - Request to get device. 1349e7d756dSNishanth Menon * @hdr: Generic header 1359e7d756dSNishanth Menon * @id: Device Identifier 1369e7d756dSNishanth Menon * 1379e7d756dSNishanth Menon * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state 1389e7d756dSNishanth Menon * information 1399e7d756dSNishanth Menon */ 1409e7d756dSNishanth Menon struct ti_sci_msg_req_get_device_state { 1419e7d756dSNishanth Menon struct ti_sci_msg_hdr hdr; 1429e7d756dSNishanth Menon u32 id; 1439e7d756dSNishanth Menon } __packed; 1449e7d756dSNishanth Menon 1459e7d756dSNishanth Menon /** 1469e7d756dSNishanth Menon * struct ti_sci_msg_resp_get_device_state - Response to get device request. 1479e7d756dSNishanth Menon * @hdr: Generic header 1489e7d756dSNishanth Menon * @context_loss_count: Indicates how many times the device has lost context. A 1499e7d756dSNishanth Menon * driver can use this monotonic counter to determine if the device has 1509e7d756dSNishanth Menon * lost context since the last time this message was exchanged. 1519e7d756dSNishanth Menon * @resets: Programmed state of the reset lines. 1529e7d756dSNishanth Menon * @programmed_state: The state as programmed by set_device. 1539e7d756dSNishanth Menon * - Uses the MSG_DEVICE_SW_* macros 1549e7d756dSNishanth Menon * @current_state: The actual state of the hardware. 1559e7d756dSNishanth Menon * 1569e7d756dSNishanth Menon * Response to request TI_SCI_MSG_GET_DEVICE_STATE. 1579e7d756dSNishanth Menon */ 1589e7d756dSNishanth Menon struct ti_sci_msg_resp_get_device_state { 1599e7d756dSNishanth Menon struct ti_sci_msg_hdr hdr; 1609e7d756dSNishanth Menon u32 context_loss_count; 1619e7d756dSNishanth Menon u32 resets; 1629e7d756dSNishanth Menon u8 programmed_state; 1639e7d756dSNishanth Menon #define MSG_DEVICE_HW_STATE_OFF 0 1649e7d756dSNishanth Menon #define MSG_DEVICE_HW_STATE_ON 1 1659e7d756dSNishanth Menon #define MSG_DEVICE_HW_STATE_TRANS 2 1669e7d756dSNishanth Menon u8 current_state; 1679e7d756dSNishanth Menon } __packed; 1689e7d756dSNishanth Menon 1699e7d756dSNishanth Menon /** 1709e7d756dSNishanth Menon * struct ti_sci_msg_req_set_device_resets - Set the desired resets 1719e7d756dSNishanth Menon * configuration of the device 1729e7d756dSNishanth Menon * @hdr: Generic header 1739e7d756dSNishanth Menon * @id: Indicates which device to modify 1749e7d756dSNishanth Menon * @resets: A bit field of resets for the device. The meaning, behavior, 1759e7d756dSNishanth Menon * and usage of the reset flags are device specific. 0 for a bit 1769e7d756dSNishanth Menon * indicates releasing the reset represented by that bit while 1 1779e7d756dSNishanth Menon * indicates keeping it held. 1789e7d756dSNishanth Menon * 1799e7d756dSNishanth Menon * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic 1809e7d756dSNishanth Menon * ACK/NACK message. 1819e7d756dSNishanth Menon */ 1829e7d756dSNishanth Menon struct ti_sci_msg_req_set_device_resets { 1839e7d756dSNishanth Menon struct ti_sci_msg_hdr hdr; 1849e7d756dSNishanth Menon u32 id; 1859e7d756dSNishanth Menon u32 resets; 1869e7d756dSNishanth Menon } __packed; 1879e7d756dSNishanth Menon 1889f723220SNishanth Menon /** 1899f723220SNishanth Menon * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state 1909f723220SNishanth Menon * @hdr: Generic Header, Certain flags can be set specific to the clocks: 1919f723220SNishanth Menon * MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified 1929f723220SNishanth Menon * via spread spectrum clocking. 1939f723220SNishanth Menon * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's 1949f723220SNishanth Menon * frequency to be changed while it is running so long as it 1959f723220SNishanth Menon * is within the min/max limits. 1969f723220SNishanth Menon * MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this 1979f723220SNishanth Menon * is only applicable to clock inputs on the SoC pseudo-device. 1989f723220SNishanth Menon * @dev_id: Device identifier this request is for 1999f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 2009f723220SNishanth Menon * Each device has it's own set of clock inputs. This indexes 2019f723220SNishanth Menon * which clock input to modify. 2029f723220SNishanth Menon * @request_state: Request the state for the clock to be set to. 2039f723220SNishanth Menon * MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock, 2049f723220SNishanth Menon * it can be disabled, regardless of the state of the device 2059f723220SNishanth Menon * MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to 2069f723220SNishanth Menon * automatically manage the state of this clock. If the device 2079f723220SNishanth Menon * is enabled, then the clock is enabled. If the device is set 2089f723220SNishanth Menon * to off or retention, then the clock is internally set as not 2099f723220SNishanth Menon * being required by the device.(default) 2109f723220SNishanth Menon * MSG_CLOCK_SW_STATE_REQ: Configure the clock to be enabled, 2119f723220SNishanth Menon * regardless of the state of the device. 2129f723220SNishanth Menon * 2139f723220SNishanth Menon * Normally, all required clocks are managed by TISCI entity, this is used 2149f723220SNishanth Menon * only for specific control *IF* required. Auto managed state is 2159f723220SNishanth Menon * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote 2169f723220SNishanth Menon * will explicitly control. 2179f723220SNishanth Menon * 2189f723220SNishanth Menon * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic 2199f723220SNishanth Menon * ACK or NACK message. 2209f723220SNishanth Menon */ 2219f723220SNishanth Menon struct ti_sci_msg_req_set_clock_state { 2229f723220SNishanth Menon /* Additional hdr->flags options */ 2239f723220SNishanth Menon #define MSG_FLAG_CLOCK_ALLOW_SSC TI_SCI_MSG_FLAG(8) 2249f723220SNishanth Menon #define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE TI_SCI_MSG_FLAG(9) 2259f723220SNishanth Menon #define MSG_FLAG_CLOCK_INPUT_TERM TI_SCI_MSG_FLAG(10) 2269f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 2279f723220SNishanth Menon u32 dev_id; 2289f723220SNishanth Menon u8 clk_id; 2299f723220SNishanth Menon #define MSG_CLOCK_SW_STATE_UNREQ 0 2309f723220SNishanth Menon #define MSG_CLOCK_SW_STATE_AUTO 1 2319f723220SNishanth Menon #define MSG_CLOCK_SW_STATE_REQ 2 2329f723220SNishanth Menon u8 request_state; 2339f723220SNishanth Menon } __packed; 2349f723220SNishanth Menon 2359f723220SNishanth Menon /** 2369f723220SNishanth Menon * struct ti_sci_msg_req_get_clock_state - Request for clock state 2379f723220SNishanth Menon * @hdr: Generic Header 2389f723220SNishanth Menon * @dev_id: Device identifier this request is for 2399f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 2409f723220SNishanth Menon * Each device has it's own set of clock inputs. This indexes 2419f723220SNishanth Menon * which clock input to get state of. 2429f723220SNishanth Menon * 2439f723220SNishanth Menon * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state 2449f723220SNishanth Menon * of the clock 2459f723220SNishanth Menon */ 2469f723220SNishanth Menon struct ti_sci_msg_req_get_clock_state { 2479f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 2489f723220SNishanth Menon u32 dev_id; 2499f723220SNishanth Menon u8 clk_id; 2509f723220SNishanth Menon } __packed; 2519f723220SNishanth Menon 2529f723220SNishanth Menon /** 2539f723220SNishanth Menon * struct ti_sci_msg_resp_get_clock_state - Response to get clock state 2549f723220SNishanth Menon * @hdr: Generic Header 2559f723220SNishanth Menon * @programmed_state: Any programmed state of the clock. This is one of 2569f723220SNishanth Menon * MSG_CLOCK_SW_STATE* values. 2579f723220SNishanth Menon * @current_state: Current state of the clock. This is one of: 2589f723220SNishanth Menon * MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready 2599f723220SNishanth Menon * MSG_CLOCK_HW_STATE_READY: Clock is ready 2609f723220SNishanth Menon * 2619f723220SNishanth Menon * Response to TI_SCI_MSG_GET_CLOCK_STATE. 2629f723220SNishanth Menon */ 2639f723220SNishanth Menon struct ti_sci_msg_resp_get_clock_state { 2649f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 2659f723220SNishanth Menon u8 programmed_state; 2669f723220SNishanth Menon #define MSG_CLOCK_HW_STATE_NOT_READY 0 2679f723220SNishanth Menon #define MSG_CLOCK_HW_STATE_READY 1 2689f723220SNishanth Menon u8 current_state; 2699f723220SNishanth Menon } __packed; 2709f723220SNishanth Menon 2719f723220SNishanth Menon /** 2729f723220SNishanth Menon * struct ti_sci_msg_req_set_clock_parent - Set the clock parent 2739f723220SNishanth Menon * @hdr: Generic Header 2749f723220SNishanth Menon * @dev_id: Device identifier this request is for 2759f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 2769f723220SNishanth Menon * Each device has it's own set of clock inputs. This indexes 2779f723220SNishanth Menon * which clock input to modify. 2789f723220SNishanth Menon * @parent_id: The new clock parent is selectable by an index via this 2799f723220SNishanth Menon * parameter. 2809f723220SNishanth Menon * 2819f723220SNishanth Menon * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic 2829f723220SNishanth Menon * ACK / NACK message. 2839f723220SNishanth Menon */ 2849f723220SNishanth Menon struct ti_sci_msg_req_set_clock_parent { 2859f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 2869f723220SNishanth Menon u32 dev_id; 2879f723220SNishanth Menon u8 clk_id; 2889f723220SNishanth Menon u8 parent_id; 2899f723220SNishanth Menon } __packed; 2909f723220SNishanth Menon 2919f723220SNishanth Menon /** 2929f723220SNishanth Menon * struct ti_sci_msg_req_get_clock_parent - Get the clock parent 2939f723220SNishanth Menon * @hdr: Generic Header 2949f723220SNishanth Menon * @dev_id: Device identifier this request is for 2959f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 2969f723220SNishanth Menon * Each device has it's own set of clock inputs. This indexes 2979f723220SNishanth Menon * which clock input to get the parent for. 2989f723220SNishanth Menon * 2999f723220SNishanth Menon * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information 3009f723220SNishanth Menon */ 3019f723220SNishanth Menon struct ti_sci_msg_req_get_clock_parent { 3029f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 3039f723220SNishanth Menon u32 dev_id; 3049f723220SNishanth Menon u8 clk_id; 3059f723220SNishanth Menon } __packed; 3069f723220SNishanth Menon 3079f723220SNishanth Menon /** 3089f723220SNishanth Menon * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent 3099f723220SNishanth Menon * @hdr: Generic Header 3109f723220SNishanth Menon * @parent_id: The current clock parent 3119f723220SNishanth Menon * 3129f723220SNishanth Menon * Response to TI_SCI_MSG_GET_CLOCK_PARENT. 3139f723220SNishanth Menon */ 3149f723220SNishanth Menon struct ti_sci_msg_resp_get_clock_parent { 3159f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 3169f723220SNishanth Menon u8 parent_id; 3179f723220SNishanth Menon } __packed; 3189f723220SNishanth Menon 3199f723220SNishanth Menon /** 3209f723220SNishanth Menon * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents 3219f723220SNishanth Menon * @hdr: Generic header 3229f723220SNishanth Menon * @dev_id: Device identifier this request is for 3239f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 3249f723220SNishanth Menon * 3259f723220SNishanth Menon * This request provides information about how many clock parent options 3269f723220SNishanth Menon * are available for a given clock to a device. This is typically used 3279f723220SNishanth Menon * for input clocks. 3289f723220SNishanth Menon * 3299f723220SNishanth Menon * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate 3309f723220SNishanth Menon * message, or NACK in case of inability to satisfy request. 3319f723220SNishanth Menon */ 3329f723220SNishanth Menon struct ti_sci_msg_req_get_clock_num_parents { 3339f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 3349f723220SNishanth Menon u32 dev_id; 3359f723220SNishanth Menon u8 clk_id; 3369f723220SNishanth Menon } __packed; 3379f723220SNishanth Menon 3389f723220SNishanth Menon /** 3399f723220SNishanth Menon * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents 3409f723220SNishanth Menon * @hdr: Generic header 3419f723220SNishanth Menon * @num_parents: Number of clock parents 3429f723220SNishanth Menon * 3439f723220SNishanth Menon * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 3449f723220SNishanth Menon */ 3459f723220SNishanth Menon struct ti_sci_msg_resp_get_clock_num_parents { 3469f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 3479f723220SNishanth Menon u8 num_parents; 3489f723220SNishanth Menon } __packed; 3499f723220SNishanth Menon 3509f723220SNishanth Menon /** 3519f723220SNishanth Menon * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency 3529f723220SNishanth Menon * @hdr: Generic Header 3539f723220SNishanth Menon * @dev_id: Device identifier this request is for 3549f723220SNishanth Menon * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum 3559f723220SNishanth Menon * allowable programmed frequency and does not account for clock 3569f723220SNishanth Menon * tolerances and jitter. 3579f723220SNishanth Menon * @target_freq_hz: The target clock frequency. A frequency will be found 3589f723220SNishanth Menon * as close to this target frequency as possible. 3599f723220SNishanth Menon * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum 3609f723220SNishanth Menon * allowable programmed frequency and does not account for clock 3619f723220SNishanth Menon * tolerances and jitter. 3629f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 3639f723220SNishanth Menon * 3649f723220SNishanth Menon * NOTE: Normally clock frequency management is automatically done by TISCI 3659f723220SNishanth Menon * entity. In case of specific requests, TISCI evaluates capability to achieve 3669f723220SNishanth Menon * requested frequency within provided range and responds with 3679f723220SNishanth Menon * result message. 3689f723220SNishanth Menon * 3699f723220SNishanth Menon * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message, 3709f723220SNishanth Menon * or NACK in case of inability to satisfy request. 3719f723220SNishanth Menon */ 3729f723220SNishanth Menon struct ti_sci_msg_req_query_clock_freq { 3739f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 3749f723220SNishanth Menon u32 dev_id; 3759f723220SNishanth Menon u64 min_freq_hz; 3769f723220SNishanth Menon u64 target_freq_hz; 3779f723220SNishanth Menon u64 max_freq_hz; 3789f723220SNishanth Menon u8 clk_id; 3799f723220SNishanth Menon } __packed; 3809f723220SNishanth Menon 3819f723220SNishanth Menon /** 3829f723220SNishanth Menon * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query 3839f723220SNishanth Menon * @hdr: Generic Header 3849f723220SNishanth Menon * @freq_hz: Frequency that is the best match in Hz. 3859f723220SNishanth Menon * 3869f723220SNishanth Menon * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request 3879f723220SNishanth Menon * cannot be satisfied, the message will be of type NACK. 3889f723220SNishanth Menon */ 3899f723220SNishanth Menon struct ti_sci_msg_resp_query_clock_freq { 3909f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 3919f723220SNishanth Menon u64 freq_hz; 3929f723220SNishanth Menon } __packed; 3939f723220SNishanth Menon 3949f723220SNishanth Menon /** 3959f723220SNishanth Menon * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency 3969f723220SNishanth Menon * @hdr: Generic Header 3979f723220SNishanth Menon * @dev_id: Device identifier this request is for 3989f723220SNishanth Menon * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum 3999f723220SNishanth Menon * allowable programmed frequency and does not account for clock 4009f723220SNishanth Menon * tolerances and jitter. 4019f723220SNishanth Menon * @target_freq_hz: The target clock frequency. The clock will be programmed 4029f723220SNishanth Menon * at a rate as close to this target frequency as possible. 4039f723220SNishanth Menon * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum 4049f723220SNishanth Menon * allowable programmed frequency and does not account for clock 4059f723220SNishanth Menon * tolerances and jitter. 4069f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 4079f723220SNishanth Menon * 4089f723220SNishanth Menon * NOTE: Normally clock frequency management is automatically done by TISCI 4099f723220SNishanth Menon * entity. In case of specific requests, TISCI evaluates capability to achieve 4109f723220SNishanth Menon * requested range and responds with success/failure message. 4119f723220SNishanth Menon * 4129f723220SNishanth Menon * This sets the desired frequency for a clock within an allowable 4139f723220SNishanth Menon * range. This message will fail on an enabled clock unless 4149f723220SNishanth Menon * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally, 4159f723220SNishanth Menon * if other clocks have their frequency modified due to this message, 4169f723220SNishanth Menon * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled. 4179f723220SNishanth Menon * 4189f723220SNishanth Menon * Calling set frequency on a clock input to the SoC pseudo-device will 4199f723220SNishanth Menon * inform the PMMC of that clock's frequency. Setting a frequency of 4209f723220SNishanth Menon * zero will indicate the clock is disabled. 4219f723220SNishanth Menon * 4229f723220SNishanth Menon * Calling set frequency on clock outputs from the SoC pseudo-device will 4239f723220SNishanth Menon * function similarly to setting the clock frequency on a device. 4249f723220SNishanth Menon * 4259f723220SNishanth Menon * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK 4269f723220SNishanth Menon * message. 4279f723220SNishanth Menon */ 4289f723220SNishanth Menon struct ti_sci_msg_req_set_clock_freq { 4299f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 4309f723220SNishanth Menon u32 dev_id; 4319f723220SNishanth Menon u64 min_freq_hz; 4329f723220SNishanth Menon u64 target_freq_hz; 4339f723220SNishanth Menon u64 max_freq_hz; 4349f723220SNishanth Menon u8 clk_id; 4359f723220SNishanth Menon } __packed; 4369f723220SNishanth Menon 4379f723220SNishanth Menon /** 4389f723220SNishanth Menon * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency 4399f723220SNishanth Menon * @hdr: Generic Header 4409f723220SNishanth Menon * @dev_id: Device identifier this request is for 4419f723220SNishanth Menon * @clk_id: Clock identifier for the device for this request. 4429f723220SNishanth Menon * 4439f723220SNishanth Menon * NOTE: Normally clock frequency management is automatically done by TISCI 4449f723220SNishanth Menon * entity. In some cases, clock frequencies are configured by host. 4459f723220SNishanth Menon * 4469f723220SNishanth Menon * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency 4479f723220SNishanth Menon * that the clock is currently at. 4489f723220SNishanth Menon */ 4499f723220SNishanth Menon struct ti_sci_msg_req_get_clock_freq { 4509f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 4519f723220SNishanth Menon u32 dev_id; 4529f723220SNishanth Menon u8 clk_id; 4539f723220SNishanth Menon } __packed; 4549f723220SNishanth Menon 4559f723220SNishanth Menon /** 4569f723220SNishanth Menon * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request 4579f723220SNishanth Menon * @hdr: Generic Header 4589f723220SNishanth Menon * @freq_hz: Frequency that the clock is currently on, in Hz. 4599f723220SNishanth Menon * 4609f723220SNishanth Menon * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ. 4619f723220SNishanth Menon */ 4629f723220SNishanth Menon struct ti_sci_msg_resp_get_clock_freq { 4639f723220SNishanth Menon struct ti_sci_msg_hdr hdr; 4649f723220SNishanth Menon u64 freq_hz; 4659f723220SNishanth Menon } __packed; 4669f723220SNishanth Menon 467*9c19fb68SLokesh Vutla #define TI_SCI_IRQ_SECONDARY_HOST_INVALID 0xff 468*9c19fb68SLokesh Vutla 469*9c19fb68SLokesh Vutla /** 470*9c19fb68SLokesh Vutla * struct ti_sci_msg_req_get_resource_range - Request to get a host's assigned 471*9c19fb68SLokesh Vutla * range of resources. 472*9c19fb68SLokesh Vutla * @hdr: Generic Header 473*9c19fb68SLokesh Vutla * @type: Unique resource assignment type 474*9c19fb68SLokesh Vutla * @subtype: Resource assignment subtype within the resource type. 475*9c19fb68SLokesh Vutla * @secondary_host: Host processing entity to which the resources are 476*9c19fb68SLokesh Vutla * allocated. This is required only when the destination 477*9c19fb68SLokesh Vutla * host id id different from ti sci interface host id, 478*9c19fb68SLokesh Vutla * else TI_SCI_IRQ_SECONDARY_HOST_INVALID can be passed. 479*9c19fb68SLokesh Vutla * 480*9c19fb68SLokesh Vutla * Request type is TI_SCI_MSG_GET_RESOURCE_RANGE. Responded with requested 481*9c19fb68SLokesh Vutla * resource range which is of type TI_SCI_MSG_GET_RESOURCE_RANGE. 482*9c19fb68SLokesh Vutla */ 483*9c19fb68SLokesh Vutla struct ti_sci_msg_req_get_resource_range { 484*9c19fb68SLokesh Vutla struct ti_sci_msg_hdr hdr; 485*9c19fb68SLokesh Vutla #define MSG_RM_RESOURCE_TYPE_MASK GENMASK(9, 0) 486*9c19fb68SLokesh Vutla #define MSG_RM_RESOURCE_SUBTYPE_MASK GENMASK(5, 0) 487*9c19fb68SLokesh Vutla u16 type; 488*9c19fb68SLokesh Vutla u8 subtype; 489*9c19fb68SLokesh Vutla u8 secondary_host; 490*9c19fb68SLokesh Vutla } __packed; 491*9c19fb68SLokesh Vutla 492*9c19fb68SLokesh Vutla /** 493*9c19fb68SLokesh Vutla * struct ti_sci_msg_resp_get_resource_range - Response to resource get range. 494*9c19fb68SLokesh Vutla * @hdr: Generic Header 495*9c19fb68SLokesh Vutla * @range_start: Start index of the resource range. 496*9c19fb68SLokesh Vutla * @range_num: Number of resources in the range. 497*9c19fb68SLokesh Vutla * 498*9c19fb68SLokesh Vutla * Response to request TI_SCI_MSG_GET_RESOURCE_RANGE. 499*9c19fb68SLokesh Vutla */ 500*9c19fb68SLokesh Vutla struct ti_sci_msg_resp_get_resource_range { 501*9c19fb68SLokesh Vutla struct ti_sci_msg_hdr hdr; 502*9c19fb68SLokesh Vutla u16 range_start; 503*9c19fb68SLokesh Vutla u16 range_num; 504*9c19fb68SLokesh Vutla } __packed; 505*9c19fb68SLokesh Vutla 506aa276781SNishanth Menon #endif /* __TI_SCI_H */ 507