diff mbox series

[2/2] DTS: ARM: gta04: introduce legacy spi-cs-high to make display work again

Message ID 8ae7cf816b22ef9cecee0d789fcf9e8a06495c39.1562597164.git.hns@goldelico.com (mailing list archive)
State New, archived
Headers show
Series DTS: ARM: some minor updates and fixes for GTA04 | expand

Commit Message

H. Nikolaus Schaller July 8, 2019, 2:46 p.m. UTC
commit 6953c57ab172 "gpio: of: Handle SPI chipselect legacy bindings"

did introduce logic to centrally handle the legacy spi-cs-high property
in combination with cs-gpios. This assumes that the polarity
of the CS has to be inverted if spi-cs-high is missing, even
and especially if non-legacy GPIO_ACTIVE_HIGH is specified.

The DTS for the GTA04 was orginally introduced under the assumption
that there is no need for spi-cs-high if the gpio is defined with
proper polarity GPIO_ACTIVE_HIGH.

This was not a problem until gpiolib changed the interpretation of
GPIO_ACTIVE_HIGH and missing spi-cs-high.

The effect is that the missing spi-cs-high is now interpreted as CS being
low (despite GPIO_ACTIVE_HIGH) which turns off the SPI interface when the
panel is to be programmed by the panel driver.

Therefore, we have to add the redundant and legacy spi-cs-high property
to properly pass through the legacy handler.

Since this is nowhere documented in the bindings, we add some words of
WARNING.

Cc: stable@vger.kernel.org
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 Documentation/devicetree/bindings/spi/spi-bus.txt | 6 ++++++
 arch/arm/boot/dts/omap3-gta04.dtsi                | 1 +
 2 files changed, 7 insertions(+)

Comments

Rob Herring (Arm) July 24, 2019, 7:42 p.m. UTC | #1
On Mon, Jul 08, 2019 at 04:46:05PM +0200, H. Nikolaus Schaller wrote:
> commit 6953c57ab172 "gpio: of: Handle SPI chipselect legacy bindings"
> 
> did introduce logic to centrally handle the legacy spi-cs-high property
> in combination with cs-gpios. This assumes that the polarity
> of the CS has to be inverted if spi-cs-high is missing, even
> and especially if non-legacy GPIO_ACTIVE_HIGH is specified.
> 
> The DTS for the GTA04 was orginally introduced under the assumption
> that there is no need for spi-cs-high if the gpio is defined with
> proper polarity GPIO_ACTIVE_HIGH.

Given that spi-cs-high is called legacy, that would imply that DT's 
should not have to use spi-cs-high.

> This was not a problem until gpiolib changed the interpretation of
> GPIO_ACTIVE_HIGH and missing spi-cs-high.

Then we should fix gpiolib...

> The effect is that the missing spi-cs-high is now interpreted as CS being
> low (despite GPIO_ACTIVE_HIGH) which turns off the SPI interface when the
> panel is to be programmed by the panel driver.
> 
> Therefore, we have to add the redundant and legacy spi-cs-high property
> to properly pass through the legacy handler.
> 
> Since this is nowhere documented in the bindings, we add some words of
> WARNING.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-bus.txt | 6 ++++++
>  arch/arm/boot/dts/omap3-gta04.dtsi                | 1 +
>  2 files changed, 7 insertions(+)
H. Nikolaus Schaller July 25, 2019, 6:23 a.m. UTC | #2
Hi Rob,

> Am 24.07.2019 um 21:42 schrieb Rob Herring <robh@kernel.org>:
> 
> On Mon, Jul 08, 2019 at 04:46:05PM +0200, H. Nikolaus Schaller wrote:
>> commit 6953c57ab172 "gpio: of: Handle SPI chipselect legacy bindings"
>> 
>> did introduce logic to centrally handle the legacy spi-cs-high property
>> in combination with cs-gpios. This assumes that the polarity
>> of the CS has to be inverted if spi-cs-high is missing, even
>> and especially if non-legacy GPIO_ACTIVE_HIGH is specified.
>> 
>> The DTS for the GTA04 was orginally introduced under the assumption
>> that there is no need for spi-cs-high if the gpio is defined with
>> proper polarity GPIO_ACTIVE_HIGH.
> 
> Given that spi-cs-high is called legacy, that would imply that DT's 
> should not have to use spi-cs-high.

