From: Michael Walle <michael@walle.cc>
To: jirislaby@kernel.org
Cc: afaerber@suse.de, alexandre.belloni@bootlin.com,
claudiu.beznea@microchip.com, festevam@gmail.com,
gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com,
kernel@pengutronix.de, linux-imx@nxp.com,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
liviu.dudau@arm.com, lorenzo.pieralisi@arm.com, mani@kernel.org,
nicolas.ferre@microchip.com, richard.genoud@gmail.com,
s.hauer@pengutronix.de, shawnguo@kernel.org,
sudeep.holla@arm.com, tklauser@distanz.ch, vz@mleia.com
Subject: Re: [PATCH v5 2/3] tty: serial: use uart_port_tx() helper
Date: Mon, 21 Nov 2022 21:27:24 +0100 [thread overview]
Message-ID: <20221121202724.1708460-1-michael@walle.cc> (raw)
In-Reply-To: <20221004104927.14361-3-jirislaby@kernel.org>
From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Hi Jiri,
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index bd07f79a2df9..a6b4d30c5888 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -824,30 +824,14 @@ static void atmel_rx_chars(struct uart_port *port)
> */
> static void atmel_tx_chars(struct uart_port *port)
> {
> - struct circ_buf *xmit = &port->state->xmit;
> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
> + bool pending;
> + u8 ch;
>
> - if (port->x_char &&
> - (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) {
> - atmel_uart_write_char(port, port->x_char);
> - port->icount.tx++;
> - port->x_char = 0;
> - }
> - if (uart_circ_empty(xmit) || uart_tx_stopped(port))
> - return;
> -
> - while (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY) {
> - atmel_uart_write_char(port, xmit->buf[xmit->tail]);
> - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> - port->icount.tx++;
> - if (uart_circ_empty(xmit))
> - break;
> - }
> -
> - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> - uart_write_wakeup(port);
> -
> - if (!uart_circ_empty(xmit)) {
> + pending = uart_port_tx(port, ch,
> + atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY,
> + atmel_uart_write_char(port, ch));
> + if (pending) {
> /* we still have characters to transmit, so we should continue
> * transmitting them when TX is ready, regardless of
> * mode or duplexity
This will break serial output for the userspace on my board
(arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt*dts). The uart_port_tx()
helper will call __port->ops->stop_tx(__port) if uart_circ_chars_pending()
returns 0. But the code above, doesn't do that. In fact, removing the
stop_tx() call in the helper macro, will fix the console output.
Any ideas how to fix that?
-michael
next prev parent reply other threads:[~2022-11-21 20:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 10:49 [PATCH v5 0/3] tty: TX helpers Jiri Slaby (SUSE)
2022-10-04 10:49 ` [PATCH v5 1/3] tty: serial: introduce transmit helpers Jiri Slaby (SUSE)
2022-10-04 10:49 ` [PATCH v5 2/3] tty: serial: use uart_port_tx() helper Jiri Slaby (SUSE)
2022-11-21 20:27 ` Michael Walle [this message]
2022-11-22 7:02 ` Jiri Slaby
2022-11-22 8:09 ` Michael Walle
2022-11-22 8:18 ` Michael Walle
2022-11-22 8:23 ` Jiri Slaby
2022-11-22 8:25 ` Jiri Slaby
2022-11-22 9:13 ` Michael Walle
2022-10-04 10:49 ` [PATCH v5 3/3] tty: serial: use uart_port_tx_limited() Jiri Slaby (SUSE)
2022-10-04 10:49 ` Jiri Slaby (SUSE)
2022-10-04 11:22 ` Ilpo Järvinen
2022-10-04 11:22 ` Ilpo Järvinen
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=20221121202724.1708460-1-michael@walle.cc \
--to=michael@walle.cc \
--cc=afaerber@suse.de \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=mani@kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=richard.genoud@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=tklauser@distanz.ch \
--cc=vz@mleia.com \
/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.