Skip to content

Commit 6d710b7

Browse files
hvilleneuvedoogregkh
authored andcommitted
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. Fixes: 2c837a8 ("sc16is7xx: spi interface is added") Cc: <[email protected]> Signed-off-by: Hugo Villeneuve <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8a1060c commit 6d710b7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,10 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
17331733

17341734
/* Setup SPI bus */
17351735
spi->bits_per_word = 8;
1736-
/* only supports mode 0 on SC16IS762 */
1736+
/* For all variants, only mode 0 is supported */
1737+
if ((spi->mode & SPI_MODE_X_MASK) != SPI_MODE_0)
1738+
return dev_err_probe(&spi->dev, -EINVAL, "Unsupported SPI mode\n");
1739+
17371740
spi->mode = spi->mode ? : SPI_MODE_0;
17381741
spi->max_speed_hz = spi->max_speed_hz ? : 15000000;
17391742
ret = spi_setup(spi);

0 commit comments

Comments
 (0)