From patchwork Thu Sep 28 19:24:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 727979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7337CE7B1F for ; Thu, 28 Sep 2023 19:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbjI1TYc (ORCPT ); Thu, 28 Sep 2023 15:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbjI1TYb (ORCPT ); Thu, 28 Sep 2023 15:24:31 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B1B51A3 for ; Thu, 28 Sep 2023 12:24:29 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230928192427euoutp01687a6ef70ad527a28bc3c4e36652309a~JJoBrYx3-1092710927euoutp01b for ; Thu, 28 Sep 2023 19:24:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230928192427euoutp01687a6ef70ad527a28bc3c4e36652309a~JJoBrYx3-1092710927euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1695929067; bh=GFOyU81B/Zw0ASGJNMLnJcw4VVGvy7QuYTXBvsRx+xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8k+eG2amUBfRrEN/nSRgUUQeLsrCAc/VPgQf8jAMD0Xngi9t1Q/8eeVwFhTFFyJ7 i5LHredwrBnakxBO4cY7V6A01A0ra0qC1I1/pgx57uOYS43H7bC8GlzJCpHSkCcVb4 ycjhBcHGrUm+dgHTXNJhv/y1YlPOcT0q4ez79OtE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230928192426eucas1p104af8583aedfa059f6ee7bad21573821~JJoAm_1Nm1181211812eucas1p17; Thu, 28 Sep 2023 19:24:26 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id DC.60.11320.AE2D5156; Thu, 28 Sep 2023 20:24:26 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230928192426eucas1p2b1763303daefc3fe1ac9354c17432572~JJoAOlcjT0047000470eucas1p2p; Thu, 28 Sep 2023 19:24:26 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230928192426eusmtrp2fd6c1a553186f69c82c415e7fda1585a~JJoAOFyXz2794927949eusmtrp2l; Thu, 28 Sep 2023 19:24:26 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-9c-6515d2eafc61 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 02.F9.25043.AE2D5156; Thu, 28 Sep 2023 20:24:26 +0100 (BST) Received: from AMDC4653.digital.local (unknown [106.120.51.32]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230928192425eusmtip22b152eb299f6856c83994bbbac2651ce~JJn-y2dj12447124471eusmtip2P; Thu, 28 Sep 2023 19:24:25 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , Alim Akhtar , Andi Shyti , Wolfram Sang Subject: [PATCH 1/3] i2c: s3c24xx: fix read transfers in polled mode Date: Thu, 28 Sep 2023 21:24:12 +0200 Message-Id: <20230928192414.258169-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928192414.258169-1-m.szyprowski@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduznOd1Xl0RTDbbOkLF4MG8bm8X9rx2M Fntfb2W36Pj7hdFixvl9TBZrj9xlt7i7fy6jA7vHplWdbB53ru1h8+jbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MCf9fsBfc5ai43MXdwDiJvYuRk0NCwESi89RFpi5GLg4hgRWMErsu3mKE cL4wSuybdpMZwvnMKLG98wtcy7/VU6CqljNKLJ39mhkkAdYybZcriM0mYCjR9baLDcQWEXCQ mLf2OztIA7PAZaCaOduYQBLCAi4SW/+9ZwWxWQRUJSa1NANN5eDgFbCT+HRSB2KZvMT+g2eZ QcKcAvYSFz5LgoR5BQQlTs58wgJiMwOVNG+dDXaohMAWDombrX+ZIXpdJKZ1rYeyhSVeHd8C 9YCMxP+d85kgGtoZJRb8vg/lTGCUaHgOCgCQKmuJO+d+sYFsZhbQlFi/Sx8i7Chx9M8LsLCE AJ/EjbeCEEfwSUzaNp0ZIswr0dEmBFGtJjHr+Dq4tQcvXII6x0Pi1ZNTzBMYFWcheWcWkndm IexdwMi8ilE8tbQ4Nz212CgvtVyvODG3uDQvXS85P3cTIzC9nP53/MsOxuWvPuodYmTiYDzE KMHBrCTC+/C2UKoQb0piZVVqUX58UWlOavEhRmkOFiVxXm3bk8lCAumJJanZqakFqUUwWSYO TqkGphB7A4mb30VfpLGzhAZNPJOybNmBjtvTV93Uf3Qk8Y992vOnHd0sUuufeN0+93ZNiv+J Ttu8qf19pt7JR89cm1/x7Z6X/7Wt52+Lrjj/XXN/lds2+W3XopN/7e2fZla9yT3o4urob8aC zHbNhnOn/90i++nGvWmOU5zeV7oknl3iv+P+KQ2b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fx0t20jj/G0R+5K3+Mm C994FxXzVf5CHL/Y3Md5G+Mmsc3oVPWZHPGx/rug8s/Df67suN5Z/UotNVjf9lOzyo7bATLP jNo9np6a8bQx/4eadv/MxyWL0wuivgfMf6zO15B5ikXjsK2nEktxRqKhFnNRcSIASC0KqQsD AAA= X-CMS-MailID: 20230928192426eucas1p2b1763303daefc3fe1ac9354c17432572 X-Msg-Generator: CA X-RootMTR: 20230928192426eucas1p2b1763303daefc3fe1ac9354c17432572 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230928192426eucas1p2b1763303daefc3fe1ac9354c17432572 References: <20230928192414.258169-1-m.szyprowski@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org To properly handle read transfers in polled mode, no waiting for the ACK state is needed. Just wait a bit to ensure start state is on the bus and continue processing bytes. Fixes: 117053f77a5a ("i2c: s3c2410: Add polling mode support") Signed-off-by: Marek Szyprowski --- drivers/i2c/busses/i2c-s3c2410.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 127eb3805fac..f9dcb1112a61 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -216,8 +216,13 @@ 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)) { + usleep_range(100, 200); + return true; + } + if (tmp & S3C2410_IICCON_IRQPEND) { if (!(readl(i2c->regs + S3C2410_IICSTAT) & S3C2410_IICSTAT_LASTBIT)) return true;