mbox series

[v2,0/5] serial: add drivers for the ESP32xx serial devices

Message ID 20230920022644.2712651-1-jcmvbkbc@gmail.com
Headers show
Series serial: add drivers for the ESP32xx serial devices | expand

Message

Max Filippov Sept. 20, 2023, 2:26 a.m. UTC
Hello,

this series adds drivers for the UART and ACM controllers found in the
Espressif ESP32 and ESP32S3 SoCs.

Changes v1->v2:
- address review comments, listed in each patch
- add cleanup for the uart_get_baud_rate function

Max Filippov (5):
  serial: core: tidy invalid baudrate handling in uart_get_baud_rate
  dt-bindings: serial: document esp32-uart
  drivers/tty/serial: add driver for the ESP32 UART
  dt-bindings: serial: document esp32s3-acm
  drivers/tty/serial: add ESP32S3 ACM device driver

 .../bindings/serial/esp,esp32-acm.yaml        |  39 +
 .../bindings/serial/esp,esp32-uart.yaml       |  48 ++
 drivers/tty/serial/Kconfig                    |  27 +
 drivers/tty/serial/Makefile                   |   2 +
 drivers/tty/serial/esp32_acm.c                | 458 +++++++++++
 drivers/tty/serial/esp32_uart.c               | 749 ++++++++++++++++++
 drivers/tty/serial/serial_core.c              |   5 +-
 include/uapi/linux/serial_core.h              |   6 +
 8 files changed, 1331 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-acm.yaml
 create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
 create mode 100644 drivers/tty/serial/esp32_acm.c
 create mode 100644 drivers/tty/serial/esp32_uart.c

Comments

Jiri Slaby Sept. 20, 2023, 7:22 a.m. UTC | #1
On 20. 09. 23, 4:26, Max Filippov wrote:
> Add driver for the UART controllers of the Espressif ESP32 and ESP32S3
> SoCs. Hardware specification is available at the following URLs:
...
> +static void esp32_uart_rxint(struct uart_port *port)
> +{
> +	struct tty_port *tty_port = &port->state->port;
> +	u32 rx_fifo_cnt = esp32_uart_rx_fifo_cnt(port);
> +	unsigned long flags;
> +	u32 i;
> +
> +	if (!rx_fifo_cnt)
> +		return;
> +
> +	spin_lock_irqsave(&port->lock, flags);
> +
> +	for (i = 0; i < rx_fifo_cnt; ++i) {
> +		u32 rx = esp32_uart_read(port, UART_FIFO_REG);
> +		u32 brk = 0;
> +
> +		++port->icount.rx;

Should yuou increment this only in case of insert_flip_char()?

> +		if (!rx) {
> +			brk = esp32_uart_read(port, UART_INT_ST_REG) &
> +				UART_BRK_DET_INT;
> +		}
> +		if (brk) {
> +			esp32_uart_write(port, UART_INT_CLR_REG, brk);
> +			++port->icount.brk;
> +			uart_handle_break(port);
> +		} else {
> +			if (uart_handle_sysrq_char(port, (unsigned char)rx))
> +				continue;
> +			tty_insert_flip_char(tty_port, rx, TTY_NORMAL);
> +		}

This is heavy. Is it equivalent to:
if (!rx && esp32_uart_read(port, UART_INT_ST_REG) &
     UART_BRK_DET_INT) {
   esp32_uart_write(port, UART_INT_CLR_REG, brk);
   ++port->icount.brk;
   uart_handle_break(port);
   continue;
}

if (uart_handle_sysrq_char(port, (unsigned char)rx))
   continue;

tty_insert_flip_char(tty_port, rx, TTY_NORMAL);

?

> +	}
> +	spin_unlock_irqrestore(&port->lock, flags);
> +
> +	tty_flip_buffer_push(tty_port);
> +}
...
> +static void esp32_uart_put_char_sync(struct uart_port *port, u8 c)
> +{
> +	unsigned long timeout;
> +
> +	timeout = jiffies + msecs_to_jiffies(1000);

I.e. plus HZ?

> +	while (esp32_uart_tx_fifo_cnt(port) >= ESP32_UART_TX_FIFO_SIZE) {
> +		if (time_after(jiffies, timeout)) {
> +			dev_warn(port->dev, "timeout waiting for TX FIFO\n");
> +			return;
> +		}
> +		cpu_relax();
> +	}
> +	esp32_uart_put_char(port, c);
> +}
> +
> +static void esp32_uart_transmit_buffer(struct uart_port *port)
> +{
> +	u32 tx_fifo_used = esp32_uart_tx_fifo_cnt(port);
> +
> +	if (tx_fifo_used < ESP32_UART_TX_FIFO_SIZE) {

Invert the condition and return here?

> +		unsigned int pending;
> +		u8 ch;
> +
> +		pending = uart_port_tx_limited(port, ch,
> +					       ESP32_UART_TX_FIFO_SIZE - tx_fifo_used,
> +					       true, esp32_uart_put_char(port, ch),
> +					       ({}));
> +		if (pending) {
> +			u32 int_ena;
> +
> +			int_ena = esp32_uart_read(port, UART_INT_ENA_REG);
> +			int_ena |= UART_TXFIFO_EMPTY_INT;
> +			esp32_uart_write(port, UART_INT_ENA_REG, int_ena);
> +		}
> +	}
> +}


> +static irqreturn_t esp32_uart_int(int irq, void *dev_id)
> +{
> +	struct uart_port *port = dev_id;
> +	u32 status;
> +
> +	status = esp32_uart_read(port, UART_INT_ST_REG);
> +
> +	if (status & (UART_RXFIFO_FULL_INT | UART_BRK_DET_INT))
> +		esp32_uart_rxint(port);
> +	if (status & UART_TXFIFO_EMPTY_INT)
> +		esp32_uart_txint(port);
> +
> +	esp32_uart_write(port, UART_INT_CLR_REG, status);

\n here please.

> +	return IRQ_RETVAL(status);
> +}

> +static int esp32_uart_startup(struct uart_port *port)
> +{
> +	int ret = 0;
> +	unsigned long flags;
> +	struct esp32_port *sport = container_of(port, struct esp32_port, port);
> +
> +	ret = clk_prepare_enable(sport->clk);
> +	if (ret)
> +		return ret;
> +
> +	ret = devm_request_irq(port->dev, port->irq, esp32_uart_int, 0,
> +			       DRIVER_NAME, port);
> +	if (ret) {
> +		clk_disable_unprepare(sport->clk);
> +		return ret;
> +	}
> +
> +	spin_lock_irqsave(&port->lock, flags);
> +	esp32_uart_write(port, UART_CONF1_REG,
> +			 (1 << UART_RXFIFO_FULL_THRHD_SHIFT) |

BIT() ?

> +			 (1 << port_variant(port)->txfifo_empty_thrhd_shift));

And here?

> +	esp32_uart_write(port, UART_INT_CLR_REG, UART_RXFIFO_FULL_INT | UART_BRK_DET_INT);
> +	esp32_uart_write(port, UART_INT_ENA_REG, UART_RXFIFO_FULL_INT | UART_BRK_DET_INT);
> +	spin_unlock_irqrestore(&port->lock, flags);
> +
> +	pr_debug("%s, conf1 = %08x, int_st = %08x, status = %08x\n",
> +		 __func__,
> +		 esp32_uart_read(port, UART_CONF1_REG),
> +		 esp32_uart_read(port, UART_INT_ST_REG),
> +		 esp32_uart_read(port, UART_STATUS_REG));

\n here. Is this debug printout somehow useful?

> +	return ret;
> +}
> +
> +static void esp32_uart_shutdown(struct uart_port *port)
> +{
> +	struct esp32_port *sport = container_of(port, struct esp32_port, port);
> +
> +	esp32_uart_write(port, UART_INT_ENA_REG, 0);
> +	devm_free_irq(port->dev, port->irq, port);

I wonder why to use devm_ after all?

> +	clk_disable_unprepare(sport->clk);
> +}
> +
> +static bool esp32_uart_set_baud(struct uart_port *port, u32 baud)
> +{
> +	u32 div = port->uartclk / baud;
> +	u32 frag = (port->uartclk * 16) / baud - div * 16;
> +
> +	if (div <= port_variant(port)->clkdiv_mask) {
> +		esp32_uart_write(port, UART_CLKDIV_REG,
> +				 div | FIELD_PREP(UART_CLKDIV_FRAG, frag));
> +		return true;
> +	}

\n

> +	return false;
> +}
...
> +static int __init esp32s3_uart_early_console_setup(struct earlycon_device *device,
> +						   const char *options)
> +{
> +	device->port.private_data = (void *)&esp32s3_variant;

No need to cast, right?

\n

> +	return esp32xx_uart_early_console_setup(device, options);
> +}
...
> +static int esp32_uart_probe(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +	static const struct of_device_id *match;
> +	struct uart_port *port;
> +	struct esp32_port *sport;
> +	struct resource *res;
> +	int ret;
> +
> +	match = of_match_device(esp32_uart_dt_ids, &pdev->dev);
> +	if (!match)
> +		return -ENODEV;
> +
> +	sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL);
> +	if (!sport)
> +		return -ENOMEM;
> +
> +	port = &sport->port;
> +
> +	ret = of_alias_get_id(np, "serial");
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> +		return ret;
> +	}
> +	if (ret >= UART_NR) {
> +		dev_err(&pdev->dev, "driver limited to %d serial ports\n", UART_NR);
> +		return -ENOMEM;
> +	}
> +
> +	port->line = ret;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -ENODEV;
> +
> +	port->mapbase = res->start;
> +	port->membase = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(port->membase))
> +		return PTR_ERR(port->membase);
> +
> +	sport->clk = devm_clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(sport->clk))
> +		return PTR_ERR(sport->clk);
> +
> +	port->uartclk = clk_get_rate(sport->clk);
> +	port->dev = &pdev->dev;
> +	port->type = PORT_ESP32UART;
> +	port->iotype = UPIO_MEM;
> +	port->irq = platform_get_irq(pdev, 0);
> +	port->ops = &esp32_uart_pops;
> +	port->flags = UPF_BOOT_AUTOCONF;
> +	port->has_sysrq = 1;
> +	port->fifosize = ESP32_UART_TX_FIFO_SIZE;
> +	port->private_data = (void *)match->data;

No need to cast.

> +
> +	esp32_uart_ports[port->line] = sport;
> +
> +	platform_set_drvdata(pdev, port);
> +
> +	return uart_add_one_port(&esp32_uart_reg, port);
> +}

regards,
Max Filippov Sept. 20, 2023, 8:34 a.m. UTC | #2
On Wed, Sep 20, 2023 at 12:22 AM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> On 20. 09. 23, 4:26, Max Filippov wrote:
> > Add driver for the UART controllers of the Espressif ESP32 and ESP32S3
> > SoCs. Hardware specification is available at the following URLs:
> ...
> > +static void esp32_uart_rxint(struct uart_port *port)
> > +{
> > +     struct tty_port *tty_port = &port->state->port;
> > +     u32 rx_fifo_cnt = esp32_uart_rx_fifo_cnt(port);
> > +     unsigned long flags;
> > +     u32 i;
> > +
> > +     if (!rx_fifo_cnt)
> > +             return;
> > +
> > +     spin_lock_irqsave(&port->lock, flags);
> > +
> > +     for (i = 0; i < rx_fifo_cnt; ++i) {
> > +             u32 rx = esp32_uart_read(port, UART_FIFO_REG);
> > +             u32 brk = 0;
> > +
> > +             ++port->icount.rx;
>
> Should yuou increment this only in case of insert_flip_char()?

I don't know. Does port->icount.rx have clearly defined semantics?
I've looked through multiple other serial drivers and there's a lot of
examples of similar pattern.

> > +             if (!rx) {
> > +                     brk = esp32_uart_read(port, UART_INT_ST_REG) &
> > +                             UART_BRK_DET_INT;
> > +             }
> > +             if (brk) {
> > +                     esp32_uart_write(port, UART_INT_CLR_REG, brk);
> > +                     ++port->icount.brk;
> > +                     uart_handle_break(port);
> > +             } else {
> > +                     if (uart_handle_sysrq_char(port, (unsigned char)rx))
> > +                             continue;
> > +                     tty_insert_flip_char(tty_port, rx, TTY_NORMAL);
> > +             }
>
> This is heavy. Is it equivalent to:
> if (!rx && esp32_uart_read(port, UART_INT_ST_REG) &
>      UART_BRK_DET_INT) {
>    esp32_uart_write(port, UART_INT_CLR_REG, brk);
>    ++port->icount.brk;
>    uart_handle_break(port);
>    continue;
> }
>
> if (uart_handle_sysrq_char(port, (unsigned char)rx))
>    continue;
>
> tty_insert_flip_char(tty_port, rx, TTY_NORMAL);
>
> ?

It is equivalent, but I find the version that I used somewhat easier to read.
Maybe this:

               if (!rx &&
                   (esp32_uart_read(port, UART_INT_ST_REG) &
UART_BRK_DET_INT)) {
                       esp32_uart_write(port, UART_INT_CLR_REG, brk);
                       ++port->icount.brk;
                       uart_handle_break(port);
               } else {
                       if (uart_handle_sysrq_char(port, (unsigned char)rx))
                               continue;
                       tty_insert_flip_char(tty_port, rx, TTY_NORMAL);
               }

?

> > +     }
> > +     spin_unlock_irqrestore(&port->lock, flags);
> > +
> > +     tty_flip_buffer_push(tty_port);
> > +}
> ...
> > +static void esp32_uart_put_char_sync(struct uart_port *port, u8 c)
> > +{
> > +     unsigned long timeout;
> > +
> > +     timeout = jiffies + msecs_to_jiffies(1000);
>
> I.e. plus HZ?

Yes, ok.

> > +     while (esp32_uart_tx_fifo_cnt(port) >= ESP32_UART_TX_FIFO_SIZE) {
> > +             if (time_after(jiffies, timeout)) {
> > +                     dev_warn(port->dev, "timeout waiting for TX FIFO\n");
> > +                     return;
> > +             }
> > +             cpu_relax();
> > +     }
> > +     esp32_uart_put_char(port, c);
> > +}
> > +
> > +static void esp32_uart_transmit_buffer(struct uart_port *port)
> > +{
> > +     u32 tx_fifo_used = esp32_uart_tx_fifo_cnt(port);
> > +
> > +     if (tx_fifo_used < ESP32_UART_TX_FIFO_SIZE) {
>
> Invert the condition and return here?

Ok.

> > +             unsigned int pending;
> > +             u8 ch;
> > +
> > +             pending = uart_port_tx_limited(port, ch,
> > +                                            ESP32_UART_TX_FIFO_SIZE - tx_fifo_used,
> > +                                            true, esp32_uart_put_char(port, ch),
> > +                                            ({}));
> > +             if (pending) {
> > +                     u32 int_ena;
> > +
> > +                     int_ena = esp32_uart_read(port, UART_INT_ENA_REG);
> > +                     int_ena |= UART_TXFIFO_EMPTY_INT;
> > +                     esp32_uart_write(port, UART_INT_ENA_REG, int_ena);
> > +             }
> > +     }
> > +}
>
>
> > +static irqreturn_t esp32_uart_int(int irq, void *dev_id)
> > +{
> > +     struct uart_port *port = dev_id;
> > +     u32 status;
> > +
> > +     status = esp32_uart_read(port, UART_INT_ST_REG);
> > +
> > +     if (status & (UART_RXFIFO_FULL_INT | UART_BRK_DET_INT))
> > +             esp32_uart_rxint(port);
> > +     if (status & UART_TXFIFO_EMPTY_INT)
> > +             esp32_uart_txint(port);
> > +
> > +     esp32_uart_write(port, UART_INT_CLR_REG, status);
>
> \n here please.

Ok

> > +     return IRQ_RETVAL(status);
> > +}
>
> > +static int esp32_uart_startup(struct uart_port *port)
> > +{
> > +     int ret = 0;
> > +     unsigned long flags;
> > +     struct esp32_port *sport = container_of(port, struct esp32_port, port);
> > +
> > +     ret = clk_prepare_enable(sport->clk);
> > +     if (ret)
> > +             return ret;
> > +
> > +     ret = devm_request_irq(port->dev, port->irq, esp32_uart_int, 0,
> > +                            DRIVER_NAME, port);
> > +     if (ret) {
> > +             clk_disable_unprepare(sport->clk);
> > +             return ret;
> > +     }
> > +
> > +     spin_lock_irqsave(&port->lock, flags);
> > +     esp32_uart_write(port, UART_CONF1_REG,
> > +                      (1 << UART_RXFIFO_FULL_THRHD_SHIFT) |
>
> BIT() ?
>
> > +                      (1 << port_variant(port)->txfifo_empty_thrhd_shift));
>
> And here?

These are not logically bits, in both cases I put value 1 into
multiple-bit fields.

> > +     esp32_uart_write(port, UART_INT_CLR_REG, UART_RXFIFO_FULL_INT | UART_BRK_DET_INT);
> > +     esp32_uart_write(port, UART_INT_ENA_REG, UART_RXFIFO_FULL_INT | UART_BRK_DET_INT);
> > +     spin_unlock_irqrestore(&port->lock, flags);
> > +
> > +     pr_debug("%s, conf1 = %08x, int_st = %08x, status = %08x\n",
> > +              __func__,
> > +              esp32_uart_read(port, UART_CONF1_REG),
> > +              esp32_uart_read(port, UART_INT_ST_REG),
> > +              esp32_uart_read(port, UART_STATUS_REG));
>
> \n here. Is this debug printout somehow useful?

I'll drop it.

> > +     return ret;
> > +}
> > +
> > +static void esp32_uart_shutdown(struct uart_port *port)
> > +{
> > +     struct esp32_port *sport = container_of(port, struct esp32_port, port);
> > +
> > +     esp32_uart_write(port, UART_INT_ENA_REG, 0);
> > +     devm_free_irq(port->dev, port->irq, port);
>
> I wonder why to use devm_ after all?

I'll switch to non-devm_ version.

> > +     clk_disable_unprepare(sport->clk);
> > +}
> > +
> > +static bool esp32_uart_set_baud(struct uart_port *port, u32 baud)
> > +{
> > +     u32 div = port->uartclk / baud;
> > +     u32 frag = (port->uartclk * 16) / baud - div * 16;
> > +
> > +     if (div <= port_variant(port)->clkdiv_mask) {
> > +             esp32_uart_write(port, UART_CLKDIV_REG,
> > +                              div | FIELD_PREP(UART_CLKDIV_FRAG, frag));
> > +             return true;
> > +     }
>
> \n

Ok.

> > +     return false;
> > +}
> ...
> > +static int __init esp32s3_uart_early_console_setup(struct earlycon_device *device,
> > +                                                const char *options)
> > +{
> > +     device->port.private_data = (void *)&esp32s3_variant;
>
> No need to cast, right?

private_data is void *, esp32s3_variant is a constant.

> \n

Ok.

> > +     return esp32xx_uart_early_console_setup(device, options);
> > +}
> ...
> > +static int esp32_uart_probe(struct platform_device *pdev)
> > +{
> > +     struct device_node *np = pdev->dev.of_node;
> > +     static const struct of_device_id *match;
> > +     struct uart_port *port;
> > +     struct esp32_port *sport;
> > +     struct resource *res;
> > +     int ret;
> > +
> > +     match = of_match_device(esp32_uart_dt_ids, &pdev->dev);
> > +     if (!match)
> > +             return -ENODEV;
> > +
> > +     sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL);
> > +     if (!sport)
> > +             return -ENOMEM;
> > +
> > +     port = &sport->port;
> > +
> > +     ret = of_alias_get_id(np, "serial");
> > +     if (ret < 0) {
> > +             dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> > +             return ret;
> > +     }
> > +     if (ret >= UART_NR) {
> > +             dev_err(&pdev->dev, "driver limited to %d serial ports\n", UART_NR);
> > +             return -ENOMEM;
> > +     }
> > +
> > +     port->line = ret;
> > +
> > +     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +     if (!res)
> > +             return -ENODEV;
> > +
> > +     port->mapbase = res->start;
> > +     port->membase = devm_ioremap_resource(&pdev->dev, res);
> > +     if (IS_ERR(port->membase))
> > +             return PTR_ERR(port->membase);
> > +
> > +     sport->clk = devm_clk_get(&pdev->dev, NULL);
> > +     if (IS_ERR(sport->clk))
> > +             return PTR_ERR(sport->clk);
> > +
> > +     port->uartclk = clk_get_rate(sport->clk);
> > +     port->dev = &pdev->dev;
> > +     port->type = PORT_ESP32UART;
> > +     port->iotype = UPIO_MEM;
> > +     port->irq = platform_get_irq(pdev, 0);
> > +     port->ops = &esp32_uart_pops;
> > +     port->flags = UPF_BOOT_AUTOCONF;
> > +     port->has_sysrq = 1;
> > +     port->fifosize = ESP32_UART_TX_FIFO_SIZE;
> > +     port->private_data = (void *)match->data;
>
> No need to cast.

This is again a const cast.

> > +
> > +     esp32_uart_ports[port->line] = sport;
> > +
> > +     platform_set_drvdata(pdev, port);
> > +
> > +     return uart_add_one_port(&esp32_uart_reg, port);
> > +}
>
> regards,
> --
> js
> suse labs
>
Greg Kroah-Hartman Sept. 28, 2023, 8:17 a.m. UTC | #3
On Tue, Sep 19, 2023 at 07:26:40PM -0700, Max Filippov wrote:
> uart_get_baud_rate has input parameters 'min' and 'max' limiting the
> range of acceptable baud rates from the caller's perspective. If neither
> current or old termios structures have acceptable baud rate setting and
> 9600 is not in the min/max range either the function returns 0 and
> issues a warning.
> However for a UART that does not support speed of 9600 baud this is
> expected behavior.
> Clarify that 0 can be (and always could be) returned from the
> uart_get_baud_rate. Don't issue a warning in that case.
> Move the warinng to the uart_get_divisor instead, which is often called
> with the uart_get_baud_rate return value.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  drivers/tty/serial/serial_core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 7bdc21d5e13b..a8e2915832e8 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -431,7 +431,7 @@ EXPORT_SYMBOL(uart_update_timeout);
>   * baud.
>   *
>   * If the new baud rate is invalid, try the @old termios setting. If it's still
> - * invalid, we try 9600 baud.
> + * invalid, we try 9600 baud. If that is also invalid 0 is returned.
>   *
>   * The @termios structure is updated to reflect the baud rate we're actually
>   * going to be using. Don't do this for the case where B0 is requested ("hang
> @@ -515,8 +515,6 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
>  							max - 1, max - 1);
>  		}
>  	}
> -	/* Should never happen */
> -	WARN_ON(1);

I'm ok with this removal, but:

>  	return 0;
>  }
>  EXPORT_SYMBOL(uart_get_baud_rate);
> @@ -539,6 +537,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
>  {
>  	unsigned int quot;
>  
> +	WARN_ON(baud == 0);

Why is this needed?  If this isn't happening today, then there's no need
to check for this here.  Or if it can happen, we should return an error,
not cause a possible reboot of the system if panic-on-warn is enabled.

thanks,

greg k-h
Max Filippov Sept. 28, 2023, 3:07 p.m. UTC | #4
On Thu, Sep 28, 2023 at 1:17 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Sep 19, 2023 at 07:26:40PM -0700, Max Filippov wrote:
> > @@ -539,6 +537,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
> >  {
> >       unsigned int quot;
> >
> > +     WARN_ON(baud == 0);
>
> Why is this needed?  If this isn't happening today, then there's no need
> to check for this here.

I'll drop it then.