Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp580396img; Fri, 22 Mar 2019 04:28:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqya4NLPJnfkBFijJNgueXjw1V1S72iiYcACXAj6qpr9lvfcUpCcyg3wUTXDOwyeKQ0rdDLE X-Received: by 2002:a63:d706:: with SMTP id d6mr8002896pgg.367.1553254111869; Fri, 22 Mar 2019 04:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553254111; cv=none; d=google.com; s=arc-20160816; b=YpESwupNcHv28OYnsXRnU6tYBNzfOf+O6i3EIRyNoyNkDdFgyFEAmoAxbky3DbbGM4 ga1DOL1nfiV0BWU0szsYUQdSSo3oxVInBcRmCxmFp4FEPe61CoKO15plsg87sax8tzV6 CnptfiyxhWnRYguSvnaV0CVJNwgWlpX/T7i1tsYcuydfcmmBDBXuAQ1GaLx+C9KM5002 2XJ2DhbQUvA4KesaWG8HoWn3ivS36B25AjmGWQeE6CoMrU2OdYGoILCJWOdUT3xvoa6i 225mfOcWH7j62zIhKtv0OMa/sLpzNh3XwuAo66cfbTfDllW3FAMi58x4UHsSWIKEA8ry kutQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iLxvkDrr+SFVVUD+hykWmZcQiIXRW/nqTFsspEpV9rE=; b=UgWhopkx7rjcd3mPVIbhrgqw7wlb3gwJM+olDRxhv5AD+SFQYTXCS0oWAYk7BUH6jr YIxbrZHAlEQLLQIIdfZVPQzwp/cA3/98ReI0oqm3YWm9ZSPTzAaQj/JZcO73LWHdKAoo mG8A8bRGmi6gk9wHbmvlRywkqCL5w5axANSPAHGG9DbXaHyqQ+TFxY/hSfnoM4uKkUjI qHxBNsLXekF4hulN0YsTwLEjyXHj+MpEYEfvaszdcHfkYD52oFAjV4V25SnITKBBpNA+ imTp2iST9zZ51X/RaQBm3ssbZiMvnhlKFONpFrrXz4GtVLoqypLJpDVld+7uFbrrBGIu FxIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R6VLXGVV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si6398761pgh.447.2019.03.22.04.28.16; Fri, 22 Mar 2019 04:28:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R6VLXGVV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729322AbfCVLZi (ORCPT + 99 others); Fri, 22 Mar 2019 07:25:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:53072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728957AbfCVLZh (ORCPT ); Fri, 22 Mar 2019 07:25:37 -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 E4AC120657; Fri, 22 Mar 2019 11:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253937; bh=5IYmoyrM6EjWltPR3ddgbMfzajV/ZHvXTNXHdxdqJvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6VLXGVVxuRD5/QREcF4beQp1kgGZdeNkJt72bNYNdXn7qe26qupZGqsoO4kr3rsd 9JWx75DyrNcTFVAgAauHH33cAnw0YJraga8NcHZ4ObGE4fdgmYPL8jgePba9FKGygc 06QvvTD7nErTNUCEgoSp9NYFjMxrDNhdlDgvL9m8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kyle Roeschley , Michal Simek , Shubhrajyoti Datta , Wolfram Sang , Sasha Levin Subject: [PATCH 3.18 100/134] i2c: cadence: Fix the hold bit setting Date: Fri, 22 Mar 2019 12:15:13 +0100 Message-Id: <20190322111217.392704080@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit d358def706880defa4c9e87381c5bf086a97d5f9 ] In case the hold bit is not needed we are carrying the old values. Fix the same by resetting the bit when not needed. Fixes the sporadic i2c bus lockups on National Instruments Zynq-based devices. Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") Reported-by: Kyle Roeschley Acked-by: Michal Simek Signed-off-by: Shubhrajyoti Datta Tested-by: Kyle Roeschley Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-cadence.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index c604f4c3ac0d..c50a015018fe 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -320,8 +320,10 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) * Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ - if (id->recv_count > CDNS_I2C_FIFO_DEPTH) + if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag) ctrl_reg |= CDNS_I2C_CR_HOLD; + else + ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD; cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); @@ -375,8 +377,11 @@ static void cdns_i2c_msend(struct cdns_i2c *id) * Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ - if (id->send_count > CDNS_I2C_FIFO_DEPTH) + if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag) ctrl_reg |= CDNS_I2C_CR_HOLD; + else + ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD; + cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); /* Clear the interrupts in interrupt status register. */ -- 2.19.1