All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Tim Harvey <tharvey@gateworks.com>
Cc: "Richard Genoud" <richard.genoud@gmail.com>,
	"Tomasz Moń" <tomasz.mon@camlingroup.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Huang Shijie" <b32955@freescale.com>,
	"Dirk Behme" <dirk.behme@googlemail.com>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	linux-serial@vger.kernel.org
Subject: Re: Modem control lines for RTSCTS hardware flow control via rts-gpio and cts-gpio with IMX
Date: Sat, 12 Feb 2022 14:50:22 +0300	[thread overview]
Message-ID: <87k0e0z4ld.fsf@osv.gnss.ru> (raw)
In-Reply-To: <CAJ+vNU2ra8g90ZWcwS0xnRq3LO_4Q2PFJo-OuXuBgCpPsXcXkg@mail.gmail.com> (Tim Harvey's message of "Thu, 10 Feb 2022 13:30:33 -0800")

Tim Harvey <tharvey@gateworks.com> writes:


[...]

> I have found the issue here which causes hardware flow control when
> using GPIO's with the imx UART driver to fail. The
> imx_uart_set_termios() function clears the UCR2_IRTS whenver hardware
> flow control is enabled which configures the transmitter to only send
> with the RTS pin is asserted. In the case of a GPIO being used instead
> of the dedicated internal RTS pin for the uart, this will keep the
> transmitter from ever transmitting. In the hardware flow control case
> where a GPIO is used UCR2_IRTS must be set to ignore the RTS pin. We
> can use the have_rtsgpio flag which is set when 'rts-gpios' property
> is used as a qualifier for this.
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index df8a0c8b8b29..d506cbd679dd 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1674,8 +1674,7 @@ imx_uart_set_termios(struct uart_port *port,
> struct ktermios *termios,
>                 if (ucr2 & UCR2_CTS)
>                         ucr2 |= UCR2_CTSC;
>         }
> -
> -       if (termios->c_cflag & CRTSCTS)
> +       if (!sport->have_rtsgpio && termios->c_cflag & CRTSCTS)
>                 ucr2 &= ~UCR2_IRTS;
>         if (termios->c_cflag & CSTOPB)
>                 ucr2 |= UCR2_STPB;
>
> If this makes sense, I'll send a patch.

To me it does make sense. Driver should stay away from UCR2_IRTS indeed
if software (GPIO) RTS/CTS management is in use.

-- Sergey Organov

  reply	other threads:[~2022-02-12 11:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 23:55 Modem control lines for RTSCTS hardware flow control via rts-gpio and cts-gpio with IMX Tim Harvey
2022-01-14  3:08 ` Tim Harvey
2022-01-14  6:19   ` Tomasz Moń
2022-01-24  9:52     ` Richard Genoud
2022-01-27  0:00       ` Tim Harvey
2022-02-10 21:30         ` Tim Harvey
2022-02-12 11:50           ` Sergey Organov [this message]
2022-01-24 23:56     ` Tim Harvey
2022-01-25 10:17       ` Richard Genoud

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=87k0e0z4ld.fsf@osv.gnss.ru \
    --to=sorganov@gmail.com \
    --cc=b32955@freescale.com \
    --cc=dirk.behme@googlemail.com \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-serial@vger.kernel.org \
    --cc=richard.genoud@gmail.com \
    --cc=shawnguo@kernel.org \
    --cc=tharvey@gateworks.com \
    --cc=tomasz.mon@camlingroup.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.