From patchwork Tue Jul 2 16:01:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 256459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8552B2C00A0 for ; Wed, 3 Jul 2013 02:01:32 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752592Ab3GBQBb (ORCPT ); Tue, 2 Jul 2013 12:01:31 -0400 Received: from mail-db8lp0184.outbound.messaging.microsoft.com ([213.199.154.184]:58594 "EHLO db8outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752430Ab3GBQBa (ORCPT ); Tue, 2 Jul 2013 12:01:30 -0400 Received: from mail104-db8-R.bigfish.com (10.174.8.239) by DB8EHSOBE021.bigfish.com (10.174.4.84) with Microsoft SMTP Server id 14.1.225.23; Tue, 2 Jul 2013 16:01:28 +0000 Received: from mail104-db8 (localhost [127.0.0.1]) by mail104-db8-R.bigfish.com (Postfix) with ESMTP id E0139EC0053; Tue, 2 Jul 2013 16:01:28 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -3 X-BigFish: VS-3(zz13e6Kzz1f42h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1155h) Received: from mail104-db8 (localhost.localdomain [127.0.0.1]) by mail104-db8 (MessageSwitch) id 1372780886814615_23344; Tue, 2 Jul 2013 16:01:26 +0000 (UTC) Received: from DB8EHSMHS004.bigfish.com (unknown [10.174.8.247]) by mail104-db8.bigfish.com (Postfix) with ESMTP id BB498C4006A; Tue, 2 Jul 2013 16:01:26 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB8EHSMHS004.bigfish.com (10.174.4.14) with Microsoft SMTP Server (TLS) id 14.16.227.3; Tue, 2 Jul 2013 16:01:25 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Tue, 2 Jul 2013 16:01:23 +0000 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.244.102]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r62G1D7U019814; Tue, 2 Jul 2013 09:01:14 -0700 From: Fabio Estevam To: CC: , , , , , , Fabio Estevam Subject: [PATCH] i2c: i2c_mxs: Set ACK_MODE bit Date: Tue, 2 Jul 2013 13:01:00 -0300 Message-ID: <1372780860-12972-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.8.1.2 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org According to mx23 erratum 2727: "2727 : I2C 9th Clock Pulse (ACK) not generated when RETAIN_CLOCK set. Description: When RETAIN_CLOCK is set, the ninth clock pulse (ACK) is not generated. However, the SDA line is read at the proper timing interval. If RETAIN_CLOCK is cleared, the ninth clock pulse is generated. Also, the HW_I2C_VERSION register incorrectly states the version is 1.2. It should be 1.3. Workaround: HW_I2C_CTRL1[ACK_MODE] has default value of 0. It should be set to 1 to enable the fix for this issue." It has also been noticed that mx28 needs to implement this fix in order to have SMBus to work properly. Reported-by: Christoph Baumann Signed-off-by: Fabio Estevam --- drivers/i2c/busses/i2c-mxs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 6d8094d..ce7ac86 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -56,6 +56,7 @@ #define MXS_I2C_CTRL1_CLR (0x48) #define MXS_I2C_CTRL1_CLR_GOT_A_NAK 0x10000000 +#define MXS_I2C_CTRL1_ACK_MODE 0x08000000 #define MXS_I2C_CTRL1_BUS_FREE_IRQ 0x80 #define MXS_I2C_CTRL1_DATA_ENGINE_CMPLT_IRQ 0x40 #define MXS_I2C_CTRL1_NO_SLAVE_ACK_IRQ 0x20 @@ -140,6 +141,14 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c) writel(0x00300030, i2c->regs + MXS_I2C_TIMING2); writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); + + /* + * According to mx23 erratum 2727: + * "I2C 9th Clock Pulse (ACK) not generated when RETAIN_CLOCK set" + * + * HW_I2C_CTRL1[ACK_MODE] needs to be set when RETAIN_CLOCK is set. + */ + writel(MXS_I2C_CTRL1_ACK_MODE, i2c->regs + MXS_I2C_CTRL1_SET); } static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c)