Commit 7a469035 authored by Andrew F. Davis's avatar Andrew F. Davis
Browse files

ti: k3: drivers: ti_sci: Cleanup sequence ID usage



The sequence ID can be set with a message to identify it when it is
responded to in the response queue. We assign each message a number and
check for this same number to detect response mismatches.

Start this at 0 and increase it by one for each message sent, even ones
that do not request or wait for a response as one may still be delivered
in some cases and we want to detect this.
Signed-off-by: default avatarAndrew F. Davis <afd@ti.com>
Change-Id: I72b4d1ef98bf1c1409d9db9db074af8dfbcd83ea
parent fb98ca5a
...@@ -45,7 +45,6 @@ static struct ti_sci_info info = { ...@@ -45,7 +45,6 @@ static struct ti_sci_info info = {
.host_id = TI_SCI_HOST_ID, .host_id = TI_SCI_HOST_ID,
.max_msg_size = TI_SCI_MAX_MESSAGE_SIZE, .max_msg_size = TI_SCI_MAX_MESSAGE_SIZE,
}, },
.seq = 0x0a,
}; };
/** /**
...@@ -89,10 +88,8 @@ static int ti_sci_setup_one_xfer(uint16_t msg_type, uint32_t msg_flags, ...@@ -89,10 +88,8 @@ static int ti_sci_setup_one_xfer(uint16_t msg_type, uint32_t msg_flags,
tx_message_size < sizeof(*hdr)) tx_message_size < sizeof(*hdr))
return -ERANGE; return -ERANGE;
info.seq++;
hdr = (struct ti_sci_msg_hdr *)tx_buf; hdr = (struct ti_sci_msg_hdr *)tx_buf;
hdr->seq = info.seq; hdr->seq = ++info.seq;
hdr->type = msg_type; hdr->type = msg_type;
hdr->host = info.desc.host_id; hdr->host = info.desc.host_id;
hdr->flags = msg_flags | TI_SCI_FLAG_REQ_ACK_ON_PROCESSED; hdr->flags = msg_flags | TI_SCI_FLAG_REQ_ACK_ON_PROCESSED;
...@@ -425,7 +422,7 @@ int ti_sci_device_put_no_wait(uint32_t id) ...@@ -425,7 +422,7 @@ int ti_sci_device_put_no_wait(uint32_t id)
return -ERANGE; return -ERANGE;
hdr = (struct ti_sci_msg_hdr *)&req; hdr = (struct ti_sci_msg_hdr *)&req;
hdr->seq = info.seq; hdr->seq = ++info.seq;
hdr->type = TI_SCI_MSG_SET_DEVICE_STATE; hdr->type = TI_SCI_MSG_SET_DEVICE_STATE;
hdr->host = info.desc.host_id; hdr->host = info.desc.host_id;
/* Setup with NORESPONSE flag to keep response queue clean */ /* Setup with NORESPONSE flag to keep response queue clean */
...@@ -1408,7 +1405,7 @@ int ti_sci_proc_set_boot_ctrl_no_wait(uint8_t proc_id, ...@@ -1408,7 +1405,7 @@ int ti_sci_proc_set_boot_ctrl_no_wait(uint8_t proc_id,
return -ERANGE; return -ERANGE;
hdr = (struct ti_sci_msg_hdr *)&req; hdr = (struct ti_sci_msg_hdr *)&req;
hdr->seq = info.seq; hdr->seq = ++info.seq;
hdr->type = TISCI_MSG_SET_PROC_BOOT_CTRL; hdr->type = TISCI_MSG_SET_PROC_BOOT_CTRL;
hdr->host = info.desc.host_id; hdr->host = info.desc.host_id;
/* Setup with NORESPONSE flag to keep response queue clean */ /* Setup with NORESPONSE flag to keep response queue clean */
...@@ -1650,7 +1647,7 @@ int ti_sci_proc_wait_boot_status_no_wait(uint8_t proc_id, ...@@ -1650,7 +1647,7 @@ int ti_sci_proc_wait_boot_status_no_wait(uint8_t proc_id,
return -ERANGE; return -ERANGE;
hdr = (struct ti_sci_msg_hdr *)&req; hdr = (struct ti_sci_msg_hdr *)&req;
hdr->seq = info.seq; hdr->seq = ++info.seq;
hdr->type = TISCI_MSG_WAIT_PROC_BOOT_STATUS; hdr->type = TISCI_MSG_WAIT_PROC_BOOT_STATUS;
hdr->host = info.desc.host_id; hdr->host = info.desc.host_id;
/* Setup with NORESPONSE flag to keep response queue clean */ /* Setup with NORESPONSE flag to keep response queue clean */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment