From mboxrd@z Thu Jan 1 00:00:00 1970 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 175DDC4332F for ; Mon, 6 Dec 2021 21:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351094AbhLFVWT (ORCPT ); Mon, 6 Dec 2021 16:22:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350972AbhLFVWR (ORCPT ); Mon, 6 Dec 2021 16:22:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42336C0613FE; Mon, 6 Dec 2021 13:18:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08C5EB81110; Mon, 6 Dec 2021 21:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192B6C341CB; Mon, 6 Dec 2021 21:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638825525; bh=ieMRINSLQZOaXtUuMPBG7qs30pirXAP4drjmkWcEZrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ad00IJYOlLhimOglK3ao7DQBWFzYaF4wmNwSROa8iEuTBMBUbkUqZe9RkHzk1EWDC R44SPT9sqvL5XaCJ+/OZB6S30evJ1V6+5ydFt/H28FjaqFkpu9xxiBg22aEkJ2RFSi VHHp48ez2nRj6JyEs5VXnoHc+5PIxqOOvnCqVQTZoSoJjaMTtL+0KP+Lm5gmZR376f FMtLQy26uzfQ7sY46r2t3Kly3zUHidGCuLsxXDUVD3F/pmdDsHpOmbJ7q1hlOY/z5i 3lefg+tDxHZC1jEn0d3iakPT1ensDtRF/C9jK0yrfWyCWd0dRIGekmJP0vcY/a/QeQ GUdr3LvZKW1mw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ondrej Jirman , John Keeping , Wolfram Sang , Sasha Levin , heiko@sntech.de, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 06/10] i2c: rk3x: Handle a spurious start completion interrupt flag Date: Mon, 6 Dec 2021 16:17:25 -0500 Message-Id: <20211206211738.1661003-6-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211206211738.1661003-1-sashal@kernel.org> References: <20211206211738.1661003-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ondrej Jirman [ Upstream commit 02fe0fbd8a21e183687925c3a266ae27dda9840f ] In a typical read transfer, start completion flag is being set after read finishes (notice ipd bit 4 being set): trasnfer poll=0 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 33 This causes I2C transfer being aborted in polled mode from a stop completion handler: trasnfer poll=1 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 0 rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 13 i2c stop rk3x-i2c fdd40000.i2c: unexpected irq in STOP: 0x10 Clearing the START flag after read fixes the issue without any obvious side effects. This issue was dicovered on RK3566 when adding support for powering off the RK817 PMIC. Signed-off-by: Ondrej Jirman Reviewed-by: John Keeping Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-rk3x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 1a33007b03e9e..1107a5e7229e4 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -422,8 +422,8 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) if (!(ipd & REG_INT_MBRF)) return; - /* ack interrupt */ - i2c_writel(i2c, REG_INT_MBRF, REG_IPD); + /* ack interrupt (read also produces a spurious START flag, clear it too) */ + i2c_writel(i2c, REG_INT_MBRF | REG_INT_START, REG_IPD); /* Can only handle a maximum of 32 bytes at a time */ if (len > 32) -- 2.33.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7A420C433FE for ; Mon, 6 Dec 2021 21:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rfPE6UiSZWWX+zj/KP+tUW8/db15BHJGAklms1h/LnM=; b=ug0xST/UykONGB 7q2EOUQ88bVzqVmp6N83OYEzVmVkW99DATLUIDPRIrkDAGEz99xh5LMIc9lcy/tgdEsw52aKm1nWf P+0KGZonXbQKxRch/LcSINZWb9wpSw4NZPL8+cQ1TZOcMOlo7CV+jTRrlvY+rco7sqFL4vu9UQsvN VBIh6SMd2VPAkotCG8FfM8xMjxinOPdhwoSkvFhie9qTtrES4l8EiZWoRsHE+ByezgfT/18A9Z8EE kH3LdbcYkUlhtZ7SoEhbQB4JJ2IZmxUOy/142kV43ltyXEdZn4STDP9o+bikpOR5jQ5Hafv5Fcwc6 AViS8Wfq5n/MTtKeBcng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muLR5-005qKa-Mh; Mon, 06 Dec 2021 21:22:11 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muLNo-005or9-Px; Mon, 06 Dec 2021 21:18:50 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 70428B81084; Mon, 6 Dec 2021 21:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192B6C341CB; Mon, 6 Dec 2021 21:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638825525; bh=ieMRINSLQZOaXtUuMPBG7qs30pirXAP4drjmkWcEZrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ad00IJYOlLhimOglK3ao7DQBWFzYaF4wmNwSROa8iEuTBMBUbkUqZe9RkHzk1EWDC R44SPT9sqvL5XaCJ+/OZB6S30evJ1V6+5ydFt/H28FjaqFkpu9xxiBg22aEkJ2RFSi VHHp48ez2nRj6JyEs5VXnoHc+5PIxqOOvnCqVQTZoSoJjaMTtL+0KP+Lm5gmZR376f FMtLQy26uzfQ7sY46r2t3Kly3zUHidGCuLsxXDUVD3F/pmdDsHpOmbJ7q1hlOY/z5i 3lefg+tDxHZC1jEn0d3iakPT1ensDtRF/C9jK0yrfWyCWd0dRIGekmJP0vcY/a/QeQ GUdr3LvZKW1mw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ondrej Jirman , John Keeping , Wolfram Sang , Sasha Levin , heiko@sntech.de, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 06/10] i2c: rk3x: Handle a spurious start completion interrupt flag Date: Mon, 6 Dec 2021 16:17:25 -0500 Message-Id: <20211206211738.1661003-6-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211206211738.1661003-1-sashal@kernel.org> References: <20211206211738.1661003-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_131849_027126_972989A9 X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Ondrej Jirman [ Upstream commit 02fe0fbd8a21e183687925c3a266ae27dda9840f ] In a typical read transfer, start completion flag is being set after read finishes (notice ipd bit 4 being set): trasnfer poll=0 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 33 This causes I2C transfer being aborted in polled mode from a stop completion handler: trasnfer poll=1 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 0 rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 13 i2c stop rk3x-i2c fdd40000.i2c: unexpected irq in STOP: 0x10 Clearing the START flag after read fixes the issue without any obvious side effects. This issue was dicovered on RK3566 when adding support for powering off the RK817 PMIC. Signed-off-by: Ondrej Jirman Reviewed-by: John Keeping Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-rk3x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 1a33007b03e9e..1107a5e7229e4 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -422,8 +422,8 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) if (!(ipd & REG_INT_MBRF)) return; - /* ack interrupt */ - i2c_writel(i2c, REG_INT_MBRF, REG_IPD); + /* ack interrupt (read also produces a spurious START flag, clear it too) */ + i2c_writel(i2c, REG_INT_MBRF | REG_INT_START, REG_IPD); /* Can only handle a maximum of 32 bytes at a time */ if (len > 32) -- 2.33.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC481C433EF for ; Mon, 6 Dec 2021 21:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PVTw2Xyn0qER5cLKqZyIqiIhgLirGukf79NBQ6UVlYU=; b=FYnx1LlPMvEylW x6UBqm+a35tvDDXOpktbms/jz5i3pw/yvsOUy6ZqIPmQCh7gDQT+hwqWNHHDiDvcBsn6JOKTuEp6D HYgztVhd7ScK+PCaBN9W3oLcwZ1mIFmCTwUo90YmDLFPdlULTH9I4AwWer0X8xi8YO1M9Nni6hjiC J8Gx7AVmZ9ECCr9VAqNdLEMoI6N7haqU249j0bLUJvqtTYl7hdSHxpjkAfI6S3s7qD5hoVCuTvZVT S2az0p3BKONCIpE7YRru01ndfJIxsqIQua7MbqldonUh3oOIk3h7hAFsOYSbianYiHsDPOcpnBHyY YvDO1UZEzId5F+0OqHPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muLQL-005q0P-Rn; Mon, 06 Dec 2021 21:21:26 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muLNo-005or9-Px; Mon, 06 Dec 2021 21:18:50 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 70428B81084; Mon, 6 Dec 2021 21:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192B6C341CB; Mon, 6 Dec 2021 21:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638825525; bh=ieMRINSLQZOaXtUuMPBG7qs30pirXAP4drjmkWcEZrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ad00IJYOlLhimOglK3ao7DQBWFzYaF4wmNwSROa8iEuTBMBUbkUqZe9RkHzk1EWDC R44SPT9sqvL5XaCJ+/OZB6S30evJ1V6+5ydFt/H28FjaqFkpu9xxiBg22aEkJ2RFSi VHHp48ez2nRj6JyEs5VXnoHc+5PIxqOOvnCqVQTZoSoJjaMTtL+0KP+Lm5gmZR376f FMtLQy26uzfQ7sY46r2t3Kly3zUHidGCuLsxXDUVD3F/pmdDsHpOmbJ7q1hlOY/z5i 3lefg+tDxHZC1jEn0d3iakPT1ensDtRF/C9jK0yrfWyCWd0dRIGekmJP0vcY/a/QeQ GUdr3LvZKW1mw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ondrej Jirman , John Keeping , Wolfram Sang , Sasha Levin , heiko@sntech.de, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 06/10] i2c: rk3x: Handle a spurious start completion interrupt flag Date: Mon, 6 Dec 2021 16:17:25 -0500 Message-Id: <20211206211738.1661003-6-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211206211738.1661003-1-sashal@kernel.org> References: <20211206211738.1661003-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_131849_027126_972989A9 X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ondrej Jirman [ Upstream commit 02fe0fbd8a21e183687925c3a266ae27dda9840f ] In a typical read transfer, start completion flag is being set after read finishes (notice ipd bit 4 being set): trasnfer poll=0 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 33 This causes I2C transfer being aborted in polled mode from a stop completion handler: trasnfer poll=1 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 0 rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 13 i2c stop rk3x-i2c fdd40000.i2c: unexpected irq in STOP: 0x10 Clearing the START flag after read fixes the issue without any obvious side effects. This issue was dicovered on RK3566 when adding support for powering off the RK817 PMIC. Signed-off-by: Ondrej Jirman Reviewed-by: John Keeping Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-rk3x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 1a33007b03e9e..1107a5e7229e4 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -422,8 +422,8 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) if (!(ipd & REG_INT_MBRF)) return; - /* ack interrupt */ - i2c_writel(i2c, REG_INT_MBRF, REG_IPD); + /* ack interrupt (read also produces a spurious START flag, clear it too) */ + i2c_writel(i2c, REG_INT_MBRF | REG_INT_START, REG_IPD); /* Can only handle a maximum of 32 bytes at a time */ if (len > 32) -- 2.33.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel