Skip to contentSkip to conversation

FAILED: patch "[PATCH] serial: sc16is7xx: add check for unsupported SPI modes during" failed to apply to 4.19-stable tree

PATCH [email protected] 1 participant 1 message Jan 22, 2024

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y
git checkout FETCH_HEAD
git cherry-pick -x 6d710b769c1f5f0d55c9ad9bb49b7dce009ec103
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024012259-headset-sludge-38da@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..

Possible dependencies:

6d710b769c1f ("serial: sc16is7xx: add check for unsupported SPI modes during probe")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 6d710b769c1f5f0d55c9ad9bb49b7dce009ec103 Mon Sep 17 00:00:00 2001
From: Hugo Villeneuve <[email protected]>
Date: Thu, 21 Dec 2023 18:18:09 -0500
Subject: [PATCH] serial: sc16is7xx: add check for unsupported SPI modes during
probe

The original comment is confusing because it implies that variants other than the SC16IS762 supports other SPI modes beside SPI_MODE_0.

Extract from datasheet:
The SC16IS762 differs from the SC16IS752 in that it supports SPI clock speeds up to 15 Mbit/s instead of the 4 Mbit/s supported by the SC16IS752... In all other aspects, the SC16IS762 is functionally and electrically the same as the SC16IS752.

The same is also true of the SC16IS760 variant versus the SC16IS740 and SC16IS750 variants.

For all variants, only SPI mode 0 is supported.

Change comment and abort probing if the specified SPI mode is not SPI_MODE_0.

drivers/tty/serial/sc16is7xx.c +4 -1
index 17b90f971f96..798fa115b28a 100644
@@ -1733,7 +1733,10 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
 
 	/* Setup SPI bus */
 	spi->bits_per_word	= 8;
-	/* only supports mode 0 on SC16IS762 */
+	/* For all variants, only mode 0 is supported */
+	if ((spi->mode & SPI_MODE_X_MASK) != SPI_MODE_0)
+		return dev_err_probe(&spi->dev, -EINVAL, "Unsupported SPI mode\n");
+
 	spi->mode		= spi->mode ? : SPI_MODE_0;
 	spi->max_speed_hz	= spi->max_speed_hz ? : 15000000;
 	ret = spi_setup(spi);