From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C41B3B29E; Sun, 10 Aug 2025 18:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.160.73.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754849182; cv=none; b=lfgRWjKIE30tpycZ7/14zCkrZm6mhPIJU83t/00DCdfV7UrPo0MCJNUHjTXz/TgpsAgWUzvbzrmF6Vlwv0cslhvNcCoCOlU7YJAqVyqSBcKBgS+0OmchTRlCcfzndKcqPPpUuWcCiEVG39aIpeYCwMw6Yza5IcBLrrpN1DqvdZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754849182; c=relaxed/simple; bh=JkSHmP5mjo+WXOJdZpYaGBO+h2dGd7a2OUfPAZBNFqg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QQyxXs4t0qTYL35RXY+SIGzbK0cKhe8J6NxjIXq8mRlHCd12kC4ELLVtTjxvWQK4Ix89W0MfrUqAdMmuNdJX3wrtP3v9k9hsCZ2cNDGOXfGfP4pgkqoFyPjGPlcsWhPecgxjcTbSSKWaKanUUcf94cPL+3aSw/LiBDz4bhYxrAA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org; spf=pass smtp.mailfrom=narfation.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b=hYoWk2gQ; arc=none smtp.client-ip=213.160.73.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=narfation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="hYoWk2gQ" Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a00:1ca0:1d86:99fc::8c24]) by dvalin.narfation.org (Postfix) with UTF8SMTPSA id CDEA220019; Sun, 10 Aug 2025 18:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1754849178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sgIYXfd+vWJAvPi6jchjBMNFQIUKjayvrf4gwD/0FZY=; b=hYoWk2gQmsZQUj/36HjbPjjCT4bpy7iYmGjhhry7H2U2jAoDPi1aBHS1hKmYFzJEuSO/ss zEC9Nov6zbink0IsRC0Osq7qOp9fxvO+yDPA03jEWWXfTXPV4Ju4toFqdunR9DfRr3Tf8x /MxgUMMXHKMhiZdddhBx99BtQDuZmlY= From: Sven Eckelmann Date: Sun, 10 Aug 2025 20:05:15 +0200 Subject: [PATCH i2c-host-fixes v5 3/5] i2c: rtl9300: Increase timeout for transfer polling Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250810-i2c-rtl9300-multi-byte-v5-3-cd9dca0db722@narfation.org> References: <20250810-i2c-rtl9300-multi-byte-v5-0-cd9dca0db722@narfation.org> In-Reply-To: <20250810-i2c-rtl9300-multi-byte-v5-0-cd9dca0db722@narfation.org> To: Chris Packham , Andi Shyti Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Jonas Jelonek , Harshal Gohel , Simon Wunderlich , Sven Eckelmann , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1823; i=sven@narfation.org; h=from:subject:message-id; bh=JkSHmP5mjo+WXOJdZpYaGBO+h2dGd7a2OUfPAZBNFqg=; b=owGbwMvMwCXmy1+ufVnk62nG02pJDBkz7nd4OVtsK/pvbHNkmfKH4Ab2t/MjTnpFmrz8l7iP+ czFoz9Od5SyMIhxMciKKbLsuZJ/fjP7W/nP0z4ehZnDygQyhIGLUwAm4iLK8N/jhGrFU6sZ4bfc 6xxW2f6QlM30OmGls7ilQT97hdzaT1oM/wsDYmo2WrrMuJXw6u++Bu27rrrBvLvuh174u2WPQNj bB5wA X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF The timeout for transfers was only set to 2ms. Because of this relatively low limit, 12-byte read operations to the frontend MCU of a RTL8239 POE PSE chip cluster was consistently resulting in a timeout. The original OpenWrt downstream driver [1] was not using any timeout limit at all. This is also possible by setting the timeout_us parameter of regmap_read_poll_timeout() to 0. But since the driver currently implements the ETIMEDOUT error, it is more sensible to increase the timeout in such a way that communication with the (quite common) Realtek I2C-connected POE management solution is possible. [1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/realtek/files-6.12/drivers/i2c/busses/i2c-rtl9300.c;h=c4d973195ef39dc56d6207e665d279745525fcac#l202 Cc: Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller") Signed-off-by: Sven Eckelmann Reviewed-by: Chris Packham Tested-by: Chris Packham --- drivers/i2c/busses/i2c-rtl9300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c index 4a538b2660802c98e1a51d2ed782e154f2a5d1a0..4a282d57e2c1a72c95bdabdd9eb348a73df28c44 100644 --- a/drivers/i2c/busses/i2c-rtl9300.c +++ b/drivers/i2c/busses/i2c-rtl9300.c @@ -175,7 +175,7 @@ static int rtl9300_i2c_execute_xfer(struct rtl9300_i2c *i2c, char read_write, return ret; ret = regmap_read_poll_timeout(i2c->regmap, i2c->reg_base + RTL9300_I2C_MST_CTRL1, - val, !(val & RTL9300_I2C_MST_CTRL1_I2C_TRIG), 100, 2000); + val, !(val & RTL9300_I2C_MST_CTRL1_I2C_TRIG), 100, 100000); if (ret) return ret; -- 2.47.2