Re: [PATCH] spi: dt-bindings: clarify CS behavior for spi-cs-high and gpio descriptors

From: H. Nikolaus Schaller
Date: Wed Dec 09 2020 - 14:35:42 EST



> Am 09.12.2020 um 20:04 schrieb Sven Van Asbroeck <thesven73@xxxxxxxxx>:
>
> On Wed, Dec 9, 2020 at 1:16 PM H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
>>
>> This is also what made me wonder if that is really intended because then
>> the whole discussion about the cs-gpio-flags and inversion and the fixes
>> would not have been needed. The current code and fixes are all about
>> not ignoring the flags...
>
> The inversion you witnessed was a bug caused by spi client drivers that

The inversion we witnessed came from:

commit 6953c57ab172 "gpio: of: Handle SPI chipselect legacy bindings"

There, I read a verbal description of the table I want to formalize
with this patch, because natural language is not as precise as the language
of logic.

This has nothing to do with driver code, which remained and remains unchanged
for long time.

>
>> Secondly, please imagine some reader of a device tree who finds
>>
>> cs-gpios = <&gpio 7 ACTIVE_LOW>;
>> spi-cs-high;
>
> That reader looks at the rules, sees that:
> - the ACTIVE_LOW is ignored,
> - presence of spi-cs-high means active-high
> and concludes this chip-select is active-high.

This misses information what the reader should do to resolve the
obviously missing beauty of the DT.

a) remove spi-cs-high;
b) change to ACTIVE_HIGH

Both appear valid in first place. But one is preferred. This is
again nowhere documented if you simplify the table.