From 7a469035e96b1e6d9d31d502ed326d53c698a137 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Wed, 10 Apr 2019 11:49:40 -0400 Subject: 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: Andrew F. Davis Change-Id: I72b4d1ef98bf1c1409d9db9db074af8dfbcd83ea --- plat/ti/k3/common/drivers/ti_sci/ti_sci.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'plat/ti') diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c index df0b794f..a376e6ea 100644 --- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c +++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c @@ -45,7 +45,6 @@ static struct ti_sci_info info = { .host_id = TI_SCI_HOST_ID, .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, tx_message_size < sizeof(*hdr)) return -ERANGE; - info.seq++; - hdr = (struct ti_sci_msg_hdr *)tx_buf; - hdr->seq = info.seq; + hdr->seq = ++info.seq; hdr->type = msg_type; hdr->host = info.desc.host_id; 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) return -ERANGE; hdr = (struct ti_sci_msg_hdr *)&req; - hdr->seq = info.seq; + hdr->seq = ++info.seq; hdr->type = TI_SCI_MSG_SET_DEVICE_STATE; hdr->host = info.desc.host_id; /* 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, return -ERANGE; hdr = (struct ti_sci_msg_hdr *)&req; - hdr->seq = info.seq; + hdr->seq = ++info.seq; hdr->type = TISCI_MSG_SET_PROC_BOOT_CTRL; hdr->host = info.desc.host_id; /* 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, return -ERANGE; hdr = (struct ti_sci_msg_hdr *)&req; - hdr->seq = info.seq; + hdr->seq = ++info.seq; hdr->type = TISCI_MSG_WAIT_PROC_BOOT_STATUS; hdr->host = info.desc.host_id; /* Setup with NORESPONSE flag to keep response queue clean */ -- cgit v1.2.3