Yes.

> 
>> This was not a problem until gpiolib changed the interpretation of
>> GPIO_ACTIVE_HIGH and missing spi-cs-high.
> 
> Then we should fix gpiolib...

I tried to convince Linus that this is the right way but he convinced
me that a fix that handles all cases does not exist.

There seem to be embedded devices with older DTB (potentially in ROM)
which provide a plain 0 value for a gpios definition. And either with
or without spi-cs-high.

Since "0" is the same as "GPIO_ACTIVE_HIGH", the absence of
spi-cs-high was and must be interpreted as active low for these
devices. This leads to the inversion logic in code.

AFAIR it boils down to the question if gpiolib and the bindings
should still support such legacy devices with out-of tree DTB,
but force in-tree DTS to add the legacy spi-cs-high property.

Or if we should fix the 2 or 3 cases of in-tree legacy cases
and potentially break out-of tree DTBs.

IMHO it is more general to keep the out-of-tree DTBs working
and "fix" what we can control (in-tree DTS).

> 
>> The effect is that the missing spi-cs-high is now interpreted as CS being
>> low (despite GPIO_ACTIVE_HIGH) which turns off the SPI interface when the
>> panel is to be programmed by the panel driver.
>> 
>> Therefore, we have to add the redundant and legacy spi-cs-high property
>> to properly pass through the legacy handler.
>> 
>> Since this is nowhere documented in the bindings, we add some words of
>> WARNING.
>> 
>> Cc: stable@vger.kernel.org
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>> Documentation/devicetree/bindings/spi/spi-bus.txt | 6 ++++++
>> arch/arm/boot/dts/omap3-gta04.dtsi                | 1 +
>> 2 files changed, 7 insertions(+)

BR,
Nikolaus
Rob Herring (Arm) July 25, 2019, 10:42 p.m. UTC | #3
On Thu, Jul 25, 2019 at 12:23 AM H. Nikolaus Schaller <hns@goldelico.com> wrote:
>
> Hi Rob,
>
> > Am 24.07.2019 um 21:42 schrieb Rob Herring <robh@kernel.org>:
> >
> > On Mon, Jul 08, 2019 at 04:46:05PM +0200, H. Nikolaus Schaller wrote:
> >> commit 6953c57ab172 "gpio: of: Handle SPI chipselect legacy bindings"
> >>
> >> did introduce logic to centrally handle the legacy spi-cs-high property
> >> in combination with cs-gpios. This assumes that the polarity
> >> of the CS has to be inverted if spi-cs-high is missing, even
> >> and especially if non-legacy GPIO_ACTIVE_HIGH is specified.
> >>
> >> The DTS for the GTA04 was orginally introduced under the assumption
> >> that there is no need for spi-cs-high if the gpio is defined with
> >> proper polarity GPIO_ACTIVE_HIGH.
> >
> > Given that spi-cs-high is called legacy, that would imply that DT's
> > should not have to use spi-cs-high.
>
> Yes.
>
> >
> >> This was not a problem until gpiolib changed the interpretation of
> >> GPIO_ACTIVE_HIGH and missing spi-cs-high.
> >
> > Then we should fix gpiolib...
>
> I tried to convince Linus that this is the right way but he convinced
> me that a fix that handles all cases does not exist.
>
> There seem to be embedded devices with older DTB (potentially in ROM)
> which provide a plain 0 value for a gpios definition. And either with
> or without spi-cs-high.
>
> Since "0" is the same as "GPIO_ACTIVE_HIGH", the absence of
> spi-cs-high was and must be interpreted as active low for these
> devices. This leads to the inversion logic in code.
>
> AFAIR it boils down to the question if gpiolib and the bindings
> should still support such legacy devices with out-of tree DTB,
> but force in-tree DTS to add the legacy spi-cs-high property.
>
> Or if we should fix the 2 or 3 cases of in-tree legacy cases
> and potentially break out-of tree DTBs.

If it is small number of platforms, then the kernel could handle those
cases explicitly as needed.

> IMHO it is more general to keep the out-of-tree DTBs working
> and "fix" what we can control (in-tree DTS).

If we do this, then we need to not call spi-cs-high legacy because
we're stuck with it forever.

Rob
Linus Walleij Aug. 5, 2019, 10:29 a.m. UTC | #4
On Fri, Jul 26, 2019 at 12:43 AM Rob Herring <robh@kernel.org> wrote:
> On Thu, Jul 25, 2019 at 12:23 AM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> > I tried to convince Linus that this is the right way but he convinced
> > me that a fix that handles all cases does not exist.
> >
> > There seem to be embedded devices with older DTB (potentially in ROM)
> > which provide a plain 0 value for a gpios definition. And either with
> > or without spi-cs-high.
> >
> > Since "0" is the same as "GPIO_ACTIVE_HIGH", the absence of
> > spi-cs-high was and must be interpreted as active low for these
> > devices. This leads to the inversion logic in code.
> >
> > AFAIR it boils down to the question if gpiolib and the bindings
> > should still support such legacy devices with out-of tree DTB,
> > but force in-tree DTS to add the legacy spi-cs-high property.
> >
> > Or if we should fix the 2 or 3 cases of in-tree legacy cases
> > and potentially break out-of tree DTBs.
>
> If it is small number of platforms, then the kernel could handle those
> cases explicitly as needed.
>
> > IMHO it is more general to keep the out-of-tree DTBs working
> > and "fix" what we can control (in-tree DTS).
>
> If we do this, then we need to not call spi-cs-high legacy because
> we're stuck with it forever.

I agree. The background on it is here:
https://lkml.org/lkml/2019/4/2/4

Not using the negatively defined (i.e. if it is no there, the line is
by default active low) spi-cs-high would break
PowerPC, who were AFAICT using this to ship devices.

Yours,
Linus Walleij
Andreas Kemnade Aug. 31, 2019, 6:48 a.m. UTC | #5
Hi,

On Mon, 5 Aug 2019 12:29:19 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Fri, Jul 26, 2019 at 12:43 AM Rob Herring <robh@kernel.org> wrote:
> > On Thu, Jul 25, 2019 at 12:23 AM H. Nikolaus Schaller <hns@goldelico.com> wrote:  
> 
> > > I tried to convince Linus that this is the right way but he convinced
> > > me that a fix that handles all cases does not exist.
> > >
> > > There seem to be embedded devices with older DTB (potentially in ROM)
> > > which provide a plain 0 value for a gpios definition. And either with
> > > or without spi-cs-high.
> > >
> > > Since "0" is the same as "GPIO_ACTIVE_HIGH", the absence of
> > > spi-cs-high was and must be interpreted as active low for these
> > > devices. This leads to the inversion logic in code.
> > >
> > > AFAIR it boils down to the question if gpiolib and the bindings
> > > should still support such legacy devices with out-of tree DTB,
> > > but force in-tree DTS to add the legacy spi-cs-high property.
> > >
> > > Or if we should fix the 2 or 3 cases of in-tree legacy cases
> > > and potentially break out-of tree DTBs.  
> >
> > If it is small number of platforms, then the kernel could handle those
> > cases explicitly as needed.
> >  
> > > IMHO it is more general to keep the out-of-tree DTBs working
> > > and "fix" what we can control (in-tree DTS).  
> >
> > If we do this, then we need to not call spi-cs-high legacy because
> > we're stuck with it forever.  
> 
> I agree. The background on it is here:
> https://lkml.org/lkml/2019/4/2/4
> 
> Not using the negatively defined (i.e. if it is no there, the line is
> by default active low) spi-cs-high would break
> PowerPC, who were AFAICT using this to ship devices.
> 
is this thing now just waiting for someone to do a s/legacy//?

Regards,
Andreas
H. Nikolaus Schaller Sept. 16, 2019, 10:59 a.m. UTC | #6
ping.

Device omap3-gta04 is neither working with v5.3 nor linux-next quite a while and we need a solution.

> Am 31.08.2019 um 08:48 schrieb Andreas Kemnade <andreas@kemnade.info>:
> 
> Hi,
> 
> On Mon, 5 Aug 2019 12:29:19 +0200
> Linus Walleij <linus.walleij@linaro.org> wrote:
> 
>> On Fri, Jul 26, 2019 at 12:43 AM Rob Herring <robh@kernel.org> wrote:
>>> On Thu, Jul 25, 2019 at 12:23 AM H. Nikolaus Schaller <hns@goldelico.com> wrote:  
>> 
>>>> I tried to convince Linus that this is the right way but he convinced
>>>> me that a fix that handles all cases does not exist.
>>>> 
>>>> There seem to be embedded devices with older DTB (potentially in ROM)
>>>> which provide a plain 0 value for a gpios definition. And either with
>>>> or without spi-cs-high.
>>>> 
>>>> Since "0" is the same as "GPIO_ACTIVE_HIGH", the absence of
>>>> spi-cs-high was and must be interpreted as active low for these
>>>> devices. This leads to the inversion logic in code.
>>>> 
>>>> AFAIR it boils down to the question if gpiolib and the bindings
>>>> should still support such legacy devices with out-of tree DTB,
>>>> but force in-tree DTS to add the legacy spi-cs-high property.
>>>> 
>>>> Or if we should fix the 2 or 3 cases of in-tree legacy cases
>>>> and potentially break out-of tree DTBs.  
>>> 
>>> If it is small number of platforms, then the kernel could handle those
>>> cases explicitly as needed.
>>> 
>>>> IMHO it is more general to keep the out-of-tree DTBs working
>>>> and "fix" what we can control (in-tree DTS).  

>>> 
>>> If we do this, then we need to not call spi-cs-high legacy because
>>> we're stuck with it forever.  
>> 
>> I agree. The background on it is here:
>> https://lkml.org/lkml/2019/4/2/4
>> 
>> Not using the negatively defined (i.e. if it is no there, the line is
>> by default active low) spi-cs-high would break
>> PowerPC, who were AFAICT using this to ship devices.
>> 
> is this thing now just waiting for someone to do a s/legacy//?
> 
> Regards,
> Andreas
Linus Walleij Sept. 16, 2019, 10:52 p.m. UTC | #7
On Mon, Sep 16, 2019 at 12:59 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> ping.
>
> Device omap3-gta04 is neither working with v5.3 nor linux-next quite a while and we need a solution.

Can't we just apply the last part of the patch in this thread:

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi
b/arch/arm/boot/dts/omap3-gta04.dtsi
index 9a9a29fe88ec..47bab8e1040e 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -124,6 +124,7 @@
                        spi-max-frequency = <100000>;
                        spi-cpol;
                        spi-cpha;
+                       spi-cs-high;

                        backlight= <&backlight>;
                        label = "lcd";


Surely this fixes the problem?

Yours,
Linus Walleij
H. Nikolaus Schaller Sept. 17, 2019, 2:26 p.m. UTC | #8
Hi Lunus,

