Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / drivers / firmware / ti_sci.c
index 02fa196..cdee0b4 100644 (file)
@@ -916,7 +916,7 @@ static int ti_sci_cmd_get_device_resets(const struct ti_sci_handle *handle,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_set_clock_state(const struct ti_sci_handle *handle,
-                                 u32 dev_id, u8 clk_id,
+                                 u32 dev_id, u32 clk_id,
                                  u32 flags, u8 state)
 {
        struct ti_sci_info *info;
@@ -944,7 +944,12 @@ static int ti_sci_set_clock_state(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_set_clock_state *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
        req->request_state = state;
 
        ret = ti_sci_do_xfer(info, xfer);
@@ -976,7 +981,7 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_get_clock_state(const struct ti_sci_handle *handle,
-                                     u32 dev_id, u8 clk_id,
+                                     u32 dev_id, u32 clk_id,
                                      u8 *programmed_state, u8 *current_state)
 {
        struct ti_sci_info *info;
@@ -1007,7 +1012,12 @@ static int ti_sci_cmd_get_clock_state(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_get_clock_state *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
@@ -1047,8 +1057,8 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id,
-                               u8 clk_id, bool needs_ssc, bool can_change_freq,
-                               bool enable_input_term)
+                               u32 clk_id, bool needs_ssc,
+                               bool can_change_freq, bool enable_input_term)
 {
        u32 flags = 0;
 
@@ -1073,7 +1083,7 @@ static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle,
-                                u32 dev_id, u8 clk_id)
+                                u32 dev_id, u32 clk_id)
 {
        return ti_sci_set_clock_state(handle, dev_id, clk_id, 0,
                                      MSG_CLOCK_SW_STATE_UNREQ);
@@ -1092,7 +1102,7 @@ static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle,
-                               u32 dev_id, u8 clk_id)
+                               u32 dev_id, u32 clk_id)
 {
        return ti_sci_set_clock_state(handle, dev_id, clk_id, 0,
                                      MSG_CLOCK_SW_STATE_AUTO);
@@ -1110,7 +1120,7 @@ static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle,
-                                 u32 dev_id, u8 clk_id, bool *req_state)
+                                 u32 dev_id, u32 clk_id, bool *req_state)
 {
        u8 state = 0;
        int ret;
@@ -1139,7 +1149,7 @@ static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_is_on(const struct ti_sci_handle *handle, u32 dev_id,
-                               u8 clk_id, bool *req_state, bool *curr_state)
+                               u32 clk_id, bool *req_state, bool *curr_state)
 {
        u8 c_state = 0, r_state = 0;
        int ret;
@@ -1172,7 +1182,7 @@ static int ti_sci_cmd_clk_is_on(const struct ti_sci_handle *handle, u32 dev_id,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_is_off(const struct ti_sci_handle *handle, u32 dev_id,
-                                u8 clk_id, bool *req_state, bool *curr_state)
+                                u32 clk_id, bool *req_state, bool *curr_state)
 {
        u8 c_state = 0, r_state = 0;
        int ret;
@@ -1204,7 +1214,7 @@ static int ti_sci_cmd_clk_is_off(const struct ti_sci_handle *handle, u32 dev_id,
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_set_parent(const struct ti_sci_handle *handle,
-                                    u32 dev_id, u8 clk_id, u8 parent_id)
+                                    u32 dev_id, u32 clk_id, u32 parent_id)
 {
        struct ti_sci_info *info;
        struct ti_sci_msg_req_set_clock_parent *req;
@@ -1231,8 +1241,18 @@ static int ti_sci_cmd_clk_set_parent(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_set_clock_parent *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
-       req->parent_id = parent_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
+       if (parent_id < 255) {
+               req->parent_id = parent_id;
+       } else {
+               req->parent_id = 255;
+               req->parent_id_32 = parent_id;
+       }
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
@@ -1262,7 +1282,7 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_get_parent(const struct ti_sci_handle *handle,
-                                    u32 dev_id, u8 clk_id, u8 *parent_id)
+                                    u32 dev_id, u32 clk_id, u32 *parent_id)
 {
        struct ti_sci_info *info;
        struct ti_sci_msg_req_get_clock_parent *req;
@@ -1289,7 +1309,12 @@ static int ti_sci_cmd_clk_get_parent(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_get_clock_parent *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
@@ -1299,10 +1324,14 @@ static int ti_sci_cmd_clk_get_parent(const struct ti_sci_handle *handle,
 
        resp = (struct ti_sci_msg_resp_get_clock_parent *)xfer->xfer_buf;
 
-       if (!ti_sci_is_response_ack(resp))
+       if (!ti_sci_is_response_ack(resp)) {
                ret = -ENODEV;
-       else
-               *parent_id = resp->parent_id;
+       } else {
+               if (resp->parent_id < 255)
+                       *parent_id = resp->parent_id;
+               else
+                       *parent_id = resp->parent_id_32;
+       }
 
 fail:
        ti_sci_put_one_xfer(&info->minfo, xfer);
@@ -1322,8 +1351,8 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_get_num_parents(const struct ti_sci_handle *handle,
-                                         u32 dev_id, u8 clk_id,
-                                         u8 *num_parents)
+                                         u32 dev_id, u32 clk_id,
+                                         u32 *num_parents)
 {
        struct ti_sci_info *info;
        struct ti_sci_msg_req_get_clock_num_parents *req;
@@ -1350,7 +1379,12 @@ static int ti_sci_cmd_clk_get_num_parents(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_get_clock_num_parents *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
@@ -1360,10 +1394,14 @@ static int ti_sci_cmd_clk_get_num_parents(const struct ti_sci_handle *handle,
 
        resp = (struct ti_sci_msg_resp_get_clock_num_parents *)xfer->xfer_buf;
 
-       if (!ti_sci_is_response_ack(resp))
+       if (!ti_sci_is_response_ack(resp)) {
                ret = -ENODEV;
-       else
-               *num_parents = resp->num_parents;
+       } else {
+               if (resp->num_parents < 255)
+                       *num_parents = resp->num_parents;
+               else
+                       *num_parents = resp->num_parents_32;
+       }
 
 fail:
        ti_sci_put_one_xfer(&info->minfo, xfer);
@@ -1391,7 +1429,7 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_get_match_freq(const struct ti_sci_handle *handle,
-                                        u32 dev_id, u8 clk_id, u64 min_freq,
+                                        u32 dev_id, u32 clk_id, u64 min_freq,
                                         u64 target_freq, u64 max_freq,
                                         u64 *match_freq)
 {
@@ -1420,7 +1458,12 @@ static int ti_sci_cmd_clk_get_match_freq(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_query_clock_freq *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
        req->min_freq_hz = min_freq;
        req->target_freq_hz = target_freq;
        req->max_freq_hz = max_freq;
@@ -1463,7 +1506,7 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_set_freq(const struct ti_sci_handle *handle,
-                                  u32 dev_id, u8 clk_id, u64 min_freq,
+                                  u32 dev_id, u32 clk_id, u64 min_freq,
                                   u64 target_freq, u64 max_freq)
 {
        struct ti_sci_info *info;
@@ -1491,7 +1534,12 @@ static int ti_sci_cmd_clk_set_freq(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_set_clock_freq *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
        req->min_freq_hz = min_freq;
        req->target_freq_hz = target_freq;
        req->max_freq_hz = max_freq;
@@ -1524,7 +1572,7 @@ fail:
  * Return: 0 if all went well, else returns appropriate error value.
  */
 static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
-                                  u32 dev_id, u8 clk_id, u64 *freq)
+                                  u32 dev_id, u32 clk_id, u64 *freq)
 {
        struct ti_sci_info *info;
        struct ti_sci_msg_req_get_clock_freq *req;
@@ -1551,7 +1599,12 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
        }
        req = (struct ti_sci_msg_req_get_clock_freq *)xfer->xfer_buf;
        req->dev_id = dev_id;
-       req->clk_id = clk_id;
+       if (clk_id < 255) {
+               req->clk_id = clk_id;
+       } else {
+               req->clk_id = 255;
+               req->clk_id_32 = clk_id;
+       }
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
@@ -2046,7 +2099,7 @@ static int ti_sci_cmd_ring_config(const struct ti_sci_handle *handle,
                                   sizeof(*req), sizeof(*resp));
        if (IS_ERR(xfer)) {
                ret = PTR_ERR(xfer);
-               dev_err(info->dev, "RM_RA:Message config failed(%d)\n", ret);
+               dev_err(dev, "RM_RA:Message config failed(%d)\n", ret);
                return ret;
        }
        req = (struct ti_sci_msg_rm_ring_cfg_req *)xfer->xfer_buf;
@@ -2062,7 +2115,7 @@ static int ti_sci_cmd_ring_config(const struct ti_sci_handle *handle,
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
-               dev_err(info->dev, "RM_RA:Mbox config send fail %d\n", ret);
+               dev_err(dev, "RM_RA:Mbox config send fail %d\n", ret);
                goto fail;
        }
 
@@ -2071,7 +2124,7 @@ static int ti_sci_cmd_ring_config(const struct ti_sci_handle *handle,
 
 fail:
        ti_sci_put_one_xfer(&info->minfo, xfer);
-       dev_dbg(info->dev, "RM_RA:config ring %u ret:%d\n", index, ret);
+       dev_dbg(dev, "RM_RA:config ring %u ret:%d\n", index, ret);
        return ret;
 }
 
@@ -2115,7 +2168,7 @@ static int ti_sci_cmd_ring_get_config(const struct ti_sci_handle *handle,
                                   sizeof(*req), sizeof(*resp));
        if (IS_ERR(xfer)) {
                ret = PTR_ERR(xfer);
-               dev_err(info->dev,
+               dev_err(dev,
                        "RM_RA:Message get config failed(%d)\n", ret);
                return ret;
        }
@@ -2125,7 +2178,7 @@ static int ti_sci_cmd_ring_get_config(const struct ti_sci_handle *handle,
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
-               dev_err(info->dev, "RM_RA:Mbox get config send fail %d\n", ret);
+               dev_err(dev, "RM_RA:Mbox get config send fail %d\n", ret);
                goto fail;
        }
 
@@ -2150,7 +2203,7 @@ static int ti_sci_cmd_ring_get_config(const struct ti_sci_handle *handle,
 
 fail:
        ti_sci_put_one_xfer(&info->minfo, xfer);
-       dev_dbg(info->dev, "RM_RA:get config ring %u ret:%d\n", index, ret);
+       dev_dbg(dev, "RM_RA:get config ring %u ret:%d\n", index, ret);
        return ret;
 }
 
@@ -2298,7 +2351,7 @@ static int ti_sci_cmd_rm_udmap_tx_ch_cfg(const struct ti_sci_handle *handle,
                                   sizeof(*req), sizeof(*resp));
        if (IS_ERR(xfer)) {
                ret = PTR_ERR(xfer);
-               dev_err(info->dev, "Message TX_CH_CFG alloc failed(%d)\n", ret);
+               dev_err(dev, "Message TX_CH_CFG alloc failed(%d)\n", ret);
                return ret;
        }
        req = (struct ti_sci_msg_rm_udmap_tx_ch_cfg_req *)xfer->xfer_buf;
@@ -2323,7 +2376,7 @@ static int ti_sci_cmd_rm_udmap_tx_ch_cfg(const struct ti_sci_handle *handle,
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
-               dev_err(info->dev, "Mbox send TX_CH_CFG fail %d\n", ret);
+               dev_err(dev, "Mbox send TX_CH_CFG fail %d\n", ret);
                goto fail;
        }
 
@@ -2332,7 +2385,7 @@ static int ti_sci_cmd_rm_udmap_tx_ch_cfg(const struct ti_sci_handle *handle,
 
 fail:
        ti_sci_put_one_xfer(&info->minfo, xfer);
-       dev_dbg(info->dev, "TX_CH_CFG: chn %u ret:%u\n", params->index, ret);
+       dev_dbg(dev, "TX_CH_CFG: chn %u ret:%u\n", params->index, ret);
        return ret;
 }
 
@@ -2368,7 +2421,7 @@ static int ti_sci_cmd_rm_udmap_rx_ch_cfg(const struct ti_sci_handle *handle,
                                   sizeof(*req), sizeof(*resp));
        if (IS_ERR(xfer)) {
                ret = PTR_ERR(xfer);
-               dev_err(info->dev, "Message RX_CH_CFG alloc failed(%d)\n", ret);
+               dev_err(dev, "Message RX_CH_CFG alloc failed(%d)\n", ret);
                return ret;
        }
        req = (struct ti_sci_msg_rm_udmap_rx_ch_cfg_req *)xfer->xfer_buf;
@@ -2392,7 +2445,7 @@ static int ti_sci_cmd_rm_udmap_rx_ch_cfg(const struct ti_sci_handle *handle,
 
        ret = ti_sci_do_xfer(info, xfer);
        if (ret) {
-               dev_err(info->dev, "Mbox send RX_CH_CFG fail %d\n", ret);
+               dev_err(dev, "Mbox send RX_CH_CFG fail %d\n", ret);
                goto fail;
        }
 
@@ -2401,7 +2454,7 @@ static int ti_sci_cmd_rm_udmap_rx_ch_cfg(const struct ti_sci_handle *handle,
 
 fail:
        ti_sci_put_one_xfer(&info->minfo, xfer);
-       dev_dbg(info->dev, "RX_CH_CFG: chn %u ret:%d\n", params->index, ret);
+       dev_dbg(dev, "RX_CH_CFG: chn %u ret:%d\n", params->index, ret);
        return ret;
 }
 
@@ -2479,6 +2532,348 @@ fail:
        return ret;
 }
 
+/**
+ * ti_sci_cmd_proc_request() - Command to request a physical processor control
+ * @handle:    Pointer to TI SCI handle
+ * @proc_id:   Processor ID this request is for
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_request(const struct ti_sci_handle *handle,
+                                  u8 proc_id)
+{
+       struct ti_sci_msg_req_proc_request *req;
+       struct ti_sci_msg_hdr *resp;
+       struct ti_sci_info *info;
+       struct ti_sci_xfer *xfer;
+       struct device *dev;
+       int ret = 0;
+
+       if (!handle)
+               return -EINVAL;
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_PROC_REQUEST,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_proc_request *)xfer->xfer_buf;
+       req->processor_id = proc_id;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_hdr *)xfer->tx_message.buf;
+
+       ret = ti_sci_is_response_ack(resp) ? 0 : -ENODEV;
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_cmd_proc_release() - Command to release a physical processor control
+ * @handle:    Pointer to TI SCI handle
+ * @proc_id:   Processor ID this request is for
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_release(const struct ti_sci_handle *handle,
+                                  u8 proc_id)
+{
+       struct ti_sci_msg_req_proc_release *req;
+       struct ti_sci_msg_hdr *resp;
+       struct ti_sci_info *info;
+       struct ti_sci_xfer *xfer;
+       struct device *dev;
+       int ret = 0;
+
+       if (!handle)
+               return -EINVAL;
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_PROC_RELEASE,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_proc_release *)xfer->xfer_buf;
+       req->processor_id = proc_id;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_hdr *)xfer->tx_message.buf;
+
+       ret = ti_sci_is_response_ack(resp) ? 0 : -ENODEV;
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_cmd_proc_handover() - Command to handover a physical processor
+ *                             control to a host in the processor's access
+ *                             control list.
+ * @handle:    Pointer to TI SCI handle
+ * @proc_id:   Processor ID this request is for
+ * @host_id:   Host ID to get the control of the processor
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_handover(const struct ti_sci_handle *handle,
+                                   u8 proc_id, u8 host_id)
+{
+       struct ti_sci_msg_req_proc_handover *req;
+       struct ti_sci_msg_hdr *resp;
+       struct ti_sci_info *info;
+       struct ti_sci_xfer *xfer;
+       struct device *dev;
+       int ret = 0;
+
+       if (!handle)
+               return -EINVAL;
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_PROC_HANDOVER,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_proc_handover *)xfer->xfer_buf;
+       req->processor_id = proc_id;
+       req->host_id = host_id;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_hdr *)xfer->tx_message.buf;
+
+       ret = ti_sci_is_response_ack(resp) ? 0 : -ENODEV;
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_cmd_proc_set_config() - Command to set the processor boot
+ *                                 configuration flags
+ * @handle:            Pointer to TI SCI handle
+ * @proc_id:           Processor ID this request is for
+ * @config_flags_set:  Configuration flags to be set
+ * @config_flags_clear:        Configuration flags to be cleared.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_set_config(const struct ti_sci_handle *handle,
+                                     u8 proc_id, u64 bootvector,
+                                     u32 config_flags_set,
+                                     u32 config_flags_clear)
+{
+       struct ti_sci_msg_req_set_config *req;
+       struct ti_sci_msg_hdr *resp;
+       struct ti_sci_info *info;
+       struct ti_sci_xfer *xfer;
+       struct device *dev;
+       int ret = 0;
+
+       if (!handle)
+               return -EINVAL;
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_SET_CONFIG,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_set_config *)xfer->xfer_buf;
+       req->processor_id = proc_id;
+       req->bootvector_low = bootvector & TI_SCI_ADDR_LOW_MASK;
+       req->bootvector_high = (bootvector & TI_SCI_ADDR_HIGH_MASK) >>
+                               TI_SCI_ADDR_HIGH_SHIFT;
+       req->config_flags_set = config_flags_set;
+       req->config_flags_clear = config_flags_clear;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_hdr *)xfer->tx_message.buf;
+
+       ret = ti_sci_is_response_ack(resp) ? 0 : -ENODEV;
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_cmd_proc_set_control() - Command to set the processor boot
+ *                                  control flags
+ * @handle:                    Pointer to TI SCI handle
+ * @proc_id:                   Processor ID this request is for
+ * @control_flags_set:         Control flags to be set
+ * @control_flags_clear:       Control flags to be cleared
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_set_control(const struct ti_sci_handle *handle,
+                                      u8 proc_id, u32 control_flags_set,
+                                      u32 control_flags_clear)
+{
+       struct ti_sci_msg_req_set_ctrl *req;
+       struct ti_sci_msg_hdr *resp;
+       struct ti_sci_info *info;
+       struct ti_sci_xfer *xfer;
+       struct device *dev;
+       int ret = 0;
+
+       if (!handle)
+               return -EINVAL;
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_SET_CTRL,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_set_ctrl *)xfer->xfer_buf;
+       req->processor_id = proc_id;
+       req->control_flags_set = control_flags_set;
+       req->control_flags_clear = control_flags_clear;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_hdr *)xfer->tx_message.buf;
+
+       ret = ti_sci_is_response_ack(resp) ? 0 : -ENODEV;
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_cmd_get_boot_status() - Command to get the processor boot status
+ * @handle:    Pointer to TI SCI handle
+ * @proc_id:   Processor ID this request is for
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_get_status(const struct ti_sci_handle *handle,
+                                     u8 proc_id, u64 *bv, u32 *cfg_flags,
+                                     u32 *ctrl_flags, u32 *sts_flags)
+{
+       struct ti_sci_msg_resp_get_status *resp;
+       struct ti_sci_msg_req_get_status *req;
+       struct ti_sci_info *info;
+       struct ti_sci_xfer *xfer;
+       struct device *dev;
+       int ret = 0;
+
+       if (!handle)
+               return -EINVAL;
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_GET_STATUS,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_get_status *)xfer->xfer_buf;
+       req->processor_id = proc_id;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_resp_get_status *)xfer->tx_message.buf;
+
+       if (!ti_sci_is_response_ack(resp)) {
+               ret = -ENODEV;
+       } else {
+               *bv = (resp->bootvector_low & TI_SCI_ADDR_LOW_MASK) |
+                     (((u64)resp->bootvector_high << TI_SCI_ADDR_HIGH_SHIFT) &
+                      TI_SCI_ADDR_HIGH_MASK);
+               *cfg_flags = resp->config_flags;
+               *ctrl_flags = resp->control_flags;
+               *sts_flags = resp->status_flags;
+       }
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
 /*
  * ti_sci_setup_ops() - Setup the operations structures
  * @info:      pointer to TISCI pointer
@@ -2494,6 +2889,7 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
        struct ti_sci_rm_ringacc_ops *rops = &ops->rm_ring_ops;
        struct ti_sci_rm_psil_ops *psilops = &ops->rm_psil_ops;
        struct ti_sci_rm_udmap_ops *udmap_ops = &ops->rm_udmap_ops;
+       struct ti_sci_proc_ops *pops = &ops->proc_ops;
 
        core_ops->reboot_device = ti_sci_cmd_core_reboot;
 
@@ -2543,6 +2939,13 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
        udmap_ops->tx_ch_cfg = ti_sci_cmd_rm_udmap_tx_ch_cfg;
        udmap_ops->rx_ch_cfg = ti_sci_cmd_rm_udmap_rx_ch_cfg;
        udmap_ops->rx_flow_cfg = ti_sci_cmd_rm_udmap_rx_flow_cfg;
+
+       pops->request = ti_sci_cmd_proc_request;
+       pops->release = ti_sci_cmd_proc_release;
+       pops->handover = ti_sci_cmd_proc_handover;
+       pops->set_config = ti_sci_cmd_proc_set_config;
+       pops->set_control = ti_sci_cmd_proc_set_control;
+       pops->get_status = ti_sci_cmd_proc_get_status;
 }
 
 /**
@@ -2830,6 +3233,7 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
                            struct device *dev, u32 dev_id, char *of_prop)
 {
        struct ti_sci_resource *res;
+       bool valid_set = false;
        u32 resource_subtype;
        int i, ret;
 
@@ -2837,12 +3241,13 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
        if (!res)
                return ERR_PTR(-ENOMEM);
 
-       res->sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
-                                                   sizeof(u32));
-       if (res->sets < 0) {
+       ret = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
+                                             sizeof(u32));
+       if (ret < 0) {
                dev_err(dev, "%s resource type ids not available\n", of_prop);
-               return ERR_PTR(res->sets);
+               return ERR_PTR(ret);
        }
+       res->sets = ret;
 
        res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
                                 GFP_KERNEL);
@@ -2860,15 +3265,18 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
                                                        &res->desc[i].start,
                                                        &res->desc[i].num);
                if (ret) {
-                       dev_err(dev, "dev = %d subtype %d not allocated for this host\n",
+                       dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
                                dev_id, resource_subtype);
-                       return ERR_PTR(ret);
+                       res->desc[i].start = 0;
+                       res->desc[i].num = 0;
+                       continue;
                }
 
                dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
                        dev_id, resource_subtype, res->desc[i].start,
                        res->desc[i].num);
 
+               valid_set = true;
                res->desc[i].res_map =
                        devm_kzalloc(dev, BITS_TO_LONGS(res->desc[i].num) *
                                     sizeof(*res->desc[i].res_map), GFP_KERNEL);
@@ -2877,7 +3285,10 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
        }
        raw_spin_lock_init(&res->lock);
 
-       return res;
+       if (valid_set)
+               return res;
+
+       return ERR_PTR(-EINVAL);
 }
 
 static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,