From patchwork Thu Dec 6 17:33:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kyle Roeschley X-Patchwork-Id: 1008942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ni.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 439jP52FkXz9s3C for ; Fri, 7 Dec 2018 04:33:13 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725927AbeLFRdM (ORCPT ); Thu, 6 Dec 2018 12:33:12 -0500 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:53008 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725907AbeLFRdM (ORCPT ); Thu, 6 Dec 2018 12:33:12 -0500 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wB6HLTBi028859; Thu, 6 Dec 2018 11:33:10 -0600 Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by mx0a-00010702.pphosted.com with ESMTP id 2p5xm88n2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Dec 2018 11:33:10 -0600 Received: from us-aus-exhub2.ni.corp.natinst.com (us-aus-exhub2.ni.corp.natinst.com [130.164.68.32]) by us-aus-skprod2.natinst.com (8.16.0.27/8.16.0.27) with ESMTPS id wB6HX9SW018573 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 6 Dec 2018 11:33:09 -0600 Received: from us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) by us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 6 Dec 2018 11:33:09 -0600 Received: from senary.amer.corp.natinst.com (130.164.49.7) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 6 Dec 2018 11:33:09 -0600 From: Kyle Roeschley To: Michal Simek , CC: , =?utf-8?q?S=C3=B6ren_Brinkmann?= , John Linn , Paresh Chaudhary , Matthew Weber , Kyle Roeschley Subject: [PATCH] Revert "i2c: cadance: fix ctrl/addr reg write order" Date: Thu, 6 Dec 2018 11:33:06 -0600 Message-ID: <20181206173306.31556-1-kyle.roeschley@ni.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-06_06:, , signatures=0 X-Proofpoint-Spam-Reason: safe Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This reverts commit 8064c616984eaa015f018dba595d78cd24a0cc8c. According to the Zynq TRM ยง20.2.2 under heading Read Transfer, HOLD should be set or cleared before writing the I2C Address register. This fixes sporadic i2c bus lockups on National Instruments Zynq-based devices. Signed-off-by: Kyle Roeschley --- Tested by flooding the bus with traffic on a National Instruments cRIO-9068. Previously the bus would lock up after ~30s, now I can run overnight with no problems. drivers/i2c/busses/i2c-cadence.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index e39d002a385c..f1fa84af2492 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -651,15 +651,15 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET); } - /* Set the slave address in address register - triggers operation */ - cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET); - cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK, - CDNS_I2C_ADDR_OFFSET); /* Clear the bus hold flag if bytes to receive is less than FIFO size */ if (!id->bus_hold_flag && ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) && (id->recv_count <= CDNS_I2C_FIFO_DEPTH)) cdns_i2c_clear_bus_hold(id); + /* Set the slave address in address register - triggers operation */ + cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET); + cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK, + CDNS_I2C_ADDR_OFFSET); } /**