All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hugo Villeneuve <hugo@hugovil.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl,
	indrakanti_ram@hotmail.com, phil@raspberrypi.org
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	hugo@hugovil.com, Hugo Villeneuve <hvilleneuve@dimonoff.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 03/16] serial: sc16is7xx: set safe default SPI clock frequency
Date: Thu, 21 Dec 2023 18:18:10 -0500	[thread overview]
Message-ID: <20231221231823.2327894-4-hugo@hugovil.com> (raw)
In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com>

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

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>
---
 drivers/tty/serial/sc16is7xx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 798fa115b28a..ced2446909a2 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"
@@ -1738,7 +1739,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;
-- 
2.39.2


  parent reply	other threads:[~2023-12-21 23:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 23:18 [PATCH v2 00/16] serial: sc16is7xx: fixes, cleanups and improvements Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 01/16] serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 02/16] serial: sc16is7xx: add check for unsupported SPI modes during probe Hugo Villeneuve
2023-12-21 23:18 ` Hugo Villeneuve [this message]
2023-12-21 23:18 ` [PATCH v2 04/16] serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq() Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 05/16] serial: sc16is7xx: improve do/while loop in sc16is7xx_irq() Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 06/16] serial: sc16is7xx: use DECLARE_BITMAP for sc16is7xx_lines bitfield Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 07/16] serial: sc16is7xx: use spi_get_device_match_data() Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 08/16] serial: sc16is7xx: use i2c_get_match_data() Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 09/16] serial: sc16is7xx: add driver name to struct uart_driver Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 10/16] serial: sc16is7xx: add macro for max number of UART ports Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 11/16] serial: sc16is7xx: add explicit return for some switch default cases Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 12/16] serial: sc16is7xx: replace hardcoded divisor value with BIT() macro Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 13/16] serial: sc16is7xx: drop unneeded MODULE_ALIAS Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 14/16] serial: sc16is7xx: refactor FIFO access functions to increase commonality Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 15/16] serial: sc16is7xx: reorder code to remove prototype declarations Hugo Villeneuve
2023-12-21 23:18 ` [PATCH v2 16/16] serial: sc16is7xx: refactor EFR lock Hugo Villeneuve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231221231823.2327894-4-hugo@hugovil.com \
    --to=hugo@hugovil.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=indrakanti_ram@hotmail.com \
    --cc=jirislaby@kernel.org \
    --cc=kubakici@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=phil@raspberrypi.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.