From: Peter Hurley <peter@hurleysoftware.com>
To: "Matwey V. Kornilov" <matwey@sai.msu.ru>
Cc: gregkh@linuxfoundation.org, jslaby@suse.com,
andy.shevchenko@gmail.com, gnomes@lxorguk.ukuu.org.uk,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v6 3/3] tty: 8250_omap: Use software emulated RS485 direction control
Date: Fri, 15 Jan 2016 08:32:50 -0800 [thread overview]
Message-ID: <56991F32.1030505@hurleysoftware.com> (raw)
In-Reply-To: <1450722379-13438-4-git-send-email-matwey@sai.msu.ru>
On 12/21/2015 10:26 AM, Matwey V. Kornilov wrote:
> Use software emulated RS485 direction control to provide RS485 API existed in
> omap_serial driver. Note that 8250_omap issues interrupt on shift register
> empty which is single prerequesite for using software emulated RS485.
Again, sorry for the long delay; comments below.
> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
> ---
> drivers/tty/serial/8250/8250_omap.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 826c5c4..323c0a4 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -698,6 +698,23 @@ static void omap_8250_throttle(struct uart_port *port)
> pm_runtime_put_autosuspend(port->dev);
> }
>
> +static int omap_8250_rs485_config(struct uart_port *port, struct serial_rs485 *rs485)
> +{
> + struct uart_8250_port *up = up_to_u8250p(port);
> +
> + if (rs485->flags & SER_RS485_ENABLED && !serial8250_em485_enabled(up)) {
> + port->rs485 = *rs485;
Please clamp the delay values to something reasonable; 100ms?
> + return serial8250_em485_init(up);
> + }
> +
> + if (serial8250_em485_enabled(up) && !(rs485->flags & SER_RS485_ENABLED))
> + serial8250_em485_destroy(up);
> +
> + port->rs485 = *rs485;
This logic seems a little convoluted; you're checking the state here but
then you're re-checking the state in init/destroy.
Regards,
Peter Hurley
> +
> + return 0;
> +}
> +
> static void omap_8250_unthrottle(struct uart_port *port)
> {
> unsigned long flags;
> @@ -1144,6 +1161,7 @@ static int omap8250_probe(struct platform_device *pdev)
> up.port.shutdown = omap_8250_shutdown;
> up.port.throttle = omap_8250_throttle;
> up.port.unthrottle = omap_8250_unthrottle;
> + up.port.rs485_config = omap_8250_rs485_config;
>
> if (pdev->dev.of_node) {
> const struct of_device_id *id;
>
prev parent reply other threads:[~2016-01-15 16:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 18:26 [PATCH v6 0/3] tty: Introduce software RS485 direction control support Matwey V. Kornilov
2015-12-21 18:26 ` [PATCH v6 1/3] tty: Move serial8250_stop_rx in front of serial8250_start_tx Matwey V. Kornilov
2015-12-21 18:26 ` [PATCH v6 2/3] tty: Add software emulated RS485 support for 8250 Matwey V. Kornilov
2016-01-15 16:14 ` Peter Hurley
2016-01-15 16:40 ` Peter Hurley
2016-01-15 18:42 ` Matwey V. Kornilov
2016-01-15 19:45 ` Peter Hurley
2016-01-15 20:01 ` Matwey V. Kornilov
2016-01-15 21:16 ` Matwey V. Kornilov
2016-01-15 22:17 ` Peter Hurley
2016-01-16 8:12 ` Matwey V. Kornilov
2016-01-16 18:56 ` Peter Hurley
2016-01-16 20:28 ` Matwey V. Kornilov
2016-01-15 20:20 ` Matwey V. Kornilov
2016-01-15 21:54 ` Peter Hurley
2015-12-21 18:26 ` [PATCH v6 3/3] tty: 8250_omap: Use software emulated RS485 direction control Matwey V. Kornilov
2016-01-15 16:32 ` Peter Hurley [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=56991F32.1030505@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=andy.shevchenko@gmail.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=matwey@sai.msu.ru \
/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.