diff options
| author | Heiner Kallweit <hkallweit1@gmail.com> | 2025-02-21 21:30:46 +0100 |
|---|---|---|
| committer | Andi Shyti <andi.shyti@kernel.org> | 2025-03-18 21:53:55 +0100 |
| commit | 3a3c6b7b0387d12b067052e1027cd967fae8378a (patch) | |
| tree | 3fbdab8e3fbbf511212442f6a393373c6c4fe4b5 | |
| parent | e5befb5b01bc6b570c47a421284ca5193d36280d (diff) | |
i2c: i801: Improve too small kill wait time in i801_check_post
In my tests terminating a transaction took about 25ms, what is
in line with the chip-internal timeout as described in 5.21.3.2
"Bus Time Out" in [0]. Therefore the 2ms delay is too low.
Instead of a fixed delay let's use i801_wait_intr() here,
this also facilitates the status handling.
This potential issue seems to have been existing forever, but as no
related problem is known, treat it as an improvement.
[0] Intel document #326776-003, 7 Series PCH datasheet
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/ad4ef645-5d03-4833-a0b6-f31f8fd06483@gmail.com
| -rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 9097bb9cdb9e..6a4147054b49 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -441,12 +441,11 @@ static int i801_check_post(struct i801_priv *priv, int status) if (unlikely(status < 0)) { /* try to stop the current command */ outb_p(SMBHSTCNT_KILL, SMBHSTCNT(priv)); - usleep_range(1000, 2000); + status = i801_wait_intr(priv); outb_p(0, SMBHSTCNT(priv)); /* Check if it worked */ - status = inb_p(SMBHSTSTS(priv)); - if ((status & SMBHSTSTS_HOST_BUSY) || !(status & SMBHSTSTS_FAILED)) + if (status < 0 || !(status & SMBHSTSTS_FAILED)) pci_dbg(priv->pci_dev, "Failed terminating the transaction\n"); return -ETIMEDOUT; } |