> Am 17.09.2019 um 00:52 schrieb Linus Walleij <linus.walleij@linaro.org>:
> 
> On Mon, Sep 16, 2019 at 12:59 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:
> 
>> ping.
>> 
>> Device omap3-gta04 is neither working with v5.3 nor linux-next quite a while and we need a solution.
> 
> Can't we just apply the last part of the patch in this thread:
> 
> diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi
> b/arch/arm/boot/dts/omap3-gta04.dtsi
> index 9a9a29fe88ec..47bab8e1040e 100644
> --- a/arch/arm/boot/dts/omap3-gta04.dtsi
> +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
> @@ -124,6 +124,7 @@
>                        spi-max-frequency = <100000>;
>                        spi-cpol;
>                        spi-cpha;
> +                       spi-cs-high;
> 
>                        backlight= <&backlight>;
>                        label = "lcd";
> 
> 
> Surely this fixes the problem?

yes, it is a workaround, but appears to violate some policies.
E.g. the spi-cs-high; is undocumented but DT bindings maintainer
seems to be against documenting it as I had proposed in my
other patch.

Rather he seems to have proposed a white-list in the driver code.
So that the legacy mode is only becoming active for those systems
which really need the legacy mode instead of everyone.

Then, we do not need this patch for GTA04.

So its up to you to decide which way to go. We are happy with
any one that makes mainline work again asap...

BR and thanks,
Nikolaus
Linus Walleij Sept. 20, 2019, 8:55 a.m. UTC | #9
On Tue, Sep 17, 2019 at 4:26 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:
> > Am 17.09.2019 um 00:52 schrieb Linus Walleij <linus.walleij@linaro.org>:
> > On Mon, Sep 16, 2019 at 12:59 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:
> >
> >> ping.
> >>
> >> Device omap3-gta04 is neither working with v5.3 nor linux-next quite a while and we need a solution.
> >
> > Can't we just apply the last part of the patch in this thread:
> >
> > diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi
> > b/arch/arm/boot/dts/omap3-gta04.dtsi
> > index 9a9a29fe88ec..47bab8e1040e 100644
> > --- a/arch/arm/boot/dts/omap3-gta04.dtsi
> > +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
> > @@ -124,6 +124,7 @@
> >                        spi-max-frequency = <100000>;
> >                        spi-cpol;
> >                        spi-cpha;
> > +                       spi-cs-high;
> >
> >                        backlight= <&backlight>;
> >                        label = "lcd";
> >
> >
> > Surely this fixes the problem?
>
> yes, it is a workaround, but appears to violate some policies.
> E.g. the spi-cs-high; is undocumented but DT bindings maintainer
> seems to be against documenting it as I had proposed in my
> other patch.

It is documented as a boolean in
Documentation/devicetree/bindings/spi/spi-controller.yaml
with the following description:

      spi-cs-high:
        $ref: /schemas/types.yaml#/definitions/flag
        description:
          The device requires the chip select active high.

So I don't think it is about it being undocumented.

> Rather he seems to have proposed a white-list in the driver code.
> So that the legacy mode is only becoming active for those systems
> which really need the legacy mode instead of everyone.

Yeah that seems like a plausible way forward if we want to
move away from the legacy way of specifying polarity.

> Then, we do not need this patch for GTA04.

We don't need to implement the perfect solution up front.
We can aim for that in the long run. I usually go by the IETF
motto "rough consensus and running code".

> So its up to you to decide which way to go. We are happy with
> any one that makes mainline work again asap...

I suggest to go both way:
apply this oneliner and tag for stable so that GTA04 works
again.

Then for the next kernel think about a possible more abitious
whitelist solution and after adding that remove *all* "spi-cs-high"
flags from all device trees in the kernel after fixing them
all up.

Yours,
Linus Walleij
H. Nikolaus Schaller Sept. 20, 2019, 9:19 a.m. UTC | #10
> Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
> 
> On Tue, Sep 17, 2019 at 4:26 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:
>>> Am 17.09.2019 um 00:52 schrieb Linus Walleij <linus.walleij@linaro.org>:
>>> On Mon, Sep 16, 2019 at 12:59 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:
>>> 
>>>> ping.
>>>> 
>>>> Device omap3-gta04 is neither working with v5.3 nor linux-next quite a while and we need a solution.
>>> 
>>> Can't we just apply the last part of the patch in this thread:
>>> 
>>> diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi
>>> b/arch/arm/boot/dts/omap3-gta04.dtsi
>>> index 9a9a29fe88ec..47bab8e1040e 100644
>>> --- a/arch/arm/boot/dts/omap3-gta04.dtsi
>>> +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
>>> @@ -124,6 +124,7 @@
>>>                       spi-max-frequency = <100000>;
>>>                       spi-cpol;
>>>                       spi-cpha;
>>> +                       spi-cs-high;
>>> 
>>>                       backlight= <&backlight>;
>>>                       label = "lcd";
>>> 
>>> 
>>> Surely this fixes the problem?
>> 
>> yes, it is a workaround, but appears to violate some policies.
>> E.g. the spi-cs-high; is undocumented but DT bindings maintainer
>> seems to be against documenting it as I had proposed in my
>> other patch.
> 
> It is documented as a boolean in
> Documentation/devicetree/bindings/spi/spi-controller.yaml
> with the following description:
> 
>      spi-cs-high:
>        $ref: /schemas/types.yaml#/definitions/flag
>        description:
>          The device requires the chip select active high.
> 
> So I don't think it is about it being undocumented.

Yes, the basic property is documented. But incomplete.

The strange inversion side-effect on the third gpio parameter
is undocumented and not understandable from this description
alone.

> 
>> Rather he seems to have proposed a white-list in the driver code.
>> So that the legacy mode is only becoming active for those systems
>> which really need the legacy mode instead of everyone.
> 
> Yeah that seems like a plausible way forward if we want to
> move away from the legacy way of specifying polarity.
> 
>> Then, we do not need this patch for GTA04.
> 
> We don't need to implement the perfect solution up front.
> We can aim for that in the long run. I usually go by the IETF
> motto "rough consensus and running code".
> 
>> So its up to you to decide which way to go. We are happy with
>> any one that makes mainline work again asap...
> 
> I suggest to go both way:
> apply this oneliner and tag for stable so that GTA04 works
> again.
> 
> Then for the next kernel think about a possible more abitious
> whitelist solution and after adding that remove *all* "spi-cs-high"
> flags from all device trees in the kernel after fixing them
> all up.

Ok, that looks like a viable path.

BR and thanks,
Nikolaus
Tony Lindgren Sept. 20, 2019, 2:20 p.m. UTC | #11
* H. Nikolaus Schaller <hns@goldelico.com> [190920 09:19]:
> > Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
> > I suggest to go both way:
> > apply this oneliner and tag for stable so that GTA04 works
> > again.
> > 
> > Then for the next kernel think about a possible more abitious
> > whitelist solution and after adding that remove *all* "spi-cs-high"
> > flags from all device trees in the kernel after fixing them
> > all up.
> 
> Ok, that looks like a viable path.

Please repost the oneline so people can ack easily. At least
I've already lost track of this thread.

Regards,

Tony
H. Nikolaus Schaller Sept. 20, 2019, 2:54 p.m. UTC | #12
> Am 20.09.2019 um 16:20 schrieb Tony Lindgren <tony@atomide.com>:
> 
> * H. Nikolaus Schaller <hns@goldelico.com> [190920 09:19]:
>>> Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
>>> I suggest to go both way:
>>> apply this oneliner and tag for stable so that GTA04 works
>>> again.
>>> 
>>> Then for the next kernel think about a possible more abitious
>>> whitelist solution and after adding that remove *all* "spi-cs-high"
>>> flags from all device trees in the kernel after fixing them
>>> all up.
>> 
>> Ok, that looks like a viable path.
> 
> Please repost the oneline so people can ack easily. At least
> I've already lost track of this thread.

It is all here:

https://patchwork.kernel.org/patch/11035253/

Best regards,
Nikolaus
Andreas Kemnade Sept. 20, 2019, 3:29 p.m. UTC | #13
On Fri, 20 Sep 2019 16:54:18 +0200
"H. Nikolaus Schaller" <hns@goldelico.com> wrote:

