From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 03E4F566A; Tue, 23 Jan 2024 00:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968697; cv=none; b=tH8npa1/i3aJ5oyDQeRYFyVL0MYePQMP4PpxxeIHKoYaFo1g6Olg/QOAFtwXN0G+tbHdcXnlTRnmQgqnzSGNs59FCCG5LlijfMeY5dqm1wf9GsG2l2y4YuYepAHdPbvZ/d0yd27y9ZXG0YDMoSltNIzGdfigRQ+mg+0OoYPb44Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968697; c=relaxed/simple; bh=l9kPzN3xqk4Lz4p00i+VR1o1H3x6TSb8q2yixgvRFEI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mVATCrop62MgvF3IzI4d0D8RsGH7Hmv1UvutOQBpwnYS8U8uKDma9/4zYOhdc5XAJ/h4p1HFnCqnaDV5+3UTpmu7mXQxbB1EjCnc8TUJXwgnV0YAE/Xga95nZipcis7xSMWe/F2VhU7apZa/RHnarp4jlkvhteNfbA613tP1toA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tXbYCPtX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tXbYCPtX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E24FC433C7; Tue, 23 Jan 2024 00:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705968696; bh=l9kPzN3xqk4Lz4p00i+VR1o1H3x6TSb8q2yixgvRFEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tXbYCPtXlsgsmoVPOelOD9MjFAcKdA/sR9DElLWBh3eBhVDg9Pqw+FvJyYNdkujYh UFkH2ddq5CnveuiFUps47tD4PfxByCcMI9xr8aj9pgu8ERf3+Ba0fP0HwfypX2b5ST opIP4PI9c4SEb3Uxiz0U5c1e4E4uhFPrVmsEAq/g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marek Szyprowski , Chanho Park , Andi Shyti , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 145/148] i2c: s3c24xx: fix read transfers in polling mode Date: Mon, 22 Jan 2024 15:58:21 -0800 Message-ID: <20240122235718.478431086@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235712.442097787@linuxfoundation.org> References: <20240122235712.442097787@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Szyprowski [ Upstream commit 0d9cf23ed55d7ba3ab26d617a3ae507863674c8f ] To properly handle read transfers in polling mode, no waiting for the ACK state is needed as it will never come. Just wait a bit to ensure start state is on the bus and continue processing next bytes. Fixes: 117053f77a5a ("i2c: s3c2410: Add polling mode support") Signed-off-by: Marek Szyprowski Reviewed-by: Chanho Park Reviewed-by: Andi Shyti Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-s3c2410.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 4c6036920388..8186af573a02 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -233,8 +233,17 @@ static bool is_ack(struct s3c24xx_i2c *i2c) int tries; for (tries = 50; tries; --tries) { - if (readl(i2c->regs + S3C2410_IICCON) - & S3C2410_IICCON_IRQPEND) { + unsigned long tmp = readl(i2c->regs + S3C2410_IICCON); + + if (!(tmp & S3C2410_IICCON_ACKEN)) { + /* + * Wait a bit for the bus to stabilize, + * delay estimated experimentally. + */ + usleep_range(100, 200); + return true; + } + if (tmp & S3C2410_IICCON_IRQPEND) { if (!(readl(i2c->regs + S3C2410_IICSTAT) & S3C2410_IICSTAT_LASTBIT)) return true; -- 2.43.0