Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754129AbdGXLO5 (ORCPT ); Mon, 24 Jul 2017 07:14:57 -0400 Received: from mail-oi0-f43.google.com ([209.85.218.43]:32942 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbdGXLOt (ORCPT ); Mon, 24 Jul 2017 07:14:49 -0400 MIME-Version: 1.0 In-Reply-To: References: <90b3e14d-0077-9a25-9d90-ab340577af57@web.de> <59066818-a284-4da0-d05f-d2503aeee44b@web.de> From: Andy Shevchenko Date: Mon, 24 Jul 2017 14:14:48 +0300 Message-ID: Subject: Re: [PATCH] spi: pxa2xx: Only claim CS GPIOs when the slave device is created To: Jan Kiszka Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , linux-spi , Linux Kernel Mailing List , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1436 Lines: 36 On Mon, Jul 24, 2017 at 2:06 PM, Jan Kiszka wrote: > On 2017-07-24 13:02, Andy Shevchenko wrote: >> On Mon, Jul 24, 2017 at 1:53 PM, Jan Kiszka wrote: >>> On 2017-07-24 12:44, Andy Shevchenko wrote: >>>> +Cc: Mika >>>> >>>> On Sat, Jul 8, 2017 at 11:41 AM, Jan Kiszka wrote: >>>>> From: Jan Kiszka >>>>> >>>>> Avoid hogging chip select GPIOs just because they are listed for the >>>>> master. They might be mulitplexed and, if no slave device is attached, >>>>> used for different purposes. Moreover, this strategy avoids having to >>>>> allocate a cs_gpiods structure. >>>>> >>>>> Tested on the IOT2000 where the second SPI bus is connected to an >>>>> Arduino-compatible connector and multiplexed between SPI, GPIO and PWM >>>>> usage. >> >>>> This breaks all systems which are using _DSD. >>> >>> Err, can you elaborate? Worked fine here with _DSD on the IOT2000. >> >> Sure, the setup() function can be called several times for the same >> chip (as written in the comment inside the function). >> Definitely your code doesn't follow this, since gpiod_get_index() is >> returning -EBUSY when called 2+ time, that's what I got on all my >> tests. > > Ah, multiple devices on the same controller - I only had one. Nope, one. Since we are talking about recurrent call to gpiod_get_index() with the same index. -- With Best Regards, Andy Shevchenko