Patch "serial: sc16is7xx: add check for unsupported SPI modes during probe" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: sc16is7xx: add check for unsupported SPI modes during probe

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-sc16is7xx-add-check-for-unsupported-spi-modes.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 888cbad9c63d5f2694958d56fc064a48477f8f35
Author: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
Date:   Thu Dec 21 18:18:09 2023 -0500

    serial: sc16is7xx: add check for unsupported SPI modes during probe
    
    [ Upstream commit 6d710b769c1f5f0d55c9ad9bb49b7dce009ec103 ]
    
    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.
    
    Fixes: 2c837a8a8f9f ("sc16is7xx: spi interface is added")
    Cc:  <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231221231823.2327894-3-hugo@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 07898a46fd96..800cb94e4b91 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1407,7 +1407,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 ? : 4 * HZ_PER_MHZ;
 	ret = spi_setup(spi);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux