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: 2447451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id E64903FD40 for ; Tue, 16 Apr 2013 03:44:13 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URwoN-0008DT-Ud; Tue, 16 Apr 2013 03:44:04 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1URwoL-0004Ao-Gm; Tue, 16 Apr 2013 03:44:01 +0000 Received: from mail-qe0-f74.google.com ([209.85.128.74]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URwoI-0004AV-UE for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2013 03:43:59 +0000 Received: by mail-qe0-f74.google.com with SMTP id b10so5114qen.5 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=YlkAy49VAO29kI+My06ElZJbQiKviKnTP/MF51kIFO43BnUZGz1W/s4/qHpZxa1oRO qzs+JRuzwpjmd2hO2WBjDZ6WKuMTM9A7lPxS3qoE7/o3e4g14kaAMzle1uVA4d9dMMnC /PUkAly2pxnUbrTK1dfIltnZUBKEZjBDLbVb0ddz6+92xROQyP8TPwsrBqv9Hsl/e03A w5W5ulOOqndSP7eQToEp939tZ/1RfLm+m0wYRBJ5FCdkMWFPPbQLfrOUx0qXjpaflxp/ w06jkKZIBiifgvmg9H/HEhiH9cidfT0ROBuJnNDwLEuL1iwF6AsyuHY/COcIHauqIwka DKDg== 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: ALoCoQltfvzP85luw+RyJ/4Cq0V5jDPg3AdsaX5Tx4FAWbPPCITZBFF0n28MnvqOn9WSrORtqi6G/bD+vzQw8S1/tEx3jUC5Nf+orfx2dlty7JsDeswAs4NqIaJX1TzZTqS9WaOnQfGjwODOvCgOFejji/anPG+JELYQ8iv36V5g54U9hH/S29CwBrJBs16a7n94mORo7V6OuTaW1yER9uAGvGoYXUV4Gg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130415_234359_045469_D34A5313 X-CRM114-Status: GOOD ( 15.82 ) X-Spam-Score: -3.2 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.128.74 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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: 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 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 */