blob: 869674e490069442c5fdfc071166c39905352771 [file] [log] [blame]
From 471c93d854befec9392058266017ea9628434946 Mon Sep 17 00:00:00 2001
From: Steven Niu <steven.niu.uj@renesas.com>
Date: Wed, 2 Apr 2025 13:44:29 +0800
Subject: [PATCH 5/9] i3c: i3c-hub: Wait rx done instead of tx done
Wait rx done before checking which rx buffer has data.
Signed-off-by: Steven Niu <steven.niu.uj@renesas.com>
---
drivers/i3c/i3c-hub.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/i3c/i3c-hub.c b/drivers/i3c/i3c-hub.c
index 62b2d1b202fa..1afe3b852bef 100644
--- a/drivers/i3c/i3c-hub.c
+++ b/drivers/i3c/i3c-hub.c
@@ -891,7 +891,7 @@ static int smbus_agent_sync_next_buf_idx(struct i3c_hub_smbus_agent *agent, u32
struct i3c_hub_agent_tx_hdr hdr = { 0 };
u8 dev_addr = 0x70;
int page, stat_reg;
- unsigned int stat;
+ unsigned int stat, rx_done;
int ret;
int i = 0;
@@ -914,15 +914,16 @@ static int smbus_agent_sync_next_buf_idx(struct i3c_hub_smbus_agent *agent, u32
if (ret)
goto err_recover;
+ rx_done = HUB_REG_AGENT_CNTRL_STATUS_RX_BUF0 | HUB_REG_AGENT_CNTRL_STATUS_RX_BUF1;
do {
ret = regmap_read(hub->regmap, stat_reg, &stat);
if (ret)
goto err_recover;
- if (stat & HUB_REG_AGENT_CNTRL_STATUS_FINISH)
+ if (stat & rx_done)
break;
} while (i++ < 100);
- if (!(stat & HUB_REG_AGENT_CNTRL_STATUS_FINISH)) {
+ if (!(stat & rx_done)) {
dev_err(&hub->i3cdev->dev, "port[%d] agent loopback unfinished:%02X\n",
agent->port_nr, stat);
ret = EIO;
--
2.49.0.906.g1f30a19c02-goog