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 894FAC433DF for ; Tue, 23 Jun 2020 20:22:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64AB42064B for ; Tue, 23 Jun 2020 20:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943731; bh=G7i77aO64Vn/HuKmSBMIphAENT2GJ98ArI3jrKSoYhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mg6B3JnnlsD0FLq+uGx88vyuIeiSOzI5Gf66ZeXniU+puEldC2+IpkaMvIunV6+LF dv0lIKTx4Iyk9rD2Ie6MjbiGutr36TnGuh4YOHgLg0iPZeF/JaVCgaECPlWNiXqtnQ Q4tl5r9G8kQSNSDfFoGP0DsnxkOvKDJWhxT5w40E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390134AbgFWUWK (ORCPT ); Tue, 23 Jun 2020 16:22:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:40004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390126AbgFWUWJ (ORCPT ); Tue, 23 Jun 2020 16:22:09 -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 BF2A62064B; Tue, 23 Jun 2020 20:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943729; bh=G7i77aO64Vn/HuKmSBMIphAENT2GJ98ArI3jrKSoYhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XZawG/Dz5M9huVfhr5aM/HPxB8dlDCLA964UUeRZ+Vt4/0lnNLO5ZLfeX4TOyCVMs URztqDaaji6Vk2FUJ0KBgfDJUZrnKtSueQkYFFiNwJ6eioqBMYXWC/8qtah0VGnapA /OJO87G75NDxSrvw6cYlm6Uf/b5AUUYNFkHEng6Q= 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.4 027/314] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Date: Tue, 23 Jun 2020 21:53:42 +0200 Message-Id: <20200623195340.103938497@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@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 2c3c3d6935c0f..c9cbc9894bacf 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -706,11 +706,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