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,URIBL_BLOCKED,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 9F27CC433E0 for ; Tue, 23 Jun 2020 20:03:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 762372082F for ; Tue, 23 Jun 2020 20:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592942612; bh=ehPQWl894sbgTNmzS/SIs0Z6pQg1mVWU2x14we6GvyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Z6XYf2YRzWvNwlzmHKjD4D7V567UbyIK9qSWAP21Hs0urdOZEmDcA3qjTBLd8Mh+T 8HPvJNloAly7EQJRiZlgY+WfcUTxknJweR263H2JJAyNXxOu3foJuhdYmjXxK+w5J7 cXxamEGO1zVeqbic3/LqsN/RoelvdsNOAHd+mnt0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388037AbgFWUDZ (ORCPT ); Tue, 23 Jun 2020 16:03:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:41106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388032AbgFWUDZ (ORCPT ); Tue, 23 Jun 2020 16:03:25 -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 4F6A82078A; Tue, 23 Jun 2020 20:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592942604; bh=ehPQWl894sbgTNmzS/SIs0Z6pQg1mVWU2x14we6GvyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1zk2S3qfn6H2fYiWR3s5ezLn4hNfuQ7GY+byZj1BLszRwM8WgLRfO3/BXxG2zey+Y RnfF+LnYlBU4bTfyuYlX3pojoIGU04V1udvRC+zz5A6cdayi/OkB6sRZ1/ZrFPmC87 3KXS7lWce1FiJfFm2YBrdoUqgYA77cAYYZXEFBX4= 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 5.7 036/477] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Date: Tue, 23 Jun 2020 21:50:33 +0200 Message-Id: <20200623195409.307067673@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195407.572062007@linuxfoundation.org> References: <20200623195407.572062007@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 466e4f681d7a4..30a6e07212a42 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -747,11 +747,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