diff mbox series

ARM: dts: nomadik: Fix polarity of SPI CS

Message ID 20190318153122.10257-1-linus.walleij@linaro.org (mailing list archive)
State Mainlined, archived
Commit fa9463564e77067df81b0b8dec91adbbbc47bfb4
Headers show
Series ARM: dts: nomadik: Fix polarity of SPI CS | expand

Commit Message

Linus Walleij March 18, 2019, 3:31 p.m. UTC
The SPI DT bindings are for historical reasons a pitfall,
the ability to flag a GPIO line as active high/low with
the second cell flags was introduced later so the SPI
subsystem will only accept the bool flag spi-cs-high
to indicate that the line is active high.

It worked by mistake, but the mistake was corrected
in another commit.

The comment in the DTS file was also misleading: this
CS is indeed active high.

Fixes: cffbb02dafa3 ("ARM: dts: nomadik: Augment NHK15 panel setting")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ARM SoC people: please apply this directly for fixes
if you're OK with it.
---
 arch/arm/boot/dts/ste-nomadik-nhk15.dts | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Arnd Bergmann March 25, 2019, 4:03 p.m. UTC | #1
On Mon, Mar 18, 2019 at 4:31 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> The SPI DT bindings are for historical reasons a pitfall,
> the ability to flag a GPIO line as active high/low with
> the second cell flags was introduced later so the SPI
> subsystem will only accept the bool flag spi-cs-high
> to indicate that the line is active high.
>
> It worked by mistake, but the mistake was corrected
> in another commit.
>
> The comment in the DTS file was also misleading: this
> CS is indeed active high.
>
> Fixes: cffbb02dafa3 ("ARM: dts: nomadik: Augment NHK15 panel setting")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied to fixes, thanks!

      Arnd
Linus Walleij April 7, 2019, 10:16 a.m. UTC | #2
Dear ARM SoC maintainers,

can you please revert this patch. It was the wrong solution to the
wrong problem, and I must have acted in stress. Andrey fixed the
real bug in a proper way in these commits:

commit e5545c94e43b8f6599ffc01df8d1aedf18ee912a
"gpio: of: Check propname before applying "cs-gpios" quirks"
commit 7ce40277bf848391705011ba37eac2e377cbd9e6
"gpio: of: Check for "spi-cs-high" in child instead of parent node"

On Mon, Mar 18, 2019 at 4:31 PM Linus Walleij <linus.walleij@linaro.org> wrote:

> The SPI DT bindings are for historical reasons a pitfall,
> the ability to flag a GPIO line as active high/low with
> the second cell flags was introduced later so the SPI
> subsystem will only accept the bool flag spi-cs-high
> to indicate that the line is active high.
>
> It worked by mistake, but the mistake was corrected
> in another commit.
>
> The comment in the DTS file was also misleading: this
> CS is indeed active high.
>
> Fixes: cffbb02dafa3 ("ARM: dts: nomadik: Augment NHK15 panel setting")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Thanks,
Linus Walleij
Olof Johansson April 7, 2019, 10:19 p.m. UTC | #3
On Sun, Apr 07, 2019 at 12:16:25PM +0200, Linus Walleij wrote:
> Dear ARM SoC maintainers,
> 
> can you please revert this patch. It was the wrong solution to the
> wrong problem, and I must have acted in stress. Andrey fixed the
> real bug in a proper way in these commits:
> 
> commit e5545c94e43b8f6599ffc01df8d1aedf18ee912a
> "gpio: of: Check propname before applying "cs-gpios" quirks"
> commit 7ce40277bf848391705011ba37eac2e377cbd9e6
> "gpio: of: Check for "spi-cs-high" in child instead of parent node"

Done, thanks!

-Olof
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/ste-nomadik-nhk15.dts b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
index 04066f9cb8a3..f2f6558a00f1 100644
--- a/arch/arm/boot/dts/ste-nomadik-nhk15.dts
+++ b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
@@ -213,12 +213,13 @@ 
 		gpio-sck = <&gpio0 5 GPIO_ACTIVE_HIGH>;
 		gpio-mosi = <&gpio0 4 GPIO_ACTIVE_HIGH>;
 		/*
-		 * It's not actually active high, but the frameworks assume
-		 * the polarity of the passed-in GPIO is "normal" (active
-		 * high) then actively drives the line low to select the
-		 * chip.
+		 * This chipselect is active high. Just setting the flags
+		 * to GPIO_ACTIVE_HIGH is not enough for the SPI DT bindings,
+		 * it will be ignored, only the special "spi-cs-high" flag
+		 * really counts.
 		 */
 		cs-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
+		spi-cs-high;
 		num-chipselects = <1>;
 
 		/*