Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2739115pxj; Mon, 31 May 2021 09:31:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN4L96zyQVlv3HDPK9qIQt/ngcGUbCjknWpAV+3MZv+y18Psys163O8niC+RveL32mc0v9 X-Received: by 2002:a17:906:d97:: with SMTP id m23mr14328616eji.392.1622478670690; Mon, 31 May 2021 09:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622478670; cv=none; d=google.com; s=arc-20160816; b=h41+LGoV5IOseSoL2Z65YqabfW3d12THPL/31MJ9XLRLAGRsw18/y7maQNoM0EaZJS 13RvsBg9p23mwa3K5ylnivx9FcgFJXGC+CBOlB19bYTmKfwbEzVbEGNk/yJS+740cxlc H275wsiCnh8iv5SRGuw4SNlw/Hj+DNR/aev5EPcrmr8TUGgT5Zbc4preRrFZufl9wI/3 VTftZHuLLupIn+TwItLygBu5rCMRLrwvSUPAjFKkqQQLK6AWikunWk4OLlh4Yv9GQ9v0 aGvcrK+93rsVgZoxqpB72WjBggJz3dPCMtuCfCT8jfkJc8V/3nJ2w9i6GtqSjVthBHrv e12g== 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=N5eMbq2yePF8IQSWwiqq0oIrCYyZ2XbGs3ZabCbeiuf+sAjrzh4idQFdo+yY26OT1m ToUzLLjLigkS20sYXex/b9x/HNptXDHbNGOggqJCaUQCvW7wPAsFvQ/EeDkhf4eQGmFc 94l0sbd9/VF+CcRYyOmbqvyqoyIHUImdZ6fVMOb+LXDClOxnrZ+q4fK6atiucqFI+NTE uC0wcp/04mVbQbx9J79Ixy/8r12peZriwcuGWV8sV34vkqr6yFXrUUt1Lm2ySKeXBddp p3vLU2u4m01lQpUMkKu+NocLaAqbZV6p8irmdxDBVL8OWb+Ci+CXJGvhajlgKeeZ7Snu dV6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e2zVucd2; 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 x2si5615362eju.99.2021.05.31.09.30.44; Mon, 31 May 2021 09:31:10 -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=e2zVucd2; 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 S231485AbhEaQ2c (ORCPT + 99 others); Mon, 31 May 2021 12:28:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:40318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbhEaOpL (ORCPT ); Mon, 31 May 2021 10:45:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAC2461C87; Mon, 31 May 2021 13:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469310; bh=+BsTtVc6PdfMc7tMiicVr3+MQ3VK3Pq81j3/C0zPQWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2zVucd2rezemB6EMbecYjbT2RSFXFjeCj0tsMfy6dLdW/hXM4V93CVcWU2g2THKJ 1OOnfguBDw8XoYY+Lsd2pOLkmmnQwsfjGd4DMvfxrn7atyQ0RT+gilpwgFDgJwnWQE Zupzi7PuF+XfvkTMG5VKH3MUJGEtBekFB4bJES7c= 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.12 150/296] i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset Date: Mon, 31 May 2021 15:13:25 +0200 Message-Id: <20210531130708.915162917@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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);