Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1310263

Re: [PATCH v6 3/3] tty: 8250_omap: Use software emulated RS485 direction control

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject Re: [PATCH v6 3/3] tty: 8250_omap: Use software emulated RS485 direction control
Date 2016-01-15 17:40 +0100
Message-ID <qRfzR-gk-27@gated-at.bofh.it> (permalink)
References <qIdnA-1xE-23@gated-at.bofh.it> <qIdnA-1xE-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;
> 

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v6 3/3] tty: 8250_omap: Use software emulated RS485  direction control Peter Hurley <peter@hurleysoftware.com> - 2016-01-15 17:40 +0100

csiph-web