Skip to contentSkip to conversation

Revert "DTS: ARM: gta04: introduce legacy spi-cs-high to make display work again"

RFC New H. Nikolaus Schaller 1 participant 2 messages Dec 2, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

RFC 1/2 Revert "DTS: ARM: gta04: introduce legacy spi-cs-high to make display work again"

This reverts commit f1f028ff89cb.

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.

As a result we had to introduce spi-cs-high to the device tree by

commit f1f028ff89cb ("DTS: ARM: gta04: introduce legacy spi-cs-high to make display work again")

Now,

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

removes this inversion logic again and the GTA04 display is broken again.

So we have to revert the device tree change again.

But we should revert it only if

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

is present in some kernel version. Hence this is the Fixes: reference and not the original change.

Fixes 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors")
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 1 -
 1 file changed, 1 deletion(-)
arch/arm/boot/dts/omap3-gta04.dtsi +0 -1
index 432bbb21ddd05a..7c4c0124e20d45 100644
@@ -149,7 +149,6 @@ lcd: td028ttec1@0 {
 			spi-max-frequency = <100000>;
 			spi-cpol;
 			spi-cpha;
-			spi-cs-high;
 
 			backlight= <&backlight>;
 			label = "lcd";
Signature · 1 line
2.26.2
#2 lore raw

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

In reply to a message not in the archive

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")
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap3-gta04.dtsi +1 -1
index 7c4c0124e20d45..76344b9c294512 100644
@@ -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 */
Signature · 1 line
2.26.2