summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c22e61c)
raw | patch | inline | side by side (parent: c22e61c)
author | Nikhil Devshatwar <nikhil.nd@ti.com> | |
Wed, 4 Nov 2020 07:08:29 +0000 (12:38 +0530) | ||
committer | Lokesh Vutla <lokeshvutla@ti.com> | |
Wed, 4 Nov 2020 09:44:38 +0000 (15:14 +0530) |
Add support for command ti_sci_cmd_get_range which returns
the assigned range of resources for a certain host.
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
the assigned range of resources for a certain host.
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
common/tisci/tisci_core.c | patch | blob | history | |
include/tisci.h | patch | blob | history | |
include/tisci_protocol.h | patch | blob | history |
index de401da027546996516573c4c8f0f35ceaab536c..529e9655659b34812e57257da232b0e71cc5855b 100644 (file)
return 0;
}
+
+int ti_sci_cmd_get_range(uint16_t type, uint16_t subtype, uint16_t host_id,
+ struct ti_sci_rm_desc *desc)
+{
+ struct ti_sci_msg_resp_get_resource_range *resp;
+ struct ti_sci_msg_req_get_resource_range *req;
+ uint8_t buf[SEC_PROXY_MAX_MSG_SIZE];
+ struct k3_sec_proxy_msg msg;
+ int ret = 0;
+
+ memset(buf, 0, sizeof(buf));
+ ti_sci_setup_header((struct ti_sci_msg_hdr *)buf,
+ TI_SCI_MSG_GET_RESOURCE_RANGE, 0);
+ req = (struct ti_sci_msg_req_get_resource_range *)buf;
+ req->type = type;
+ req->subtype = subtype;
+ req->secondary_host = host_id;
+
+ msg.len = sizeof(*req);
+ msg.buf = buf;
+ ret = ti_sci_xfer_msg(&msg);
+ if (ret)
+ return ret;
+
+ resp = (struct ti_sci_msg_resp_get_resource_range *)buf;
+ desc->start = resp->range_start;
+ desc->num = resp->range_num;
+ desc->start_sec = resp->range_start_sec;
+ desc->num_sec = resp->range_num_sec;
+
+ return 0;
+}
diff --git a/include/tisci.h b/include/tisci.h
index e0b72f627d8d66603d38c8f86cd26f990df821e1..c23ac9bc588fe28c5e786642daeaeb590593238e 100644 (file)
--- a/include/tisci.h
+++ b/include/tisci.h
char clk_function[100];
};
+struct ti_sci_rm_info {
+ uint32_t utype;
+ char subtype_name[100];
+};
+
struct ti_sci_info {
uint8_t host_id;
struct ti_sci_version_info version;
uint32_t num_devices;
struct ti_sci_clocks_info *clocks_info;
uint32_t num_clocks;
+ struct ti_sci_rm_info *rm_info;
+ uint32_t num_res;
+};
+
+struct ti_sci_rm_desc {
+ uint16_t start;
+ uint16_t num;
+ uint16_t start_sec;
+ uint16_t num_sec;
};
#define MAX_DEVICE_STATE_LENGTH 25
const char *ti_sci_cmd_get_clk_state(uint32_t dev_id, uint32_t clk_id);
int ti_sci_cmd_set_clk_freq(uint32_t dev_id, uint32_t clk_id, uint64_t freq);
int ti_sci_cmd_get_clk_freq(uint32_t dev_id, uint32_t clk_id, uint64_t *freq);
+int ti_sci_cmd_get_range(uint16_t type, uint16_t subtype, uint16_t host_id,
+ struct ti_sci_rm_desc *desc);
#endif
index 6d28bbbfd70cac6a056169c6f6fc51aa16da07f0..7451e3c17ae5e516439a1956c8796ff4d33b751c 100644 (file)
--- a/include/tisci_protocol.h
+++ b/include/tisci_protocol.h
#define TI_SCI_MSG_SET_CLOCK_FREQ 0x010c
#define TI_SCI_MSG_QUERY_CLOCK_FREQ 0x010d
#define TI_SCI_MSG_GET_CLOCK_FREQ 0x010e
+/* Resource Management Requests */
+#define TI_SCI_MSG_GET_RESOURCE_RANGE 0x1500
#define TI_SCI_MSG_FLAG(val) (1 << (val))
#define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE 0x0
uint8_t current_state;
} __attribute__ ((__packed__));
+struct ti_sci_msg_req_get_resource_range {
+ struct ti_sci_msg_hdr hdr;
+#define MSG_RM_RESOURCE_TYPE_MASK 0x3ff
+#define MSG_RM_RESOURCE_SUBTYPE_MASK 0x3f
+ uint16_t type;
+ uint8_t subtype;
+ uint8_t secondary_host;
+} __attribute__ ((__packed__));
+
+struct ti_sci_msg_resp_get_resource_range {
+ struct ti_sci_msg_hdr hdr;
+ uint16_t range_start;
+ uint16_t range_num;
+ uint16_t range_start_sec;
+ uint16_t range_num_sec;
+} __attribute__ ((__packed__));
+
struct ti_sci_msg_req_set_clock_state {
/* Additional hdr->flags options */
#define MSG_FLAG_CLOCK_ALLOW_SSC TI_SCI_MSG_FLAG(8)