From patchwork Fri Feb 7 04:43:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 3599531 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EBB0A9F2D6 for ; Fri, 7 Feb 2014 04:44:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 269FA20172 for ; Fri, 7 Feb 2014 04:44:27 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 11A102012F for ; Fri, 7 Feb 2014 04:44:26 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBdI8-0003Fu-LK; Fri, 07 Feb 2014 04:43:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBdI1-0003qX-AK; Fri, 07 Feb 2014 04:43:45 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBdHq-0003ot-Ip for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 04:43:35 +0000 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0L002GOZSLTNA0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 13:43:33 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id DF.62.10364.57464F25; Fri, 07 Feb 2014 13:43:33 +0900 (KST) X-AuditID: cbfee690-b7f266d00000287c-32-52f464753544 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0B.8F.29263.57464F25; Fri, 07 Feb 2014 13:43:33 +0900 (KST) Received: from chnaveen-ubuntu.sisodomain.com ([107.108.83.161]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N0L0045BZSFFFP1@mmp1.samsung.com>; Fri, 07 Feb 2014 13:43:32 +0900 (KST) From: Naveen Krishna Chatradhi To: linux-i2c@vger.kernel.org Subject: [PATCH 2/2 v4] i2c: exynos5: configure fifo_depth based on HSI2C module variant Date: Fri, 07 Feb 2014 10:13:15 +0530 Message-id: <1391748195-12490-1-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1385100851-32254-1-git-send-email-ch.naveen@samsung.com> References: <1385100851-32254-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRmVeSWpSXmKPExsWyRsSkVrc05UuQwerVsha9C66yWWx6fI3V ouPvF0aLy7vmsFnMOL+PyWLRtv/MFitPzGJ2YPfYOesuu8fmJfUefVtWMXqcPPWExePzJrkA 1igum5TUnMyy1CJ9uwSujC0zLzMWvBGr+NSymrmB8YtQFyMnh4SAiUTHxdmsELaYxIV769m6 GLk4hASWMkp8eX+OHaboyMPFzCC2kMAiRolTF5MgivqZJLa8uQpWxCZgJnFw0WowW0RAVqL1 wRqwBmaBzYwSm1stQWxhgSiJlrfrGEFsFgFVieu/DrGB2LwCrhJP3+4HuoIDaJmCxJxJNiBh TgE3iX9PJjKBhIWASq5PjIQ4Zx67xNe9hRBTBCS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zU2Bej+T/+YsdUu5LmTQ3HjsQtWR6u9jyKe5LKv0IjqXXKt4XiuG9x eilZ7XplWHJIKuvNrTONnSaPvxiyBiQ4nl73OrS4+aCzyvfe9xZdS6+fcz3toVLdHJToV/h4 fqLHWmHubStaV35yDfDs/nQ/+9zDGjeXusQpOxSlKopk5OOUWIozEg21mIuKEwEhh8Kf4wIA AA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140206_234334_862251_27C6AB63 X-CRM114-Status: GOOD ( 10.22 ) X-Spam-Score: -7.4 (-------) Cc: linux-samsung-soc@vger.kernel.org, wsa@the-dreams.de, linux-kernel@vger.kernel.org, kgene.kim@samsung.com, naveenkrishna.ch@gmail.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 fifo_depth of the HSI2C is not constant Exynos5420 and Exynos5250 supports fifo_depth of 64bytes Exynos5260 supports fifo_depth of 16bytes. This patch configures the fifo_depth based on HSI2C modules version. Signed-off-by: Naveen Krishna Chatradhi [For finding out the difference and initial contribution] Signed-off-by: Pankaj Dubey --- changes since v3: use variant struct to handle the fifo depths drivers/i2c/busses/i2c-exynos5.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 12730d1..5c875c0 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -76,12 +76,6 @@ #define HSI2C_RXFIFO_TRIGGER_LEVEL(x) ((x) << 4) #define HSI2C_TXFIFO_TRIGGER_LEVEL(x) ((x) << 16) -/* As per user manual FIFO max depth is 64bytes */ -#define HSI2C_FIFO_MAX 0x40 -/* default trigger levels for Tx and Rx FIFOs */ -#define HSI2C_DEF_TXFIFO_LVL (HSI2C_FIFO_MAX - 0x30) -#define HSI2C_DEF_RXFIFO_LVL (HSI2C_FIFO_MAX - 0x10) - /* I2C_TRAILING_CTL Register bits */ #define HSI2C_TRAILING_COUNT (0xf) @@ -455,7 +449,7 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) fifo_status = readl(i2c->regs + HSI2C_FIFO_STATUS); fifo_level = HSI2C_TX_FIFO_LVL(fifo_status); - len = HSI2C_FIFO_MAX - fifo_level; + len = i2c->variant->fifo_depth - fifo_level; if (len > (i2c->msg->len - i2c->msg_ptr)) len = i2c->msg->len - i2c->msg_ptr; @@ -523,6 +517,7 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) u32 i2c_auto_conf = 0; u32 fifo_ctl; unsigned long flags; + unsigned short trig_lvl; i2c_ctl = readl(i2c->regs + HSI2C_CTL); i2c_ctl &= ~(HSI2C_TXCHON | HSI2C_RXCHON); @@ -533,13 +528,19 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) i2c_auto_conf = HSI2C_READ_WRITE; - fifo_ctl |= HSI2C_RXFIFO_TRIGGER_LEVEL(HSI2C_DEF_TXFIFO_LVL); + trig_lvl = (i2c->msg->len > i2c->variant->fifo_depth) ? + (i2c->variant->fifo_depth * 3/4) : i2c->msg->len; + fifo_ctl |= HSI2C_RXFIFO_TRIGGER_LEVEL(trig_lvl); + int_en |= (HSI2C_INT_RX_ALMOSTFULL_EN | HSI2C_INT_TRAILING_EN); } else { i2c_ctl |= HSI2C_TXCHON; - fifo_ctl |= HSI2C_TXFIFO_TRIGGER_LEVEL(HSI2C_DEF_RXFIFO_LVL); + trig_lvl = (i2c->msg->len > i2c->variant->fifo_depth) ? + (i2c->variant->fifo_depth * 1/4) : i2c->msg->len; + fifo_ctl |= HSI2C_TXFIFO_TRIGGER_LEVEL(trig_lvl); + int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN; } @@ -731,6 +732,8 @@ static int exynos5_i2c_probe(struct platform_device *pdev) if (ret) goto err_clk; + i2c->variant = exynos5_i2c_get_variant(pdev); + exynos5_i2c_reset(i2c); ret = i2c_add_adapter(&i2c->adap);