From patchwork Tue Jul 15 12:20:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 4553411 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B72F9F1D6 for ; Tue, 15 Jul 2014 12:25:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24D6E2012B for ; Tue, 15 Jul 2014 12:25:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 19D3220123 for ; Tue, 15 Jul 2014 12:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758987AbaGOMZ0 (ORCPT ); Tue, 15 Jul 2014 08:25:26 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:14910 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758981AbaGOMZV (ORCPT ); Tue, 15 Jul 2014 08:25:21 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8R0042T6I74P20@mailout2.samsung.com>; Tue, 15 Jul 2014 21:25:19 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 10.CA.16580.FAD15C35; Tue, 15 Jul 2014 21:25:19 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-fe-53c51daf9365 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 62.2C.04943.FAD15C35; Tue, 15 Jul 2014 21:25:19 +0900 (KST) Received: from chnaveen-ubuntu.sisodomain.com ([107.108.83.161]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8R00LER6GLGZB0@mmp1.samsung.com>; Tue, 15 Jul 2014 21:25:19 +0900 (KST) From: Naveen Krishna Chatradhi To: linux-arm-kernel@lists.infradead.org, spi-devel-general@lists.sourceforge.net, linux-samsung-soc@vger.kernel.org Cc: naveenkrishna.ch@gmail.com, broonie@kernel.org, grant.likely@secretlab.ca, jaswinder.singh@linaro.org, kgene.kim@samsung.com, cpgs@samsung.com, devicetree@vger.kernel.org, Javier Martinez Canillas , Doug Anderson , Tomasz Figa Subject: [PATCH 1/3] spi: s3c64xx: move "cs-gpio" from subnode to SPI DT node Date: Tue, 15 Jul 2014 17:50:58 +0530 Message-id: <1405426860-18404-2-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405426860-18404-1-git-send-email-ch.naveen@samsung.com> References: <1405426860-18404-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsWyRsSkRne97NFgg64GdYupD5+wWbw8pGkx /8g5Vouzyw6yWbw6s5HNYvKm+4wWR38XWPQuuMpmsenxNVaLGef3MVks2vaf2eLIlEZ2i/Uz XrM48HrMbrjI4vH3+XUWj52z7rJ7bFrVyeZx59oeNo/NS+o9di/4zOTRt2UVo8fPlzoenzfJ BXBFcdmkpOZklqUW6dslcGX8vrmZraBJseLW3CbmBsbHUl2MnBwSAiYSDw/eZYOwxSQu3FsP ZHNxCAksZZQ43fSSvYuRA6yoZZ8FRHwRo8TP/4dZQRqEBPqZJBY35oDYbAJmEgcXrQarFxEo k5g3oQ6knllgN5PE5bNPwRYIC/hKfN29kBGkhkVAVeL6SWuQMK+Aq8Sl7VNYIFYp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cGsJMJb/+9IsBBvSmJlVWpR fnxRaU5q8SFGU6CTJjJLiSbnA9NHXkm8obGJuamxqaWJhYmZpZI474FW60AhgfTEktTs1NSC 1CKYPiYOTqkGRu2I85zK188GX1Cvtz0S9as4ab3g9U8WQQn2N/4GmxSvkX0/acKCJ4Fum0U6 uZp/X5S9Mn/ha49Km+CspSb1haVZzKqi334kZx69uDD8gcyX7ey/jfeULhdIerlFt2/Xx/bK nO3XNy/uNPbOP2Wgb6KzT878zdvZB5wqbyvnTxLZoMjRrbvsphJLcUaioRZzUXEiANTJyuvn AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch modifies the spi-s3c64xx.c driver to fetch the Chip select or Slave select gpio line property "cs-gpios" from SPI node instead of "controller_data" subnode. Rename the property "cs-gpio" to "cs-gpios" in accordance with the SPI core. Such that s3c64xx.c can use spi->cs_gpio instead of parsing the property in the driver. Update the dt-bindings ion spi/spi-samsung.txt Signed-off-by: Naveen Krishna Chatradhi Acked-by: Rob Herring Cc: Javier Martinez Canillas Cc: Doug Anderson Cc: Tomasz Figa --- This patch is a rework of the change @ http://www.mail-archive.com/devicetree@vger.kernel.org/msg34500.html I'm not sure if i can carry forward the other Signed-offs and Tested-bys .../devicetree/bindings/spi/spi-samsung.txt | 10 +++++----- drivers/spi/spi-s3c64xx.c | 18 ++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 655b665..ff3c4c9 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -39,15 +39,15 @@ Optional Board Specific Properties: - num-cs: Specifies the number of chip select lines supported. If not specified, the default number of chip select lines is set to 1. +- cs-gpios: A gpio specifier that specifies the gpio line used as + the slave select line by the spi controller. The format of the gpio + specifier depends on the gpio controller (Also read spi-bus.txt). + SPI Controller specific data in SPI slave nodes: - The spi slave nodes should provide the following information which is required by the spi controller. - - cs-gpio: A gpio specifier that specifies the gpio line used as - the slave select line by the spi controller. The format of the gpio - specifier depends on the gpio controller. - - samsung,spi-feedback-delay: The sampling phase shift to be applied on the miso line (to account for any lag in the miso line). The following are the valid values. @@ -85,6 +85,7 @@ Example: #size-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&spi0_bus>; + cs-gpios = <&gpa2 5 1 0 3>; w25q80bw@0 { #address-cells = <1>; @@ -94,7 +95,6 @@ Example: spi-max-frequency = <10000>; controller-data { - cs-gpio = <&gpa2 5 1 0 3>; samsung,spi-feedback-delay = <0>; }; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..72bfba6 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -764,12 +764,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( return ERR_PTR(-EINVAL); } - data_np = of_get_child_by_name(slave_np, "controller-data"); - if (!data_np) { - dev_err(&spi->dev, "child node 'controller-data' not found\n"); - return ERR_PTR(-EINVAL); - } - cs = kzalloc(sizeof(*cs), GFP_KERNEL); if (!cs) { of_node_put(data_np); @@ -777,13 +771,17 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( } /* The CS line is asserted/deasserted by the gpio pin */ - if (sdd->cs_gpio) - cs->line = of_get_named_gpio(data_np, "cs-gpio", 0); + cs->line = spi->cs_gpio; if (!gpio_is_valid(cs->line)) { dev_err(&spi->dev, "chip select gpio is not specified or invalid\n"); kfree(cs); - of_node_put(data_np); + return ERR_PTR(-EINVAL); + } + + data_np = of_get_child_by_name(slave_np, "controller-data"); + if (!data_np) { + dev_err(&spi->dev, "child node 'controller-data' not found\n"); return ERR_PTR(-EINVAL); } @@ -1077,7 +1075,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->sfr_start = mem_res->start; sdd->cs_gpio = true; if (pdev->dev.of_node) { - if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL)) + if (!of_find_property(pdev->dev.of_node, "cs-gpios", NULL)) sdd->cs_gpio = false; ret = of_alias_get_id(pdev->dev.of_node, "spi");