From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jean Delvare <jdelvare@suse.com>, Andi Shyti <andi.shyti@kernel.org>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: [PATCH 3/3] i2c: i801: Improve too small kill wait time in i801_check_post
Date: Sat, 10 Feb 2024 16:31:10 +0100 [thread overview]
Message-ID: <c92061e4-20bf-4ace-b04f-fc7774f11e11@gmail.com> (raw)
In-Reply-To: <d761a722-d400-4d6b-8866-4bb25d349184@gmail.com>
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>
---
drivers/i2c/busses/i2c-i801.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 751b7c6d2..5a84eb1a6 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -435,12 +435,11 @@ static int i801_check_post(struct i801_priv *priv, int status)
pci_err(priv->pci_dev, "Timeout, terminating transaction\n");
/* 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_err(priv->pci_dev, "Failed terminating the transaction\n");
return -ETIMEDOUT;
}
--
2.43.0
next prev parent reply other threads:[~2024-02-10 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 15:25 [PATCH 0/3] i2c: i801: Avoid potential issue in i801_check_post and cosmetic improvements Heiner Kallweit
2024-02-10 15:27 ` [PATCH 1/3] i2c: i801: Cosmetic improvements Heiner Kallweit
2024-02-10 15:28 ` [PATCH 2/3] i2c: i801: Move i801_wait_intr and i801_wait_byte_done in the code Heiner Kallweit
2024-02-10 15:31 ` Heiner Kallweit [this message]
2025-02-12 18:53 ` [PATCH 0/3] i2c: i801: Avoid potential issue in i801_check_post and cosmetic improvements Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c92061e4-20bf-4ace-b04f-fc7774f11e11@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).