> > Am 20.09.2019 um 16:20 schrieb Tony Lindgren <tony@atomide.com>:
> > 
> > * H. Nikolaus Schaller <hns@goldelico.com> [190920 09:19]:  
> >>> Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
> >>> I suggest to go both way:
> >>> apply this oneliner and tag for stable so that GTA04 works
> >>> again.
> >>> 
> >>> Then for the next kernel think about a possible more abitious
> >>> whitelist solution and after adding that remove *all* "spi-cs-high"
> >>> flags from all device trees in the kernel after fixing them
> >>> all up.  
> >> 
> >> Ok, that looks like a viable path.  
> > 
> > Please repost the oneline so people can ack easily. At least
> > I've already lost track of this thread.  
> 
> It is all here:
> 
> https://patchwork.kernel.org/patch/11035253/
> 
It is the full one (incl. documentation), not the oneline and does not
apply. Now lets not discuss whether it is well documented or not. First
get it fixed. 

Regards,
Andreas
H. Nikolaus Schaller Sept. 20, 2019, 3:50 p.m. UTC | #14
> Am 20.09.2019 um 17:29 schrieb Andreas Kemnade <andreas@kemnade.info>:
> 
> On Fri, 20 Sep 2019 16:54:18 +0200
> "H. Nikolaus Schaller" <hns@goldelico.com> wrote:
> 
>>> Am 20.09.2019 um 16:20 schrieb Tony Lindgren <tony@atomide.com>:
>>> 
>>> * H. Nikolaus Schaller <hns@goldelico.com> [190920 09:19]:  
>>>>> Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
>>>>> I suggest to go both way:
>>>>> apply this oneliner and tag for stable so that GTA04 works
>>>>> again.
>>>>> 
>>>>> Then for the next kernel think about a possible more abitious
>>>>> whitelist solution and after adding that remove *all* "spi-cs-high"
>>>>> flags from all device trees in the kernel after fixing them
>>>>> all up.  
>>>> 
>>>> Ok, that looks like a viable path.  
>>> 
>>> Please repost the oneline so people can ack easily. At least
>>> I've already lost track of this thread.  
>> 
>> It is all here:
>> 
>> https://patchwork.kernel.org/patch/11035253/
>> 
> It is the full one (incl. documentation), not the oneline and does not
> apply.

Looks as if it was sitting too long in the queue and linux-next has changed
the basis in the meantime, while v5.3 has not yet.

Documentation/devicetree/bindings/spi/spi-bus.txt -> spi-controller.yaml

So it should still apply for v5.3.1 and earlier and we need both versions.
One for stable and one for linux-next. I don't know how to handle such cases.

BR,
Nikolaus
Tony Lindgren Sept. 20, 2019, 3:53 p.m. UTC | #15
* H. Nikolaus Schaller <hns@goldelico.com> [190920 15:50]:
> 
> > Am 20.09.2019 um 17:29 schrieb Andreas Kemnade <andreas@kemnade.info>:
> > 
> > On Fri, 20 Sep 2019 16:54:18 +0200
> > "H. Nikolaus Schaller" <hns@goldelico.com> wrote:
> > 
> >>> Am 20.09.2019 um 16:20 schrieb Tony Lindgren <tony@atomide.com>:
> >>> 
> >>> * H. Nikolaus Schaller <hns@goldelico.com> [190920 09:19]:  
> >>>>> Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
> >>>>> I suggest to go both way:
> >>>>> apply this oneliner and tag for stable so that GTA04 works
> >>>>> again.
> >>>>> 
> >>>>> Then for the next kernel think about a possible more abitious
> >>>>> whitelist solution and after adding that remove *all* "spi-cs-high"
> >>>>> flags from all device trees in the kernel after fixing them
> >>>>> all up.  
> >>>> 
> >>>> Ok, that looks like a viable path.  
> >>> 
> >>> Please repost the oneline so people can ack easily. At least
> >>> I've already lost track of this thread.  
> >> 
> >> It is all here:
> >> 
> >> https://patchwork.kernel.org/patch/11035253/
> >> 
> > It is the full one (incl. documentation), not the oneline and does not
> > apply.
> 
> Looks as if it was sitting too long in the queue and linux-next has changed
> the basis in the meantime, while v5.3 has not yet.
> 
> Documentation/devicetree/bindings/spi/spi-bus.txt -> spi-controller.yaml
> 
> So it should still apply for v5.3.1 and earlier and we need both versions.
> One for stable and one for linux-next. I don't know how to handle such cases.

