Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2667265pxj; Mon, 31 May 2021 07:49:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzydxyA/X+nk9qOBG060xaOq5iXHugAYYMC33t0oRmJWaKgc1gXkSqCPcl0fKmFIOqSxq+R X-Received: by 2002:a17:907:1b02:: with SMTP id mp2mr23336010ejc.196.1622472552472; Mon, 31 May 2021 07:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472552; cv=none; d=google.com; s=arc-20160816; b=DZojlG9CqvbDmSUv9nbydNZhLgGK4m+Dcix6wj2tF6V7EvLhZlYJZbFcJ7Z93YI80p 52b3LYVwjzqSTAPClsQ5p+HEdil9GVciOT6rrHbu6ZoX5rRe16EZBWIcyGPmUBa+vr+3 /Sz1Z3xVJsK4G8EnytxotNcn3f2SUgV7cB858Pa1861GF3rTcHC8nWcTOJzf7gg3Yli7 JDG6RBcsCrq5zb7tj8UwF8VtUksr0s1mqb9owxaffoYlu+HG/uq4Oh3eHrZ+VryXAWwd Vn1Bc6HqpAy6a70vlvZ0FfPdxjPorV59kO6WrAJEH5kK1W8W1knBHfNWwqnW/7bPm4dE T7tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oXZR3WboTD5uXTx9Ytr1yFut0+WhmIgBAcJLA9mak3M=; b=lCa5KkERgHW40QhBaO5Ix4ExBlv/1SOAKJQJ/8d3AItJvowbo+UWOK64tmNvsuXfoW whiAbCmwUsUGBViGpZq2/CKIb0Ni2hNP07OeA9Bo40jLlbCk5v/HmKjUhe/FLcEDWzXq Wiahyn88J5iHPsjDgLE+/racO3W/wOAA/ShL5bBg8H1RgekRb7Ru81tOjPLLoX12C7x+ a5OAaRnf00zxs7OepePJ+CEWxNKt2nupK3DDDNxGuSiHd+nPDJ0gvW/Fgr5l7yeHwxVH jRbMEmZ+kDu1qCoHPjlHFu5DNB1qk0gvEfXg7q2/U+tvqCbatWueJy8JyE4zAjLkRsWU IxYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m6uBKTNI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bg8si14463599ejb.592.2021.05.31.07.48.50; Mon, 31 May 2021 07:49:12 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m6uBKTNI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234142AbhEaOtc (ORCPT + 99 others); Mon, 31 May 2021 10:49:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:36868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232770AbhEaOBV (ORCPT ); Mon, 31 May 2021 10:01:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 92C546144C; Mon, 31 May 2021 13:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468203; bh=+BsTtVc6PdfMc7tMiicVr3+MQ3VK3Pq81j3/C0zPQWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m6uBKTNInp/onGOy05Ukn2C6A5Jc8jvrj3iKsAgKqfaUErMS/5KnYe4ZYgoF/SnrC 7eso2YlZfLzXjwflsJaB4ZDdDUS5wK9QxZ4tz+NLsKmsD/Mcx4S3KeBK/aVxKbkIsP Z8++6JeHn6Kawi3D2IU3c4h0JMPPXUTb2E+4yhV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qii Wang , Wolfram Sang Subject: [PATCH 5.10 121/252] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset Date: Mon, 31 May 2021 15:13:06 +0200 Message-Id: <20210531130702.103473057@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qii Wang commit fed1bd51a504eb96caa38b4f13ab138fc169ea75 upstream. 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. Fixes: aafced673c06("i2c: mediatek: move dma reset before i2c reset") Signed-off-by: Qii Wang Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-mt65xx.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -478,6 +478,11 @@ static void mtk_i2c_clock_disable(struct 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);