lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230814111534.2771900-1-tommy_huang@aspeedtech.com>
Date:   Mon, 14 Aug 2023 19:15:34 +0800
From:   Tommy Huang <tommy_huang@...eedtech.com>
To:     <brendan.higgins@...ux.dev>, <andi.shyti@...nel.org>,
        <p.zabel@...gutronix.de>, <linux-i2c@...r.kernel.org>,
        <openbmc@...ts.ozlabs.org>
CC:     <benh@...nel.crashing.org>, <joel@....id.au>, <andrew@...id.au>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-aspeed@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>,
        <BMC-SW@...eedtech.com>
Subject: [PATCH] drivers:i2c:add controller reset when the timeout occurred

1.Call i2c controller reset when the i2c transfer timeout occurred.
The rest of interrupts and device should be reset avoid unperdicted
controller behavior occurred.

Signed-off-by: Tommy Huang <tommy_huang@...eedtech.com>
---
 drivers/i2c/busses/i2c-aspeed.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
index 2e5acfeb76c8..1900954deb55 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
@@ -699,12 +699,16 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
 	if (time_left == 0) {
 		/*
 		 * If timed out and bus is still busy in a multi master
-		 * environment, attempt recovery at here.
+		 * environment, attempt recovery at here. Even the bus is
+		 * idle, we still need reset i2c controller avoid rest of
+		 * interrupts.
 		 */
 		if (bus->multi_master &&
 		    (readl(bus->base + ASPEED_I2C_CMD_REG) &
 		     ASPEED_I2CD_BUS_BUSY_STS))
 			aspeed_i2c_recover_bus(bus);
+		else
+			aspeed_i2c_reset(bus);
 
 		/*
 		 * If timed out and the state is still pending, drop the pending
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