[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2653c92-1769-fc7c-8ad8-abf34affef6b@linux.intel.com>
Date: Tue, 20 Sep 2022 12:19:08 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Jiri Slaby <jslaby@...e.cz>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-serial <linux-serial@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Russell King <linux@...linux.org.uk>,
Florian Fainelli <f.fainelli@...il.com>,
bcm-kernel-feedback-list@...adcom.com,
Pali Rohár <pali@...nel.org>,
Kevin Cernekee <cernekee@...il.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang7@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Patrice Chotard <patrice.chotard@...s.st.com>,
linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v4 10/10] tty: serial: use uart_port_tx_limited()
On Tue, 20 Sep 2022, Jiri Slaby wrote:
> uart_port_tx_limited() is a new helper to send characters to the device.
> Use it in these drivers.
>
> mux.c also needs to define tx_done(). But I'm not sure if the driver
> really wants to wait for all the characters to dismiss from the HW fifo
> at this code point. Hence I marked this as FIXME.
>
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> Cc: Russell King <linux@...linux.org.uk>
> Cc: Florian Fainelli <f.fainelli@...il.com>
> Cc: bcm-kernel-feedback-list@...adcom.com
> Cc: "Pali Rohár" <pali@...nel.org>
> Cc: Kevin Cernekee <cernekee@...il.com>
> Cc: Palmer Dabbelt <palmer@...belt.com>
> Cc: Paul Walmsley <paul.walmsley@...ive.com>
> Cc: Orson Zhai <orsonzhai@...il.com>
> Cc: Baolin Wang <baolin.wang7@...il.com>
> Cc: Chunyan Zhang <zhang.lyra@...il.com>
> Cc: Patrice Chotard <patrice.chotard@...s.st.com>
> Cc: linux-riscv@...ts.infradead.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
One improvement suggestion below.
> diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
> index 23f339757894..f224f5141726 100644
> --- a/drivers/tty/serial/altera_jtaguart.c
> +++ b/drivers/tty/serial/altera_jtaguart.c
> @@ -137,39 +137,17 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp)
> static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp)
> {
> struct uart_port *port = &pp->port;
> - struct circ_buf *xmit = &port->state->xmit;
> - unsigned int pending, count;
> -
> - if (port->x_char) {
> - /* Send special char - probably flow control */
> - writel(port->x_char, port->membase + ALTERA_JTAGUART_DATA_REG);
> - port->x_char = 0;
> - port->icount.tx++;
> - return;
> - }
> + unsigned int space;
> + u8 ch;
>
> - pending = uart_circ_chars_pending(xmit);
> - if (pending > 0) {
> - count = (readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) &
> - ALTERA_JTAGUART_CONTROL_WSPACE_MSK) >>
> - ALTERA_JTAGUART_CONTROL_WSPACE_OFF;
> - if (count > pending)
> - count = pending;
> - if (count > 0) {
> - pending -= count;
> - while (count--) {
> - writel(xmit->buf[xmit->tail],
> - port->membase + ALTERA_JTAGUART_DATA_REG);
> - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> - port->icount.tx++;
> - }
> - if (pending < WAKEUP_CHARS)
> - uart_write_wakeup(port);
> - }
> - }
> + space = readl(port->membase + ALTERA_JTAGUART_CONTROL_REG);
> + space &= ALTERA_JTAGUART_CONTROL_WSPACE_MSK;
> + space >>= ALTERA_JTAGUART_CONTROL_WSPACE_OFF;
This is FIELD_GET(ALTERA_JTAGUART_CONTROL_WSPACE_MSK, ...) & then allows
killing ALTERA_JTAGUART_CONTROL_WSPACE_OFF. I'd probably do it in a
separate patch though.
--
i.
Powered by blists - more mailing lists