From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Stefan Agner <stefan@agner.ch>
Cc: gregkh@linuxfoundation.org, lukas@wunner.de, jslaby@suse.com,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] serial: imx: warn user when using unsupported configuration
Date: Wed, 18 Apr 2018 16:53:41 +0200 [thread overview]
Message-ID: <20180418145341.xwsah7spyfazcb63@pengutronix.de> (raw)
In-Reply-To: <20180418140638.19331-1-stefan@agner.ch>
On Wed, Apr 18, 2018 at 04:06:38PM +0200, Stefan Agner wrote:
> When using half-duplex mode (which disables receiver during txing)
> the RTS signal cannot be driven low during transmission. This seems
> to be a limitation of the i.MX UART IP: The RTS (CTS_B) signal is
> controlled by the receiver. When the receiver is disabled, the
> signal stays in UART logic idle state which is high...
>
> If SER_RS485_RTS_ON_SEND is used, RTS needs to be high active during
> transmission. Since this is the default state of the RTS (CTS_B)
> signal when the receiver is off, half-duplex mode in this
> configuration works fine.
>
> However, a low-active RTS signal (flag SER_RS485_RTS_ON_SEND not set)
> cannot be generated when the receiver is turned off.
>
> Print an error if the user selects this unsupported configuration
> (both SER_RS485_RTS_ON_SEND and SER_RS485_RX_DURING_TX unset) and
> configure the closest working configuration (set the
> SER_RS485_RX_DURING_TX flag).
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> Changes since v1:
> - Consistently check for sport->have_rtscts && !(rs485conf->flags &
> SER_RS485_RTS_ON_SEND)
> - Don't break printed message
>
> drivers/tty/serial/imx.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 91f3a1a5cb7f..1c1080fc8084 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1833,6 +1833,11 @@ static int imx_uart_rs485_config(struct uart_port *port,
> rs485conf->flags &= ~SER_RS485_ENABLED;
>
> if (rs485conf->flags & SER_RS485_ENABLED) {
> + /* Enable receiver if low-active RTS signal is requested */
> + if (sport->have_rtscts &&
> + !(rs485conf->flags & SER_RS485_RTS_ON_SEND))
> + rs485conf->flags |= SER_RS485_RX_DURING_TX;
> +
I wonder what should happen, if the device tree has both
uart-has-rtscts;
rts-gpios = <...>;
. I think the right thing would be to check for
sport->have_rtscts && !sport->have_rtsgpio
.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2018-04-18 14:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 14:06 Stefan Agner
2018-04-18 14:53 ` Uwe Kleine-König [this message]
2018-04-18 15:30 ` Stefan Agner
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=20180418145341.xwsah7spyfazcb63@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=stefan@agner.ch \
/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
all inboxes | Powered by JetHome®