]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
spi: always use software fallback for SPI_CS_WORD when using cs_gio
authorDavid Lechner <david@lechnology.com>
Tue, 18 Sep 2018 17:08:48 +0000 (12:08 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 18 Sep 2018 17:40:32 +0000 (10:40 -0700)
This modifies the condition for using the software fallback
implementation for SPI_CS_WORD when the SPI controller is using a GPIO
for the CS line. When using a GPIO for CS, the hardware implementation
won't work, so we just enable the software fallback globally in this
case.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index be73d236919f067a9ad5be3123024ff1f417a22f..a358acdd98d39a0d168c8a6c350650f0c412edca 100644 (file)
@@ -2832,11 +2832,13 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
                return -EINVAL;
 
        /* If an SPI controller does not support toggling the CS line on each
-        * transfer (indicated by the SPI_CS_WORD flag), we can emulate it by
+        * transfer (indicated by the SPI_CS_WORD flag) or we are using a GPIO
+        * for the CS line, we can emulate the CS-per-word hardware function by
         * splitting transfers into one-word transfers and ensuring that
         * cs_change is set for each transfer.
         */
-       if ((spi->mode & SPI_CS_WORD) && !(ctlr->mode_bits & SPI_CS_WORD)) {
+       if ((spi->mode & SPI_CS_WORD) && (!(ctlr->mode_bits & SPI_CS_WORD) ||
+                                         gpio_is_valid(spi->cs_gpio))) {
                size_t maxsize;
                int ret;