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 X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8466C433DF for ; Tue, 23 Jun 2020 20:44:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99EA621883 for ; Tue, 23 Jun 2020 20:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945043; bh=XNkhXmY1tC3RoZRIYENo9Ac3fpaA4tpaohXsc2LygiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ihlQhf/T08VDqRGvV0wnE4e/iYCDUh9IDSVbYswA5D5R3K8Sq/d84GWoO7mSHIien bxGFdtlhOCAEsZMNTfsjf+bnFLVRVwdGO/Bcpj9Lywp3x/5xRtSyUGK8C+Q4DJ0prv Wm9QpnPTtyYvleHLZySLnPibJ78Md5rl5Rfz/Zs0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392562AbgFWUoB (ORCPT ); Tue, 23 Jun 2020 16:44:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:41050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403935AbgFWUoB (ORCPT ); Tue, 23 Jun 2020 16:44:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53DB52053B; Tue, 23 Jun 2020 20:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945041; bh=XNkhXmY1tC3RoZRIYENo9Ac3fpaA4tpaohXsc2LygiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L8p+mxMv4PLvuXtCxleEyi5ZHrXxyZ/ikS59XVT9dEAgUkZL0MLUXGQKO+xd1a+JY AcTXIN9IQmJDSbF0pSU3J5KrqEtIlqvvU2Z1tMdvIO6JkEPkpluyAoU4aEM80T+Ixh M2W3BOct8ljQNwtL34LQjff/JCDXG79ZhrpdanN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 017/136] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Date: Tue, 23 Jun 2020 21:57:53 +0200 Message-Id: <20200623195304.483648797@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Russell King [ Upstream commit e81c979f4e071d516aa27cf5a0c3939da00dc1ca ] If we timeout during a message transfer, the control register may contain bits that cause an action to be set. Read-modify-writing the register leaving these bits set may trigger the hardware to attempt one of these actions unintentionally. Always clear these bits when cleaning up after a message or after a timeout. Signed-off-by: Russell King Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-pxa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 600d264e080c5..ecc84aea51319 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -709,11 +709,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) { u32 icr; - /* - * Clear the STOP and ACK flags - */ + /* Clear the START, STOP, ACK, TB and MA flags */ icr = readl(_ICR(i2c)); - icr &= ~(ICR_STOP | ICR_ACKNAK); + icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA); writel(icr, _ICR(i2c)); } -- 2.25.1