Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp482764pxj; Thu, 27 May 2021 05:06:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHzvli8Md5MwGNc2sGDuUGXtqQ7dIV1LVUIq5VDTYgbc7YVKiJk1BTDd1uzOAoGAS2oejw X-Received: by 2002:a5d:9916:: with SMTP id x22mr2531860iol.160.1622117183334; Thu, 27 May 2021 05:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622117183; cv=none; d=google.com; s=arc-20160816; b=JXQiwva0giPsFtTUV49VX/fXpYBM/wH9GAoXToBf+B7P5iO0FP1MmjeoZNBwGzPCub TwcfrBPfjEZaJ+WyjjeK/PbJxPuaNZD41odBRo2s/mZPLv+XGpDeWaIkpDnOfW0wvnYT PBX0Cv4sExX6nZehm3ar595z56IBYu513xo2WPThDAnp01qoZLO/2RfqlnmhHtCu4Sg+ ey8PHktl907h/LJtQtnWbCLyrNO3OocNIC6cOMZMT9q2D3goGFWYRV13ztqD/mvRhf/o HaU9jcao2MrOGdQ72fQKy1i38S2jTWueyO4EXB3bK7gKW2B9JtBh9HlwPUiTgGkphTgI X2Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=4E9MC5tbMFq/rEzHmaThPrkWvGrI9B3szjH7IpzCkGk=; b=ggRNRuhc9lVvFD8sPcq6afUWesxpG0vCqrUsa+j8mHOyfQCjvbdsz4lB10XMWP73qE bmFOvnugEfOnNp5+i6R4moPw/htbIQhUSgMDyvz8vQunfGYMTLp5AHLFa/H2Tq3iBsV7 kvFwdCR3oD3VHr05tprSXBBYdeylMbTfcutWVsPoVN7cL07ye2vCQYe7AsvoOluJoJvl J9lpVNBPFDLH2QJry2vqoVi0K4qKmTEwo1NtX6/oB5EyFK9GVxnpJ5HQI1hRJP+li+5q rvcSMctATnkCF4O4YSsPmVqqX92Epn/wGCOaI7jmzjTSwCl4+q3wNHnnjq02fCLEtMp5 g/9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o15si446637ilu.104.2021.05.27.05.06.06; Thu, 27 May 2021 05:06:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234556AbhE0MFw (ORCPT + 99 others); Thu, 27 May 2021 08:05:52 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:51625 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S234473AbhE0MFt (ORCPT ); Thu, 27 May 2021 08:05:49 -0400 X-UUID: 74dbc9213a9a4fc5b3d241da7d927960-20210527 X-UUID: 74dbc9213a9a4fc5b3d241da7d927960-20210527 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2069908993; Thu, 27 May 2021 20:04:11 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 27 May 2021 20:04:10 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 27 May 2021 20:04:07 +0800 From: To: CC: , , , , , , , Subject: [PATCH] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset Date: Thu, 27 May 2021 20:04:04 +0800 Message-ID: <1622117044-7583-1-git-send-email-qii.wang@mediatek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qii Wang The i2c controller driver do dma reset after transfer timeout, but sometimes dma reset will trigger an unexpected DMA_ERR irq. It will cause the i2c controller to continuously send interrupts to the system and cause soft lock-up. So we need to disable i2c start_en and clear intr_stat to stop i2c controller before dma reset when transfer timeout. Signed-off-by: Qii Wang --- drivers/i2c/busses/i2c-mt65xx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index ea337ba..bfd80b2 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -479,6 +479,11 @@ static void mtk_i2c_clock_disable(struct mtk_i2c *i2c) static void mtk_i2c_init_hw(struct mtk_i2c *i2c) { u16 control_reg; + u16 intr_stat_reg; + + mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START); + intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT); + mtk_i2c_writew(i2c, intr_stat_reg, OFFSET_INTR_STAT); if (i2c->dev_comp->apdma_sync) { writel(I2C_DMA_WARM_RST, i2c->pdmabase + OFFSET_RST); -- 1.9.1