From patchwork Tue Jun 23 19:55:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223276 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=unavailable 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 6AFC1C433DF for ; Tue, 23 Jun 2020 21:07:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C50920663 for ; Tue, 23 Jun 2020 21:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592946466; bh=RQli2J4I/jyniwWKu6wruRJBiNlKlP1LqrZx1ueq5pI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Mc6YU6J+jUg0v7rk1rpUS4MlC9nrOwIY48Qg6Y3lKhbllADgVE6WqTNqY0C2H3htv 7vp5GvKOnuqbRJun6wHlYkApO5mTuHqonNZpH2MQDcsG4fv/YGmCQN5R36CsBQy1G6 IrY/wIq6GKEnNUVsLSJeAGt/jSUQt17G5ZcKFNgo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393178AbgFWVHe (ORCPT ); Tue, 23 Jun 2020 17:07:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:57414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391608AbgFWUfJ (ORCPT ); Tue, 23 Jun 2020 16:35: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 D4095206C3; Tue, 23 Jun 2020 20:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944509; bh=RQli2J4I/jyniwWKu6wruRJBiNlKlP1LqrZx1ueq5pI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzSMslVJ8lQsBs/1vZkiCTGT2J1d2apAOZ2UU4mk/Zxp5xBoq5etssnTYWPa4EH7W h0K6r/UWevh9B+WJvK2zbrfFFVkyza8q4LFpeLvjWmRN3B2xuUajhB93LsykwbkF8Y iy0ieaaxftmk0OtIK66/UTZgip6wBWbWGbOitnbE= 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.19 018/206] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Date: Tue, 23 Jun 2020 21:55:46 +0200 Message-Id: <20200623195317.861496954@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195316.864547658@linuxfoundation.org> References: <20200623195316.864547658@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 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 fbf91d383b409..7248ba6763e45 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)); }