From patchwork Thu Aug 17 09:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huangzheng Lai X-Patchwork-Id: 714477 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 F3173C27C7A for ; Thu, 17 Aug 2023 09:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349936AbjHQJr1 (ORCPT ); Thu, 17 Aug 2023 05:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349660AbjHQJq4 (ORCPT ); Thu, 17 Aug 2023 05:46:56 -0400 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FBC52D57; Thu, 17 Aug 2023 02:46:55 -0700 (PDT) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 37H9kMAr085658; Thu, 17 Aug 2023 17:46:22 +0800 (+08) (envelope-from Huangzheng.Lai@unisoc.com) Received: from SHDLP.spreadtrum.com (shmbx04.spreadtrum.com [10.0.1.214]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4RRKpL2gQvz2PyrhG; Thu, 17 Aug 2023 17:44:10 +0800 (CST) Received: from xm9614pcu.spreadtrum.com (10.13.2.29) by shmbx04.spreadtrum.com (10.0.1.214) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 17 Aug 2023 17:46:20 +0800 From: Huangzheng Lai To: Andi Shyti CC: Orson Zhai , Baolin Wang , Chunyan Zhang , , , huangzheng lai , Huangzheng Lai , Xiongpeng Wu Subject: [PATCH 7/8] i2c: sprd: Set I2C_RX_ACK when clear irq Date: Thu, 17 Aug 2023 17:45:19 +0800 Message-ID: <20230817094520.21286-8-Huangzheng.Lai@unisoc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230817094520.21286-1-Huangzheng.Lai@unisoc.com> References: <20230817094520.21286-1-Huangzheng.Lai@unisoc.com> MIME-Version: 1.0 X-Originating-IP: [10.13.2.29] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To shmbx04.spreadtrum.com (10.0.1.214) X-MAIL: SHSQR01.spreadtrum.com 37H9kMAr085658 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org We found that when clearing the I2C_TX_ACK bit, the I2C_MODE bit will also be cleared to 0. When the IIC master reads data, this situation will cause the FIFO of the IIC to be empty after clearing the interrupt. To address this issue, when clearing interrupts, set I2C_RX_ACK bit to 1, as writing 1 to this bit will not take effect. Signed-off-by: Huangzheng Lai --- drivers/i2c/busses/i2c-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c index d867389c7f17..6f65f28ea69d 100644 --- a/drivers/i2c/busses/i2c-sprd.c +++ b/drivers/i2c/busses/i2c-sprd.c @@ -138,7 +138,7 @@ static void sprd_i2c_clear_irq(struct sprd_i2c *i2c_dev) { u32 tmp = readl(i2c_dev->base + I2C_STATUS); - writel(tmp & ~I2C_INT, i2c_dev->base + I2C_STATUS); + writel((tmp & ~I2C_INT) | I2C_RX_ACK, i2c_dev->base + I2C_STATUS); } static void sprd_i2c_reset_fifo(struct sprd_i2c *i2c_dev)