From patchwork Wed Dec 3 12:35:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 5430411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9AF6ABEEA8 for ; Wed, 3 Dec 2014 12:38:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6DA520266 for ; Wed, 3 Dec 2014 12:38:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EACD3201ED for ; Wed, 3 Dec 2014 12:38:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xw9At-0001Rj-DX; Wed, 03 Dec 2014 12:36:55 +0000 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xw9Aj-00019S-RH for linux-arm-kernel@lists.infradead.org; Wed, 03 Dec 2014 12:36:46 +0000 Received: by mail-qc0-f169.google.com with SMTP id w7so11001904qcr.28 for ; Wed, 03 Dec 2014 04:36:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=PJhaPZWlicsDxchsWV8j0Hk34O1yLQDlIPIuZYxcVpI=; b=GgV9ctSv3KaPAyEPsH5m0JWsre5Bjej6w3otNFx5yCoYRqEqk0vbNDy5zpygv4wS0/ FrXTq9qaIloIdfyJpQ9F/PdaaCtykXq8+nMJUdFKDc6QHYt0PsaH0e86bfSXYyLLo+em 1TdIC3bpAJgGEawLc6DlcsAAz2wieS6/p11teAigNMmOhvb6SzJ4AUoxUOi3bVWue74/ TLjZIK0N4drE3vFvCey37lmiVkJ3f3WDSGC4CrO3v70Q2DivInrlqG8o1rPVswr4HO2l nWlRjX47KfcIkGkW9qfo0ez79qGrZ82O4tg+o7uahN2gRFRIJnHXax0W1sunRULYKfZN V9wA== X-Received: by 10.224.79.136 with SMTP id p8mr7871355qak.70.1417610183558; Wed, 03 Dec 2014 04:36:23 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id d9sm23302408qam.26.2014.12.03.04.36.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 04:36:22 -0800 (PST) From: Harini Katakam To: wsa@the-dreams.de, mark.rutland@arm.com Subject: [PATCH v2 3/3] i2c: cadence: Check for errata condition involving master receive Date: Wed, 3 Dec 2014 18:05:26 +0530 Message-Id: <1417610126-7957-4-git-send-email-harinik@xilinx.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417610126-7957-1-git-send-email-harinik@xilinx.com> References: <1417610126-7957-1-git-send-email-harinik@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141203_043645_994790_C4D536FC X-CRM114-Status: GOOD ( 13.68 ) X-Spam-Score: -0.7 (/) Cc: harinik@xilinx.com, vishnum@xilinx.com, linux-kernel@vger.kernel.org, harinikatakamlinux@gmail.com, michal.simek@xilinx.com, soren.brinkmann@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cadence I2C controller has the following bugs: - completion indication is not given to the driver at the end of a read/receive transfer with HOLD bit set. - Invalid read transaction are generated on the bus when HW timeout condition occurs with HOLD bit set. As a result of the above, if a set of messages to be transferred with repeated start includes any transfer following a read transfer, completion is never indicated and timeout occurs. Hence a check is implemented to return -EOPNOTSUPP for such sequences. Signed-off-by: Harini Katakam Signed-off-by: Vishnu Motghare --- v2: Dont defeteature repeated start. Just check for unsupported conditions in the driver and return error. --- drivers/i2c/busses/i2c-cadence.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 67077c2..f5437e2 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -522,6 +522,17 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, * processed with a repeated start. */ if (num > 1) { + /* + * This controller does not give completion interrupt after a + * master receive transfer if HOLD bit is set (repeated start), + * resulting in SW timeout. Hence, if a receive transfer is + * followed by any other transfer, an error is returned + * indicating that this sequence is not supported. + */ + for (count = 0; count < num-1; count++) { + if (msgs[count].flags & I2C_M_RD) + return -EOPNOTSUPP; + } id->bus_hold_flag = 1; reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET); reg |= CDNS_I2C_CR_HOLD;