From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH 1/2] spi: rockchip: add support for "cs-gpios" dts property Date: Mon, 12 Jun 2017 10:18:06 +0200 Message-ID: References: <1497248057-16550-1-git-send-email-jeffy.chen@rock-chips.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+glpar-linux-rockchip=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Shawn Lin Cc: Mark Rutland , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Brian Norris , Heiko Stuebner , Jeffy Chen , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Rob Herring , Doug Anderson , "open list:ARM/Rockchip SoC..." , Mark Brown , linux-spi , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org 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? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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