diff mbox series

[RFC,2/2] DTS: ARM: gta04: SPI panel chip select is active low

Message ID 5c979df0d9eb68c234686c85e6e22f84b143c7ed.1606899361.git.hns@goldelico.com
State Accepted
Commit 181739822cf6f8f4e12b173913af2967a28906c0
Headers show
Series None | expand

Commit Message

H. Nikolaus Schaller Dec. 2, 2020, 8:56 a.m. UTC
Historically the panel driver did know the polarity and
the device tree introduced by

commit c2e138bc8ed8 ("ARM: dts: omap3-gta04: Add display support")

as

	cs-gpios = <&gpio1 19 0>;

The 0 was ignored because the spi-gpio driver did only
look at the presence of an spi-cs-high property. Since
it was not present, the CS was active low.

commit 3a637e008e54 ("ARM: dts: Use defined GPIO constants in flags cell for OMAP2+ boards")

replaced the constant 0 by the constant GPIO_ACTIVE_HIGH
which was no problem because it was still ignored.

Starting with

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

the gpiolib and spi-gpio drivers tried to handle both properties
by making an inversion for GPIO_ACTIVE_HIGH definitions.

To keep the device tree compatible with older kernels which
ignored the GPIO_ACTIVE property we just added spi-cs-high;.

This tells the inversion logic that we want an active low
chip select as defined by the rule documented by the commit
message of

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

	"If the line is tagged as active high in the device tree with
    the second cell flag and has no "spi-cs-high" property we
    enforce active low semantics (as this is the exception we can
    just tag on the flag)."

This went well until

commit 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors")

arrived which effectively removes the inversion logic rule.

Removing spi-cs-high; in a separate patch already solves the
urgent problem, but to remove

[    3.629791] td028ttec1@0 enforce active low on chipselect handle

and to be safe against future changes of such rules we also define
the cs-gpio explicitly as GPIO_ACTIVE_LOW.

Note that this patch breaks all kernels between
commit 6953c57ab172 ("gpio: of: Handle SPI chipselect legacy bindings")
and
commit 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors")

Fixes: 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors")
CC: stable@vger.kernel.org
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
index 7c4c0124e20d45..76344b9c294512 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -139,7 +139,7 @@  spi_lcd: spi_lcd {
 		gpio-sck = <&gpio1 12 GPIO_ACTIVE_HIGH>;
 		gpio-miso = <&gpio1 18 GPIO_ACTIVE_HIGH>;
 		gpio-mosi = <&gpio1 20 GPIO_ACTIVE_HIGH>;
-		cs-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
+		cs-gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
 		num-chipselects = <1>;
 
 		/* lcd panel */