From patchwork Wed Mar 6 11:36:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 15257 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A420B23E2E for ; Wed, 6 Mar 2013 11:14:29 +0000 (UTC) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by fiordland.canonical.com (Postfix) with ESMTP id 4041DA18782 for ; Wed, 6 Mar 2013 11:14:29 +0000 (UTC) Received: by mail-vc0-f181.google.com with SMTP id f13so4675116vcb.26 for ; Wed, 06 Mar 2013 03:14:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :x-brightmail-tracker:x-gm-message-state; bh=4S8nVDW6gGMhKNyDQIEIiNQnM/gODhK0FBbu8LoxdyA=; b=o8PnZEJijYBYGP5oqvLw+MWgHCW7u2828NXM7Fz4ycBy+AffBgh/6q41urtmr02WZl OesdZQXJ5qTptEFTrWqgXy98THWdHIM8OBgO8WWNVux2zD5Va1oCqZYaStWjR6wWRA6H BAf08S2yZeEf+fMDagpqTLvcHRC1CAXA9xp4y7irZP0dPrxAKtMDsB8HEGCNc1ef/m4j tP7cbNDVy5rXUiU8RemeHQx2XOjEcXzbgHLlm7D3Qrn2ISqOFsg50/sTaVRBervXwaXl eZrxF6+DDx70TX+dAKUnRoEyPHoKTgw6/dHZxmsKDbx0IWr9UcUKhPalmbDr6X5EAd4N JN0w== X-Received: by 10.52.93.235 with SMTP id cx11mr9458141vdb.51.1362568468705; Wed, 06 Mar 2013 03:14:28 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp9178veb; Wed, 6 Mar 2013 03:14:27 -0800 (PST) X-Received: by 10.68.0.170 with SMTP id 10mr45617964pbf.59.1362568467073; Wed, 06 Mar 2013 03:14:27 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id qf10si32798656pbc.278.2013.03.06.03.14.25; Wed, 06 Mar 2013 03:14:26 -0800 (PST) Received-SPF: neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ800EX6KD8OTU0@mailout2.samsung.com>; Wed, 06 Mar 2013 20:14:24 +0900 (KST) X-AuditID: cbfee61b-b7fb06d000000f28-98-51372510ddf4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F2.89.03880.01527315; Wed, 06 Mar 2013 20:14:24 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJ800IMCKJRWS80@mmp2.samsung.com>; Wed, 06 Mar 2013 20:14:24 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, cjb@laptop.org, linus.walleij@linaro.org, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, t.figa@samsung.com, ben-linux@fluff.org, jh80.chung@samsung.com, tgih.jun@samsung.com, girish.shivananjappa@linaro.org, patches@linaro.org Subject: [PATCH] mmc: sdhci-s3c: let device core setup the default pin configuration Date: Wed, 06 Mar 2013 17:06:16 +0530 Message-id: <1362569776-13932-1-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFLMWRmVeSWpSXmKPExsVy+t9jQV0BVfNAg+N7NC0mrTvAZLH99UY2 iy9fT7BZ3PjVxmrRu+Aqm8WUP8uZLDY9vsZqceR/P6PFjPP7mCymHP7CYrF+xmsWiw/3LzI7 8Hj8XfWC2ePQlbWMHneu7WHz2Lyk3qNvyypGj8+b5ALYorhsUlJzMstSi/TtErgyJj99wVIw 2bLiesdc1gbGw7pdjJwcEgImEpP2bGaFsMUkLtxbz9bFyMUhJDCdUaKvo50dwmljkni+bgYz SBWbgIHEo4Xv2EFsEQFZiZ9/LoB1MAssYJJYt/0oWEJYIEziw8NWFhCbRUBVoufyNUYQm1fA U+LOtrmMEOuUJDb0HmWawMi9gJFhFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkZwiD2T3sG4 qsHiEKMAB6MSD+8EFbNAIdbEsuLK3EOMEhzMSiK8W6XNA4V4UxIrq1KL8uOLSnNSiw8xSnOw KInzMp56EiAkkJ5YkpqdmlqQWgSTZeLglGpgVDyx5IdY4FKxM17ml88u6FrQW3Nq5zodwWfp p+4uNw2T8Ra+wJE1bbVzztaj6g7L6jLYq6LUq8+8/tdv++d45bqjD9K/Cm1I3Bl6YttSscdH Gi58y50+IajqT90Cme1KSmElMZ/8k2dtU1yuPF223MZ8qfmZBZlPipXPqFw5wJom5+QrPn/K VyWW4oxEQy3mouJEANUKkvktAgAA X-Gm-Message-State: ALoCoQkoz7TSPFOwWimp33fqTr1FlCKVkJfzlv3TCEr+XDrbBd7Qv/hXMqlIMqbZWbKUSpQkFBSL 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: Linus Walleij --- .../devicetree/bindings/mmc/samsung-sdhci.txt | 35 +--------- drivers/mmc/host/sdhci-s3c.c | 71 ++----------------- 2 files changed, 12 insertions(+), 94 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt index 3b3a1ee..328e990 100644 --- a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt +++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt @@ -5,13 +5,6 @@ MMC, SD and eMMC storage mediums. This file documents differences between the core mmc properties described by mmc.txt and the properties used by the Samsung implmentation of the SDHCI controller. -Note: The mmc core bindings documentation states that if none of the core -card-detect bindings are used, then the standard sdhci card detect mechanism -is used. The Samsung's SDHCI controller bindings extends this as listed below. - -[A] The property "samsung,cd-pinmux-gpio" can be used as stated in the - "Optional Board Specific Properties" section below. - Required SoC Specific Properties: - compatible: should be one of the following - "samsung,s3c6410-sdhci": For controllers compatible with s3c6410 sdhci @@ -20,18 +13,8 @@ Required SoC Specific Properties: controller. Required Board Specific Properties: -- Samsung GPIO variant (will be completely replaced by pinctrl): - - gpios: Should specify the gpios used for clock, command and data lines. The - gpio specifier format depends on the gpio controller. -- Pinctrl variant (preferred if available): - - pinctrl-0: Should specify pin control groups used for this controller. - - pinctrl-names: Should contain only one value - "default". - -Optional Board Specific Properties: -- samsung,cd-pinmux-gpio: Specifies the card detect line that is routed - through a pinmux to the card-detect pin of the card slot. This property - should be used only if none of the mmc core card-detect properties are - used. Only for Samsung GPIO variant. +- pinctrl-0: Should specify pin control groups used for this controller. +- pinctrl-names: Should contain only one value - "default". Example: sdhci@12530000 { @@ -39,19 +22,9 @@ Example: reg = <0x12530000 0x100>; interrupts = <0 75 0>; bus-width = <4>; - cd-gpios = <&gpk2 2 2 3 3>; - - /* Samsung GPIO variant */ - gpios = <&gpk2 0 2 0 3>, /* clock line */ - <&gpk2 1 2 0 3>, /* command line */ - <&gpk2 3 2 3 3>, /* data line 0 */ - <&gpk2 4 2 3 3>, /* data line 1 */ - <&gpk2 5 2 3 3>, /* data line 2 */ - <&gpk2 6 2 3 3>; /* data line 3 */ - - /* Pinctrl variant */ - pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4>; + cd-gpios = <&gpk2 2 0>; pinctrl-names = "default"; + pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4>; }; Note: This example shows both SoC specific and board specific properties diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 7363efe..86e0bd7 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -24,7 +24,6 @@ #include #include #include -#include #include @@ -45,7 +44,6 @@ * @ioarea: The resource created when we claimed the IO area. * @pdata: The platform data for this controller. * @cur_clk: The index of the current bus clock. - * @gpios: List of gpio numbers parsed from device tree. * @clk_io: The clock for the internal bus interface. * @clk_bus: The clocks that are available for the SD/MMC bus clock. */ @@ -57,8 +55,6 @@ struct sdhci_s3c { unsigned int cur_clk; int ext_cd_irq; int ext_cd_gpio; - int *gpios; - struct pinctrl *pctrl; struct clk *clk_io; struct clk *clk_bus[MAX_BUS_CLK]; @@ -447,88 +443,39 @@ static int sdhci_s3c_parse_dt(struct device *dev, struct device_node *node = dev->of_node; struct sdhci_s3c *ourhost = to_s3c(host); u32 max_width; - int gpio, cnt, ret; + int gpio; /* if the bus-width property is not specified, assume width as 1 */ if (of_property_read_u32(node, "bus-width", &max_width)) max_width = 1; pdata->max_width = max_width; - ourhost->gpios = devm_kzalloc(dev, NUM_GPIOS(pdata->max_width) * - sizeof(int), GFP_KERNEL); - if (!ourhost->gpios) - return -ENOMEM; - /* get the card detection method */ if (of_get_property(node, "broken-cd", NULL)) { pdata->cd_type = S3C_SDHCI_CD_NONE; - goto setup_bus; + return 0; } if (of_get_property(node, "non-removable", NULL)) { pdata->cd_type = S3C_SDHCI_CD_PERMANENT; - goto setup_bus; + return 0; } gpio = of_get_named_gpio(node, "cd-gpios", 0); if (gpio_is_valid(gpio)) { pdata->cd_type = S3C_SDHCI_CD_GPIO; - goto found_cd; - } else if (gpio != -ENOENT) { - dev_err(dev, "invalid card detect gpio specified\n"); - return -EINVAL; - } - - gpio = of_get_named_gpio(node, "samsung,cd-pinmux-gpio", 0); - if (gpio_is_valid(gpio)) { - pdata->cd_type = S3C_SDHCI_CD_INTERNAL; - goto found_cd; - } else if (gpio != -ENOENT) { - dev_err(dev, "invalid card detect gpio specified\n"); - return -EINVAL; - } - - /* assuming internal card detect that will be configured by pinctrl */ - pdata->cd_type = S3C_SDHCI_CD_INTERNAL; - goto setup_bus; - - found_cd: - if (pdata->cd_type == S3C_SDHCI_CD_GPIO) { pdata->ext_cd_gpio = gpio; ourhost->ext_cd_gpio = -1; if (of_get_property(node, "cd-inverted", NULL)) pdata->ext_cd_gpio_invert = 1; - } else if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { - ret = devm_gpio_request(dev, gpio, "sdhci-cd"); - if (ret) { - dev_err(dev, "card detect gpio request failed\n"); - return -EINVAL; - } - ourhost->ext_cd_gpio = gpio; - } - - setup_bus: - if (!IS_ERR(ourhost->pctrl)) return 0; - - /* get the gpios for command, clock and data lines */ - for (cnt = 0; cnt < NUM_GPIOS(pdata->max_width); cnt++) { - gpio = of_get_gpio(node, cnt); - if (!gpio_is_valid(gpio)) { - dev_err(dev, "invalid gpio[%d]\n", cnt); - return -EINVAL; - } - ourhost->gpios[cnt] = gpio; - } - - for (cnt = 0; cnt < NUM_GPIOS(pdata->max_width); cnt++) { - ret = devm_gpio_request(dev, ourhost->gpios[cnt], "sdhci-gpio"); - if (ret) { - dev_err(dev, "gpio[%d] request failed\n", cnt); - return -EINVAL; - } + } else if (gpio != -ENOENT) { + dev_err(dev, "invalid card detect gpio specified\n"); + return -EINVAL; } + /* assuming internal card detect that will be configured by pinctrl */ + pdata->cd_type = S3C_SDHCI_CD_INTERNAL; return 0; } #else @@ -589,8 +536,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev) goto err_pdata_io_clk; } - sc->pctrl = devm_pinctrl_get_select_default(&pdev->dev); - if (pdev->dev.of_node) { ret = sdhci_s3c_parse_dt(&pdev->dev, host, pdata); if (ret)