From patchwork Fri Mar 6 15:26:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T. Ivanov" X-Patchwork-Id: 5955771 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 13AD69F373 for ; Fri, 6 Mar 2015 15:26:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43DF020398 for ; Fri, 6 Mar 2015 15:26:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DACE2034B for ; Fri, 6 Mar 2015 15:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754387AbbCFP03 (ORCPT ); Fri, 6 Mar 2015 10:26:29 -0500 Received: from ns.mm-sol.com ([37.157.136.199]:48781 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752582AbbCFP02 (ORCPT ); Fri, 6 Mar 2015 10:26:28 -0500 Received: from mms-0439.wifi.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id AF260C8AA; Fri, 6 Mar 2015 17:26:26 +0200 (EET) From: "Ivan T. Ivanov" To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/2] spi: qup: Request CS GPIO's during probe Date: Fri, 6 Mar 2015 17:26:18 +0200 Message-Id: <1425655578-22400-2-git-send-email-iivanov@mm-sol.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1425655578-22400-1-git-send-email-iivanov@mm-sol.com> References: <1425655578-22400-1-git-send-email-iivanov@mm-sol.com> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Ensure that driver is owner of the GPIO's used for CS signals. Signed-off-by: Ivan T. Ivanov --- drivers/spi/spi-qup.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index 2b2c359..a07ba46 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -14,11 +14,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -499,7 +501,7 @@ static int spi_qup_probe(struct platform_device *pdev) struct device *dev; void __iomem *base; u32 max_freq, iomode, num_cs; - int ret, irq, size; + int ret, irq, size, cs, cs_gpio; dev = &pdev->dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -556,6 +558,19 @@ static int spi_qup_probe(struct platform_device *pdev) else master->num_chipselect = num_cs; + for (cs = 0; cs < master->num_chipselect; cs++) { + cs_gpio = of_get_named_gpio(dev->of_node, "cs-gpios", cs); + + if (!gpio_is_valid(cs_gpio)) + continue; + + ret = devm_gpio_request(&pdev->dev, cs_gpio, "spi-qup-cs"); + if (ret) { + dev_err(&pdev->dev, "can't get cs gpios\n"); + goto error; + } + } + master->bus_num = pdev->id; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);