From patchwork Tue Apr 16 03:42:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 2447441 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 05397DF2E5 for ; Tue, 16 Apr 2013 03:44:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1URwoP-0003ll-64; Tue, 16 Apr 2013 03:44:05 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1URwoN-0003lZ-W4 for spi-devel-general@lists.sourceforge.net; Tue, 16 Apr 2013 03:44:04 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of google.com designates 209.85.128.74 as permitted sender) client-ip=209.85.128.74; envelope-from=dianders@google.com; helo=mail-qe0-f74.google.com; Received: from mail-qe0-f74.google.com ([209.85.128.74]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1URwoM-00067b-Vo for spi-devel-general@lists.sourceforge.net; Tue, 16 Apr 2013 03:44:03 +0000 Received: by mail-qe0-f74.google.com with SMTP id b10so5160qen.1 for ; Mon, 15 Apr 2013 20:43:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=FsdJ0AxHD0mLvG3G91f0F4R846TLtAmrcZZNWd+5GV0=; b=W1v9Rayj3x2h89Ur78Yx9aigOw4Hv9dLS5ynoxkCTKlrWAj3IQguYNtlL0SJ8X1XPe esCo4UKEleQLVKkSbd60NEsV8TbI4D0V9gCJF5FyCh5xdF9ObfL9vVUrLyH0BZNSYv1V DjHqjJLI7eNZb5uBlRMaZLd7aEVxlYDxdNosC0pipyuout4hWK/eKxSmncugswEAA7Im DdwPNM9FQIyTu6nq5UmKSwSn5nLSpG4ZxRla6TUh6nkOSsaCjn2El715iRS01YnpYg46 jJHOinNzEk/cQWwoN9j0dw9wA5jDJnvnZQ3ZSwpdIPTuLSiJZbCOFzMmNg4SoYIkRUeE ucig== X-Received: by 10.236.85.5 with SMTP id t5mr268735yhe.33.1366083837407; Mon, 15 Apr 2013 20:43:57 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id s27si9764yhf.7.2013.04.15.20.43.57 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 15 Apr 2013 20:43:57 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.34]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 2046B5A4145; Mon, 15 Apr 2013 20:43:57 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id A074D80A75; Mon, 15 Apr 2013 20:43:56 -0700 (PDT) From: Doug Anderson To: Mark Brown , Grant Likely Subject: [REPOST PATCH] spi: s3c64xx: let device core setup the default pin configuration Date: Mon, 15 Apr 2013 20:42:57 -0700 Message-Id: <1366083777-9118-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1362570130-14084-1-git-send-email-thomas.abraham@linaro.org> References: <1362570130-14084-1-git-send-email-thomas.abraham@linaro.org> X-Gm-Message-State: ALoCoQmRDRxV2W4AaLTwXT8J4hd2x3zcLayh6vnNqW/KBjlq94nY+yQKMjUyPJu9mlXrjh8mKF7mTlu7IubEsE6/dWmRMqJOZpr2e04PowdjRkkIxOtNdLzwK6+ZyxfUkdB6b2cWrcKDvrYtUt1pYipLz8qBXbppOvyDqLf9Gkkzimjjp5vCOm88z/yGZFrW0Jh3jzaaTo9VhNoV7NHVow+okXWc0mUMJw== X-Spam-Score: -2.2 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1URwoM-00067b-Vo Cc: Kukjin Kim , Ben Dooks , heiko@sntech.de, linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Tomasz Figa , Doug Anderson , Rob Herring , linux-kernel@vger.kernel.org, Jaswinder Singh , linux-samsung-soc@vger.kernel.org, Thomas Abraham , Mark Brown , Rob Landley , spi-devel-general@lists.sourceforge.net, Linus Walleij , linux-arm-kernel@lists.infradead.org X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net From: Thomas Abraham 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 Signed-off-by: Doug Anderson 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 4989aeb..4ab992b 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1148,41 +1148,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; @@ -1215,15 +1180,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[]; @@ -1344,10 +1300,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; @@ -1358,13 +1311,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); @@ -1421,9 +1374,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); @@ -1446,9 +1396,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); @@ -1467,9 +1414,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; @@ -1481,9 +1425,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 */