linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH 3/3] tty: serial: use uart_port_tx_limit() helper
Date: Mon, 29 Aug 2022 10:50:37 +0200	[thread overview]
Message-ID: <20220829085037.ec6qdrklgy4cbmym@pali> (raw)
In-Reply-To: <0a1f4ce9-4158-b8ab-1837-68da06f20407@kernel.org>

On Monday 29 August 2022 09:27:01 Jiri Slaby wrote:
> On 11. 04. 22, 13:51, Pali Rohár wrote:
> > On Monday 11 April 2022 12:54:05 Jiri Slaby wrote:
> > > uart_port_tx_limit() is a new helper to send characters to the device.
> > > Use it in these drivers.
> > > 
> > > It means we have to define two new uart hooks: tx_ready() and put_char()
> > > to do the real job now.
> > > 
> > > And 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@suse.cz>
> > > Cc: Russell King <linux@armlinux.org.uk>
> > > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > Cc: bcm-kernel-feedback-list@broadcom.com
> > > Cc: "Pali Rohár" <pali@kernel.org>
> > > Cc: Kevin Cernekee <cernekee@gmail.com>
> > > Cc: Palmer Dabbelt <palmer@dabbelt.com>
> > > Cc: Paul Walmsley <paul.walmsley@sifive.com>
> > > Cc: Orson Zhai <orsonzhai@gmail.com>
> > > Cc: Baolin Wang <baolin.wang7@gmail.com>
> > > Cc: Chunyan Zhang <zhang.lyra@gmail.com>
> > > Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> > > Cc: linux-riscv@lists.infradead.org
> > > ---
> > >   drivers/tty/serial/21285.c           | 40 +++++++--------------
> > >   drivers/tty/serial/altera_jtaguart.c | 43 ++++++----------------
> > >   drivers/tty/serial/amba-pl010.c      | 40 ++++-----------------
> > >   drivers/tty/serial/apbuart.c         | 37 ++++---------------
> > >   drivers/tty/serial/bcm63xx_uart.c    | 48 ++++++-------------------
> > >   drivers/tty/serial/mux.c             | 48 ++++++++-----------------
> > >   drivers/tty/serial/mvebu-uart.c      | 47 +++++++-----------------
> > >   drivers/tty/serial/omap-serial.c     | 53 +++++++---------------------
> > >   drivers/tty/serial/pxa.c             | 43 +++++-----------------
> > >   drivers/tty/serial/rp2.c             | 36 ++++++-------------
> > >   drivers/tty/serial/serial_txx9.c     | 40 ++++-----------------
> > >   drivers/tty/serial/sifive.c          | 48 ++++---------------------
> > >   drivers/tty/serial/sprd_serial.c     | 41 ++++-----------------
> > >   drivers/tty/serial/st-asc.c          | 51 ++++----------------------
> > >   drivers/tty/serial/vr41xx_siu.c      | 42 ++++------------------
> > >   15 files changed, 143 insertions(+), 514 deletions(-)
> > ...
> > > diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
> > > index 0429c2a54290..3d07ab9eb15e 100644
> > > --- a/drivers/tty/serial/mvebu-uart.c
> > > +++ b/drivers/tty/serial/mvebu-uart.c
> > > @@ -194,6 +194,16 @@ static unsigned int mvebu_uart_tx_empty(struct uart_port *port)
> > >   	return (st & STAT_TX_EMP) ? TIOCSER_TEMT : 0;
> > >   }
> > > +static bool mvebu_uart_tx_ready(struct uart_port *port)
> > > +{
> > > +	return !(readl(port->membase + UART_STAT) & STAT_TX_FIFO_FUL);
> > 
> > mvebu-uart.c driver in its tx_ready function should probably use
> > STAT_TX_RDY macro (access to STAT_TX_RDY bit in register).
> > 
> > Documentation for UART1 (STD) about this bit says:
> > 
> > This bit is set when TRANS_HLD (our UART_TSH macro) is empty and ready
> > for the CPU to write the next character to be transmitted out. The TSR
> > can still shift out the previous character when this bit is set. This
> > bit is cleared when the CPU writes to TRANS_HLD.
> > 
> > For UART2 (EXT) there is just information: UART Tx Ready for 1 Byte
> > Write. UART2 (EXT) has also bit (bit 5) which indicates that CPU can
> > load 4 bytes, but seems that this is not used by mvebu-uart.c driver.
> > 
> > Macro STAT_TX_RDY() is polled also in wait_for_xmitr() function.
> 
> Hi,
> so care to send fixes for the two issues :)? The series is not meant to
> change behavior...

Ok, I will look at it after your patches are merged to prevent merge conflicts.

      reply	other threads:[~2022-08-29  8:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 10:54 [PATCH 0/3] tty: TX helpers Jiri Slaby
2022-04-11 10:54 ` [PATCH 1/3] tty: serial: introduce uart_port_tx{,_limit}() helpers Jiri Slaby
2022-04-14 16:32   ` Greg KH
2022-04-15  7:47     ` Jiri Slaby
2022-04-15  8:42       ` Greg KH
2022-04-11 10:54 ` [PATCH 2/3] tty: serial: use uart_port_tx() helper Jiri Slaby
2022-04-11 10:54 ` [PATCH 3/3] tty: serial: use uart_port_tx_limit() helper Jiri Slaby
2022-04-11 11:51   ` Pali Rohár
2022-08-29  7:27     ` Jiri Slaby
2022-08-29  8:50       ` Pali Rohár [this message]

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=20220829085037.ec6qdrklgy4cbmym@pali \
    --to=pali@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).