From patchwork Mon Mar 4 13:42:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 2212761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 39F3D4006E for ; Mon, 4 Mar 2013 13:27:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UCVNS-000655-Bw; Mon, 04 Mar 2013 13:24:26 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UCVN5-00063q-9q for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2013 13:24:04 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ500KXX12EUSI0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2013 22:21:42 +0900 (KST) X-AuditID: cbfee61b-b7fb06d000000f28-aa-51349fe6f1ba Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AC.2E.03880.6EF94315; Mon, 04 Mar 2013 22:21:42 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJ500JLX12H0P60@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2013 22:21:42 +0900 (KST) From: Thomas Abraham To: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] i2c: s3c24xx: allow device core to setup default pin configuration Date: Mon, 04 Mar 2013 19:12:53 +0530 Message-id: <1362404573-30406-1-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFJMWRmVeSWpSXmKPExsVy+t9jAd1n800CDW5dN7DY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZx6bmFBxWqFi94idbA+MWqS5GTg4JAROJ+bOamCFsMYkL99az dTFycQgJLGKU2NX4jBHCWc8ksbhvDiNIFZuAgcSjhe/YQWwRAWeJ87u3gBUxCyxnlJi4dBEL SEJYIFRi1bKFTCA2i4CqxJzGt2A2r4CnxLSJB5kg1ilJbOg9yjSBkXsBI8MqRtHUguSC4qT0 XCO94sTc4tK8dL3k/NxNjGAfPpPewbiqweIQowAHoxIPr8An40Ah1sSy4srcQ4wSHMxKIrzW c00ChXhTEiurUovy44tKc1KLDzFKc7AoifMynnoSICSQnliSmp2aWpBaBJNl4uCUamDk0bCV ZCjZ1vKyUWT5sjzB9QmMP1RbvxbIz5nYqu5X1RLvrZPSVqOnnaevOrd1V+zagymL3Qrf24vc 1tI+9kFrrsTlsIeHNVyDnv6NX63n/Ov6ZqEc3fKos3G6EefdfkdwsmocmL5GRelqR/XKnp2r Eqf+q3t29826yUsnpE9/I+d3PiyMy16JpTgj0VCLuag4EQDvMMjk3QEAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130304_082403_589347_DE8CF081 X-CRM114-Status: GOOD ( 17.75 ) X-Spam-Score: -6.8 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 HDRS_LCASE Odd capitalization of message header Cc: kgene.kim@samsung.com, heiko@sntech.de, wsa@the-dreams.de, t.figa@samsung.com, linux-samsung-soc@vger.kernel.org, ben-linux@fluff.org, linus.walleij@linaro.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 With device core now able to setup the default pin configuration, the call to devm_pinctrl_get_select_default can be removed. And the pin configuration code based on the deprecated Samsung specific gpio bindings is also removed. Signed-off-by: Thomas Abraham Acked-by: Heiko Stuebner Acked-by: Linus Walleij --- Hi Heiko, Tomasz, We have to make a choice on the path forward for pinctrl support on Samsung platforms. We have three cases to deal with. A. Samsung platforms without DT support. B. Samsung platforms with DT support using old Samsung specific gpio bindings for pin-configuration (s3c24xx and s3x64xx). C. Samsung platforms with DT support using using pinctrl based pin-configurations (Exynos4 and Exynos5). For [A], we just let the platform specific callbacks handle the pin setup. For [B] and [C], based on Linus Walleij's pin grab by device core patch and subsequent discussions with him on the mailing list, would it be acceptable that we discontinue support for [B] in Samsung SoC device drivers. This will impact your current DT work on s3c24xx and s3c64xx platforms. Pinctrl is inevitable and we have to migrate to it. Instead of workarounds to maintain support for [B], it might be better that we migrate s3c24xx and s3c64xx platforms to pinctrl. Please do let us know your opinion on this. Thanks, Thomas. drivers/i2c/busses/i2c-s3c2410.c | 67 +------------------------------------- 1 files changed, 1 insertions(+), 66 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index f6b880b..703272c 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -37,8 +37,6 @@ #include #include #include -#include -#include #include @@ -84,8 +82,6 @@ struct s3c24xx_i2c { struct i2c_adapter adap; struct s3c2410_platform_i2c *pdata; - int gpios[2]; - struct pinctrl *pctrl; #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; #endif @@ -856,57 +852,6 @@ static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c) } #endif -#ifdef CONFIG_OF -static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c) -{ - int idx, gpio, ret; - - if (i2c->quirks & QUIRK_NO_GPIO) - return 0; - - for (idx = 0; idx < 2; idx++) { - gpio = of_get_gpio(i2c->dev->of_node, idx); - if (!gpio_is_valid(gpio)) { - dev_err(i2c->dev, "invalid gpio[%d]: %d\n", idx, gpio); - goto free_gpio; - } - i2c->gpios[idx] = gpio; - - ret = gpio_request(gpio, "i2c-bus"); - if (ret) { - dev_err(i2c->dev, "gpio [%d] request failed\n", gpio); - goto free_gpio; - } - } - return 0; - -free_gpio: - while (--idx >= 0) - gpio_free(i2c->gpios[idx]); - return -EINVAL; -} - -static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) -{ - unsigned int idx; - - if (i2c->quirks & QUIRK_NO_GPIO) - return; - - for (idx = 0; idx < 2; idx++) - gpio_free(i2c->gpios[idx]); -} -#else -static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c) -{ - return 0; -} - -static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) -{ -} -#endif - /* s3c24xx_i2c_init * * initialise the controller, set the IO lines and frequency @@ -1054,15 +999,9 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) i2c->adap.algo_data = i2c; i2c->adap.dev.parent = &pdev->dev; - i2c->pctrl = devm_pinctrl_get_select_default(i2c->dev); - /* inititalise the i2c gpio lines */ - - if (i2c->pdata->cfg_gpio) { + if (i2c->pdata->cfg_gpio) i2c->pdata->cfg_gpio(to_platform_device(i2c->dev)); - } else if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c)) { - return -EINVAL; - } /* initialise the i2c controller */ @@ -1140,10 +1079,6 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&i2c->adap); clk_disable_unprepare(i2c->clk); - - if (pdev->dev.of_node && IS_ERR(i2c->pctrl)) - s3c24xx_i2c_dt_gpio_free(i2c); - return 0; }