From patchwork Wed Mar 6 11:42:10 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: 15258 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 5D5C023E67 for ; Wed, 6 Mar 2013 11:20:19 +0000 (UTC) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by fiordland.canonical.com (Postfix) with ESMTP id E55C4A183D1 for ; Wed, 6 Mar 2013 11:20:18 +0000 (UTC) Received: by mail-vb0-f46.google.com with SMTP id b13so1609451vby.19 for ; Wed, 06 Mar 2013 03:20:18 -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=Yp64u4Z8pEl6qgm8nDGohunvAbGz0Tanv3K7vnVhzwk=; b=lzTgJyTyMYBaaovrMPpj5Qw4pF26+6panyB2kKIWC5FCAKS6ku4cry7FnxXO7NGpLA xesdm8MQRCA5ErQNYKbLDkFbHXxXMFDYxD5Nqqughi3hvP9aDr8VMLQThW6A1qgdtLpC T48HDe3Q092uPiG1BONZBj8lV2/vnr+MRQJ38pHKXGS2dgTb26xGNC+rPsycMW9V1g6v CENJjSosQQ5X4ehMrK3oHwhCQGKts9T0orrTIs0rU6DeSRrYGTYyLgzaM3jbSnLcIgRv tuBDHRZYfOXFtzTbrAElSX9QGgzCah0MCwmy3EI6Cw7R8GM0AUIXKkWJHA5dNYVUBB5v 0vvA== X-Received: by 10.52.93.235 with SMTP id cx11mr9463830vdb.51.1362568818365; Wed, 06 Mar 2013 03:20:18 -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 nf2csp9479veb; Wed, 6 Mar 2013 03:20:17 -0800 (PST) X-Received: by 10.68.24.133 with SMTP id u5mr45204482pbf.144.1362568817053; Wed, 06 Mar 2013 03:20:17 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id pl3si26084383pbc.48.2013.03.06.03.20.16; Wed, 06 Mar 2013 03:20:16 -0800 (PST) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 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 mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ800AG9KQQ6ON0@mailout1.samsung.com>; Wed, 06 Mar 2013 20:20:15 +0900 (KST) X-AuditID: cbfee61b-b7fb06d000000f28-b9-5137266fc2f7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A6.BA.03880.F6627315; Wed, 06 Mar 2013 20:20:15 +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 <0MJ8008Y1KTK6340@mmp1.samsung.com>; Wed, 06 Mar 2013 20:20:15 +0900 (KST) From: Thomas Abraham To: spi-devel-general@lists.sourceforge.net Cc: linux-arm-kernel@lists.infradead.org, grant.likely@secretlab.ca, linus.walleij@linaro.org, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, t.figa@samsung.com, heiko@sntech.de, jaswinder.singh@linaro.org, patches@linaro.org Subject: [PATCH] spi: s3c64xx: let device core setup the default pin configuration Date: Wed, 06 Mar 2013 17:12:10 +0530 Message-id: <1362570130-14084-1-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMJMWRmVeSWpSXmKPExsVy+t9jAd18NfNAg/V/BC0mb7rPaDHlz3Im iymHv7A4MHvcubaHLYAxissmJTUnsyy1SN8ugStj3Q7pgofqFT27L7A1MK5U6GLk4JAQMJG4 tqC0i5ETyBSTuHBvPVsXIxeHkMAiRomuhyuYIJw2Joltvb3MIFVsAgYSjxa+YwexRQS0JTa+ 28UMUsQs8IlRouPkfRaQqcICIRJrN9uA1LAIqEpcutDPCmLzCnhKHHy2gg1im5LEht6jTBMY uRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECPbqM+kdjKsaLA4xCnAwKvHwTlAxCxRi TSwrrsw9xCjBwawkwrtV2jxQiDclsbIqtSg/vqg0J7X4EKM0B4uSOC/jqScBQgLpiSWp2amp BalFMFkmDk6pBsaIPfXBbHYbp2avaIoznrp/yp6KfWbqixesn9EWKxHHcrn+q6PCjOID1Xyv /gqvX+mSuzSGJd0jSqlK7LDKo13uZ/mWTpTKak5ldD61emlKr4tzkZs438aHFv7X74s+nrKO 7fm5yK3Zir7OCilF3R9WF237Xlr8SSHtvtHDjsZgW8GYj2qcGUosxRmJhlrMRcWJALbjqOvm AQAA X-Gm-Message-State: ALoCoQmS7GHJ/hmDWkjmuQ70FeslTLTWvSZHENzWSnpKClV/pUF0N5BuLERCCSdKSJyvhwFBapjk With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed. Signed-off-by: Thomas Abraham Acked-by: Linus Walleij Reviewed-by: Doug Anderson Tested-by: Doug Anderson --- .../devicetree/bindings/spi/spi-samsung.txt | 8 +-- drivers/spi/spi-s3c64xx.c | 66 +------------------ 2 files changed, 6 insertions(+), 68 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index a15ffed..86aa061 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -31,9 +31,6 @@ Required Board Specific Properties: - #address-cells: should be 1. - #size-cells: should be 0. -- gpios: The gpio specifier for clock, mosi and miso interface lines (in the - order specified). The format of the gpio specifier depends on the gpio - controller. Optional Board Specific Properties: @@ -86,9 +83,8 @@ Example: spi_0: spi@12d20000 { #address-cells = <1>; #size-cells = <0>; - gpios = <&gpa2 4 2 3 0>, - <&gpa2 6 2 3 0>, - <&gpa2 7 2 3 0>; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_bus>; w25q80bw@0 { #address-cells = <1>; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index e862ab8..8537b17 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1052,41 +1052,6 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel) } #ifdef CONFIG_OF -static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd) -{ - struct device *dev = &sdd->pdev->dev; - int idx, gpio, ret; - - /* find gpios for mosi, miso and clock lines */ - for (idx = 0; idx < 3; idx++) { - gpio = of_get_gpio(dev->of_node, idx); - if (!gpio_is_valid(gpio)) { - dev_err(dev, "invalid gpio[%d]: %d\n", idx, gpio); - goto free_gpio; - } - sdd->gpios[idx] = gpio; - ret = gpio_request(gpio, "spi-bus"); - if (ret) { - dev_err(dev, "gpio [%d] request failed: %d\n", - gpio, ret); - goto free_gpio; - } - } - return 0; - -free_gpio: - while (--idx >= 0) - gpio_free(sdd->gpios[idx]); - return -EINVAL; -} - -static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd) -{ - unsigned int idx; - for (idx = 0; idx < 3; idx++) - gpio_free(sdd->gpios[idx]); -} - static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) { struct s3c64xx_spi_info *sci; @@ -1119,15 +1084,6 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) { return dev->platform_data; } - -static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd) -{ - return -EINVAL; -} - -static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd) -{ -} #endif static const struct of_device_id s3c64xx_spi_dt_match[]; @@ -1247,10 +1203,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) goto err0; } - if (!sci->cfg_gpio && pdev->dev.of_node) { - if (s3c64xx_spi_parse_dt_gpio(sdd)) - return -EBUSY; - } else if (sci->cfg_gpio == NULL || sci->cfg_gpio()) { + if (sci->cfg_gpio && sci->cfg_gpio()) { dev_err(&pdev->dev, "Unable to config gpio\n"); ret = -EBUSY; goto err0; @@ -1261,13 +1214,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) if (IS_ERR(sdd->clk)) { dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n"); ret = PTR_ERR(sdd->clk); - goto err1; + goto err0; } if (clk_prepare_enable(sdd->clk)) { dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n"); ret = -EBUSY; - goto err1; + goto err0; } sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr); @@ -1324,9 +1277,6 @@ err3: clk_disable_unprepare(sdd->src_clk); err2: clk_disable_unprepare(sdd->clk); -err1: - if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) - s3c64xx_spi_dt_gpio_free(sdd); err0: platform_set_drvdata(pdev, NULL); spi_master_put(master); @@ -1349,9 +1299,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) clk_disable_unprepare(sdd->clk); - if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) - s3c64xx_spi_dt_gpio_free(sdd); - platform_set_drvdata(pdev, NULL); spi_master_put(master); @@ -1370,9 +1317,6 @@ static int s3c64xx_spi_suspend(struct device *dev) clk_disable_unprepare(sdd->src_clk); clk_disable_unprepare(sdd->clk); - if (!sdd->cntrlr_info->cfg_gpio && dev->of_node) - s3c64xx_spi_dt_gpio_free(sdd); - sdd->cur_speed = 0; /* Output Clock is stopped */ return 0; @@ -1384,9 +1328,7 @@ static int s3c64xx_spi_resume(struct device *dev) struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_info *sci = sdd->cntrlr_info; - if (!sci->cfg_gpio && dev->of_node) - s3c64xx_spi_parse_dt_gpio(sdd); - else + if (sci->cfg_gpio) sci->cfg_gpio(); /* Enable the clock */