From patchwork Fri Feb 7 04:42:51 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: 3599511 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 195FCBF418 for ; Fri, 7 Feb 2014 04:43:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 388AB20181 for ; Fri, 7 Feb 2014 04:43:45 +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 2DFA920172 for ; Fri, 7 Feb 2014 04:43:44 +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 1WBdHv-0003BH-33; Fri, 07 Feb 2014 04:43:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBdHs-0003pu-Jv; Fri, 07 Feb 2014 04:43:36 +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 1WBdHo-0003ot-DZ for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 04:43:34 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0L009QHZRV8H40@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 13:43:07 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 38.AA.14803.B5464F25; Fri, 07 Feb 2014 13:43:07 +0900 (KST) X-AuditID: cbfee691-b7efc6d0000039d3-77-52f4645bffb1 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C5.BB.28157.B5464F25; Fri, 07 Feb 2014 13:43:07 +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 <0N0L00L04ZRRQQ20@mmp1.samsung.com>; Fri, 07 Feb 2014 13:43:07 +0900 (KST) From: Naveen Krishna Chatradhi To: linux-i2c@vger.kernel.org Subject: [PATCH 1/2 v4] i2c: exynos5: add support for HSI2C on Exynos5260 SoC Date: Fri, 07 Feb 2014 10:12:51 +0530 Message-id: <1391748171-12451-1-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1385100726-32165-1-git-send-email-ch.naveen@samsung.com> References: <1385100726-32165-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsWyRsSkTjc65UuQwe3rBha9C66yWWx6fI3V ouPvF0aLy7vmsFnMOL+PyWLRtv/MFitPzGJ2YPfYOesuu8fmJfUefVtWMXqcPPWExePzJrkA 1igum5TUnMyy1CJ9uwSujKULpjEXXJGr6NnTx9jA2C7ZxcjJISFgIrFtwzsmCFtM4sK99Wxd jFwcQgJLGSW+POpngSl6/Oo2WJGQwCJGiQ1PoYr6mSR2XfzBBpJgEzCTOLhoNTuILSIgK9H6 YA0ziM0ssJlRYnOrJYgtLOArsfj9J6B6Dg4WAVWJzl3aIGFeAVeJ8+87WEDCEgIKEnMm2YCE OQXcJK5enMYOsdZVomX1GSaQt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rZyfpwocunJ4ruyVALF/iTZKi8RPz9u3b6bDxa2mj28bfI2+L7xjfXXZyVbV +6v3zFM8ZFA5n6PvK79E795naaX5V7y2um/8Ub+9PMX35uRbi4IsXqbJ3w6apaUXo+J2L9lV 6K+qke+Pv9uO5D9+VR2sWjP30cYDboLJXUfc+PbkLjZruXVRiaU4I9FQi7moOBEAfRBH2OMC AAA= 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_234332_683245_F7755106 X-CRM114-Status: GOOD ( 15.36 ) 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 This patch adds a new compatible and uses variant struct to support HSI2C module on Exynos5260. Updates the Documentation dt bindings. Also resets the module as an init sequence (Needed by Exynos5260). Signed-off-by: Naveen Krishna Chatradhi --- Changes since v3: 1. split patches as (v1 version does) add exynso5260 suppport and handle fifo depths 2. keep the old - compatible = "samsung,exynos5-hsi2c"; mark it as (DEPRECATED) .../devicetree/bindings/i2c/i2c-exynos5.txt | 11 ++++- drivers/i2c/busses/i2c-exynos5.c | 46 ++++++++++++++++++-- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt b/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt index 056732c..d4745e3 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt @@ -5,7 +5,14 @@ at various speeds ranging from 100khz to 3.4Mhz. Required properties: - compatible: value should be. - -> "samsung,exynos5-hsi2c", for i2c compatible with exynos5 hsi2c. + -> "samsung,exynos5-hsi2c", (DEPRECATED) + for i2c compatible with HSI2C available + on Exynos5250 and Exynos5420 SoCs. + -> "samsung,exynos5250-hsi2c", for i2c compatible with HSI2C available + on Exynos5250 and Exynos5420 SoCs. + -> "samsung,exynos5260-hsi2c", for i2c compatible with HSI2C available + on Exynos5260 SoCs. + - reg: physical base address of the controller and length of memory mapped region. - interrupts: interrupt number to the cpu. @@ -26,7 +33,7 @@ Optional properties: Example: hsi2c@12ca0000 { - compatible = "samsung,exynos5-hsi2c"; + compatible = "samsung,exynos5250-hsi2c"; reg = <0x12ca0000 0x100>; interrupts = <56>; clock-frequency = <100000>; diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 9fd711c..12730d1 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -183,14 +183,54 @@ struct exynos5_i2c { * 2. Fast speed upto 1Mbps */ int speed_mode; + + /* Version of HS-I2C Hardware */ + struct exynos_hsi2c_variant *variant; +}; + +/** + * struct exynos_hsi2c_variant - platform specific HSI2C driver data + * @fifo_depth: the fifo depth supported by the HSI2C module + * + * Specifies platform specific configuration of HSI2C module. + * Note: A structure for driver specific platform data is used for future + * expansion of its usage. + */ +struct exynos_hsi2c_variant { + unsigned int fifo_depth; +}; + +static const struct exynos_hsi2c_variant exynos5250_hsi2c_data = { + .fifo_depth = 64, +}; + +static const struct exynos_hsi2c_variant exynos5260_hsi2c_data = { + .fifo_depth = 16, }; static const struct of_device_id exynos5_i2c_match[] = { - { .compatible = "samsung,exynos5-hsi2c" }, - {}, + { + .compatible = "samsung,exynos5-hsi2c" + .data = &exynos5250_hsi2c_data + }, { + .compatible = "samsung,exynos5250-hsi2c", + .data = &exynos5250_hsi2c_data + }, { + .compatible = "samsung,exynos5260-hsi2c", + .data = &exynos5260_hsi2c_data + }, {}, }; MODULE_DEVICE_TABLE(of, exynos5_i2c_match); +static inline struct exynos_hsi2c_variant *exynos5_i2c_get_variant + (struct platform_device *pdev) +{ + const struct of_device_id *match; + + match = of_match_node(exynos5_i2c_match, pdev->dev.of_node); + return (struct exynos_hsi2c_variant *)match->data; +} + static void exynos5_i2c_clr_pend_irq(struct exynos5_i2c *i2c) { writel(readl(i2c->regs + HSI2C_INT_STATUS), @@ -691,7 +731,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev) if (ret) goto err_clk; - exynos5_i2c_init(i2c); + exynos5_i2c_reset(i2c); ret = i2c_add_adapter(&i2c->adap); if (ret < 0) {