spi: Force CS_HIGH if GPIO descriptors are used
authorPhil Elwell <phil@raspberrypi.com>
Fri, 17 Apr 2020 09:46:19 +0000 (10:46 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:04:00 +0000 (16:04 +0000)
commite43a151cde15b351b4a769ed7c51346f1357c2c2
tree9347735b52ee07d642adfebb5da60156a4fac87e
parent9230f8792a024a54e8646148937f1ee8de07e672
spi: Force CS_HIGH if GPIO descriptors are used

Commit f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
amended of_spi_parse_dt() to always set SPI_CS_HIGH for SPI slaves whose
Chip Select is defined by a "cs-gpios" devicetree property.

This change breaks drivers whose probe functions set the mode field of
the spi_device because in doing so they clear the SPI_CS_HIGH flag.

Fix by setting SPI_CS_HIGH in spi_setup (under the same conditions as
in of_spi_parse_dt()).

See also: 83b2a8fe43bd ("spi: spidev: Fix CS polarity if GPIO descriptors are used")

Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
SQUASH: spi: Demote SPI_CS_HIGH warning to KERN_DEBUG

This warning is unavoidable from a client's perspective and
doesn't indicate anything wrong (just surprising).

SQUASH with "spi: use_gpio_descriptor fixup moved to spi_setup"

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
drivers/spi/spi.c