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: 224721 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 E75932C02A2 for ; Tue, 5 Mar 2013 00:21:45 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756823Ab3CDNVo (ORCPT ); Mon, 4 Mar 2013 08:21:44 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:17896 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756816Ab3CDNVo (ORCPT ); Mon, 4 Mar 2013 08:21:44 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ5006FI13LHYP0@mailout3.samsung.com>; Mon, 04 Mar 2013 22:21:42 +0900 (KST) X-AuditID: cbfee61a-b7f7d6d000000f4e-54-51349fe6c478 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 62.E5.03918.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>; Mon, 04 Mar 2013 22:21:42 +0900 (KST) From: Thomas Abraham To: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org, linus.walleij@linaro.org, kgene.kim@samsung.com, ben-linux@fluff.org, heiko@sntech.de, t.figa@samsung.com, wsa@the-dreams.de 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+NgFjrHJMWRmVeSWpSXmKPExsVy+t9jAd1n800CDf72GFt0/P3CaDHj/D4m ByaPz5vkAhijuGxSUnMyy1KL9O0SuDKOTc0pOKxQsXrFT7YGxi1SXYycHBICJhIPZ5xhhrDF JC7cW88GYgsJLGKU2H6bp4uRC8huY5KY+2k3WIJNwEDi0cJ37CC2iICzxPndWxhBipgFljNK TFy6iAUkISwQKrFq2UImEJtFQFViTuNbMJtXwFNi2sSDTBDblCQ29B5lmsDIvYCRYRWjaGpB ckFxUnquoV5xYm5xaV66XnJ+7iZGsC+fSe1gXNlgcYhRgINRiYdX4JNxoBBrYllxZe4hRgkO ZiURXuu5JoFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeRlPPQkQEkhPLEnNTk0tSC2CyTJxcEo1 MDYWymafaufhu/olQmBiNy/3ue8e7j2TWo8YNoaUuwvfeBqnfb40Z9eOOZXvNOvyyp2+WOcd eLTeJCWkW2//s/ZI3uRLtub+dfMenPNTbtFfFc4ll+RszXrJM1Na7bynis6NmccZK5nz/ioG p77V+L9owoOGRz3THe55PI/mlFs5KSklxWqzEktxRqKhFnNRcSIAElpOneEBAAA= Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.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; }