From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932198AbbCFSeL (ORCPT ); Fri, 6 Mar 2015 13:34:11 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:54759 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754303AbbCFSeF (ORCPT ); Fri, 6 Mar 2015 13:34:05 -0500 Message-ID: <54F9F31A.3050501@codeaurora.org> Date: Fri, 06 Mar 2015 10:34:02 -0800 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: "Ivan T. Ivanov" , Mark Brown CC: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 2/2] spi: qup: Request CS GPIO's during probe References: <1425655578-22400-1-git-send-email-iivanov@mm-sol.com> <1425655578-22400-2-git-send-email-iivanov@mm-sol.com> In-Reply-To: <1425655578-22400-2-git-send-email-iivanov@mm-sol.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/06/15 07:26, Ivan T. Ivanov wrote: > Ensure that driver is owner of the GPIO's used for CS signals. Why? What happens if we don't? > > Signed-off-by: Ivan T. Ivanov > --- > drivers/spi/spi-qup.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > 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; Is this related to [1]? In that case I was just relying on DT/pinctrl to properly request the gpios. [1] https://lkml.org/lkml/2014/5/27/784 -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project