Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752040AbdFLItE (ORCPT ); Mon, 12 Jun 2017 04:49:04 -0400 Received: from regular1.263xmail.com ([211.150.99.132]:43715 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730AbdFLItC (ORCPT ); Mon, 12 Jun 2017 04:49:02 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: geert@linux-m68k.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <890223b258a7027393f56f94cdf44270> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <593E5573.90202@rock-chips.com> Date: Mon, 12 Jun 2017 16:48:51 +0800 From: jeffy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Geert Uytterhoeven , Shawn Lin CC: "linux-kernel@vger.kernel.org" , Mark Brown , Mark Rutland , "devicetree@vger.kernel.org" , Brian Norris , Heiko Stuebner , Doug Anderson , linux-spi , "open list:ARM/Rockchip SoC..." , Rob Herring , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH 1/2] spi: rockchip: add support for "cs-gpios" dts property References: <1497248057-16550-1-git-send-email-jeffy.chen@rock-chips.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2054 Lines: 62 Hi Geert, On 06/12/2017 04:18 PM, Geert Uytterhoeven wrote: > On Mon, Jun 12, 2017 at 9:15 AM, Shawn Lin wrote: >> On 2017/6/12 14:14, Jeffy Chen wrote: >>> >>> Support using "cs-gpios" property to specify cs gpios. >>> >>> Signed-off-by: Jeffy Chen > >>> index 83da493..02171b2 100644 >>> --- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt >>> +++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt >>> @@ -17,6 +17,7 @@ Required Properties: >>> region. >>> - interrupts: The interrupt number to the cpu. The interrupt specifier >>> format >>> depends on the interrupt controller. >>> +- cs-gpios : Specifies the gpio pins to be used for chipselects. >> >> It's not a required property, otherwise how other boards work as your >> patch 2 only add this for rk3399-gru. > >>> --- a/drivers/spi/spi-rockchip.c >>> +++ b/drivers/spi/spi-rockchip.c > >>> @@ -297,6 +302,50 @@ static void rockchip_spi_set_cs(struct spi_device >>> *spi, bool enable) >>> pm_runtime_put_sync(rs->dev); >>> } >>> +static int rockchip_spi_setup(struct spi_device *spi) >>> +{ >>> + int ret = 0; >>> + unsigned long flags = (spi->mode & SPI_CS_HIGH) ? >>> + GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH; >>> + struct rockchip_spi_data *data = spi_get_ctldata(spi); >>> + >>> + if (!gpio_is_valid(spi->cs_gpio)) >>> + return 0; > >> return -EINVAL? > > Isn't this check meant to fall back to hardware CS if no cs-gpios property > is present? Thanks for your comment, and yes it is. I'll add a comment in the code to explain it :) > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds > > >