From: Johan Hovold <johan@kernel.org>
To: Brant Merryman <Brant.Merryman@silabs.com>
Cc: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Richard Hendricks <Richard.Hendricks@silabs.com>
Subject: Re: [PATCH] Proper RTS control when buffers fill
Date: Tue, 7 Jan 2020 11:49:50 +0100 [thread overview]
Message-ID: <20200107104950.GD30908@localhost> (raw)
In-Reply-To: <4C7B31CD-2DD2-4824-AE67-9280199703BE@silabs.com>
On Wed, Dec 18, 2019 at 08:40:48PM +0000, Brant Merryman wrote:
You forgot to add the Subject prefix.
> CP210x hardware disables auto-RTS but leaves auto-CTS when
> in hardware flow control mode and UART on cp210x hardware
> is disabled. This allows data to flow out, but new data
> will not come into the port. When re-opening the port, if
> auto-CTS is enabled on the cp210x, then auto-RTS must be
> re-enabled in the driver.
>
> Signed-off-by: Brant Merryman <brant.merryman@silabs.com>
> ---
> drivers/usb/serial/cp210x.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
> index bcceb4ad8be0..74c9f3822bd2 100644
> --- a/drivers/usb/serial/cp210x.c
> +++ b/drivers/usb/serial/cp210x.c
> @@ -917,6 +917,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
> u32 baud;
> u16 bits;
> u32 ctl_hs;
> + u32 flow_repl;
>
> cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, &baud);
>
> @@ -1015,8 +1016,24 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
> cp210x_read_reg_block(port, CP210X_GET_FLOW, &flow_ctl,
> sizeof(flow_ctl));
> ctl_hs = le32_to_cpu(flow_ctl.ulControlHandshake);
> + flow_repl = le32_to_cpu(flow_ctl.ulFlowReplace);
Move inside the if block (after the comment).
> if (ctl_hs & CP210X_SERIAL_CTS_HANDSHAKE) {
> dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
> + /*
> + * CP210x hardware disables auto-RTS but leaves auto-CTS when
> + * in hardware flow control mode and UART on cp210x hardware
> + * is disabled. This allows data to flow out, but new data
> + * will not come into the port. When re-opening the port, if
> + * auto-CTS is enabled on the cp210x, then auto-RTS must be
> + * re-enabled in the driver.
> + */
Maybe drop the "allows data to flow out" bit, the uart has been disabled
after all, right? And RTS is asserted on open by the TTY layer anyway so
data should flow in once opened.
As I asked you before, could you be more specific about what state
RTS-line end up in when disabling the UART (e.g. 0x00: statically
inactive)?
> + flow_repl &= ~CP210X_SERIAL_RTS_MASK;
> + flow_repl |= CP210X_SERIAL_RTS_SHIFT(CP210X_SERIAL_RTS_FLOW_CTL);
> +
> + flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs);
Again, this line is not needed.
> + flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl);
> + cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, sizeof(flow_ctl));
You still need to break this line.
> +
> cflag |= CRTSCTS;
> } else {
> dev_dbg(dev, "%s - flow control = NONE\n", __func__);
Johan
next prev parent reply other threads:[~2020-01-07 10:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 20:40 [PATCH] Proper RTS control when buffers fill Brant Merryman
2020-01-07 10:49 ` Johan Hovold [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-12-09 19:17 Brant Merryman
2019-12-16 14:28 ` Johan Hovold
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=20200107104950.GD30908@localhost \
--to=johan@kernel.org \
--cc=Brant.Merryman@silabs.com \
--cc=Richard.Hendricks@silabs.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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).