Please just repost a minimal dts one line fix. Then a separate
patch for the documentation changes.

Regards,

Tony
H. Nikolaus Schaller Sept. 20, 2019, 3:55 p.m. UTC | #16
> Am 20.09.2019 um 17:50 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
> 
> 
>> Am 20.09.2019 um 17:29 schrieb Andreas Kemnade <andreas@kemnade.info>:
>> 
>> On Fri, 20 Sep 2019 16:54:18 +0200
>> "H. Nikolaus Schaller" <hns@goldelico.com> wrote:
>> 
>>>> Am 20.09.2019 um 16:20 schrieb Tony Lindgren <tony@atomide.com>:
>>>> 
>>>> * H. Nikolaus Schaller <hns@goldelico.com> [190920 09:19]:  
>>>>>> Am 20.09.2019 um 10:55 schrieb Linus Walleij <linus.walleij@linaro.org>:
>>>>>> I suggest to go both way:
>>>>>> apply this oneliner and tag for stable so that GTA04 works
>>>>>> again.
>>>>>> 
>>>>>> Then for the next kernel think about a possible more abitious
>>>>>> whitelist solution and after adding that remove *all* "spi-cs-high"
>>>>>> flags from all device trees in the kernel after fixing them
>>>>>> all up.  
>>>>> 
>>>>> Ok, that looks like a viable path.  
>>>> 
>>>> Please repost the oneline so people can ack easily. At least
>>>> I've already lost track of this thread.  
>>> 
>>> It is all here:
>>> 
>>> https://patchwork.kernel.org/patch/11035253/
>>> 
>> It is the full one (incl. documentation), not the oneline and does not
>> apply.
> 
> Looks as if it was sitting too long in the queue and linux-next has changed
> the basis in the meantime, while v5.3 has not yet.
> 
> Documentation/devicetree/bindings/spi/spi-bus.txt -> spi-controller.yaml
> 
> So it should still apply for v5.3.1 and earlier and we need both versions.
> One for stable and one for linux-next. I don't know how to handle such cases.

Ok, here is a correction of this statement:

It applies fine to v5.2 and v5.3 already uses the spi-controller.yaml
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index 1f6e86f787ef..982aa590058b 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -47,6 +47,10 @@  cs1 : native
 cs2 : &gpio1 1 0
 cs3 : &gpio1 2 0
 
+WARNING: the polarity of cs-gpios may be inverted in some cases compared
+to what is specified in the third parameter. In that case the spi-cs-high
+property must be defined for slave nodes.
+
 
 SPI slave nodes must be children of the SPI controller node.
 
@@ -69,6 +73,8 @@  All slave nodes can contain the following optional properties:
 		    phase (CPHA) mode.
 - spi-cs-high     - Empty property indicating device requires chip select
 		    active high.
+                   WARNING: this is especially required even if the cs-gpios
+		    define the gpio as GPIO_ACTIVE_HIGH
 - spi-3wire       - Empty property indicating device requires 3-wire mode.
 - spi-lsb-first   - Empty property indicating device requires LSB first mode.
 - spi-tx-bus-width - The bus width (number of data wires) that is used for MOSI.
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
index 9a9a29fe88ec..47bab8e1040e 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -124,6 +124,7 @@ 
 			spi-max-frequency = <100000>;
 			spi-cpol;
 			spi-cpha;
+			spi-cs-high;
 
 			backlight= <&backlight>;
 			label = "lcd";