summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHugo Villeneuve <hvilleneuve@dimonoff.com>2023-12-21 18:18:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-25 15:27:44 -0800
commitd2ba8eea74af63f6104c1044a881ede07218a111 (patch)
tree994ae125e45c516daf1f9d5a0e1bfa451ebf1b0e /drivers
parent4f61154a683de9bf31254ea4e5820b00fe3bdf0d (diff)
downloadlinux-d2ba8eea74af63f6104c1044a881ede07218a111.tar.gz
linux-d2ba8eea74af63f6104c1044a881ede07218a111.tar.bz2
linux-d2ba8eea74af63f6104c1044a881ede07218a111.zip
serial: sc16is7xx: set safe default SPI clock frequency
commit 3ef79cd1412236d884ab0c46b4d1921380807b48 upstream. 15 MHz is supported only by 76x variants. If the SPI clock frequency is not specified, use a safe default clock value of 4 MHz that is supported by all variants. Also use HZ_PER_MHZ macro to improve readability. Fixes: 2c837a8a8f9f ("sc16is7xx: spi interface is added") Cc: <stable@vger.kernel.org> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20231221231823.2327894-4-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/sc16is7xx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 88d585769762..db33790e6675 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -24,6 +24,7 @@
#include <linux/tty_flip.h>
#include <linux/spi/spi.h>
#include <linux/uaccess.h>
+#include <linux/units.h>
#include <uapi/linux/sched/types.h>
#define SC16IS7XX_NAME "sc16is7xx"
@@ -1721,7 +1722,7 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
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;
+ spi->max_speed_hz = spi->max_speed_hz ? : 4 * HZ_PER_MHZ;
ret = spi_setup(spi);
if (ret)
return ret;