public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v8 3/3] tty: 8250_omap: Use software emulated RS485 direction control
@ 2016-02-11 16:40 Ильяс Гасанов
  2016-02-11 19:08 ` Matwey V. Kornilov
  0 siblings, 1 reply; 11+ messages in thread
From: Ильяс Гасанов @ 2016-02-11 16:40 UTC (permalink / raw)
  To: Matwey V. Kornilov
  Cc: gregkh, jslaby, Peter Hurley, Andy Shevchenko, gnomes,
	linux-kernel, linux-serial

Hello,

2016-02-01 21:09 GMT+03:00 "Matwey V. Kornilov" <matwey@sai.msu.ru>:
> +static int omap_8250_rs485_config(struct uart_port *port,
> +                                 struct serial_rs485 *rs485)
> +{
> +       struct uart_8250_port *up = up_to_u8250p(port);
> +
> +       /* Clamp the delays to [0, 100ms] */
> +       rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U);
> +       rs485->delay_rts_after_send  = min(rs485->delay_rts_after_send, 100U);
> +
> +       port->rs485 = *rs485;
> +
> +       /*
> +        * Both serial8250_em485_init and serial8250_em485_destroy
> +        * are idempotent
> +        */
> +       if (rs485->flags & SER_RS485_ENABLED) {
> +               int ret = serial8250_em485_init(up);
> +
> +               if (ret) {
> +                       rs485->flags &= ~SER_RS485_ENABLED;
> +                       port->rs485.flags &= ~SER_RS485_ENABLED;
> +               }
> +               return ret;
> +       }
> +
> +       serial8250_em485_destroy(up);
> +
> +       return 0;
> +}

I think that an invocation of serial8250_em485_destroy() should be
performed inside omap8250_remove() as well. However there is a catch -
serial8250_get_port() is only reserved for suspend-resume power
management operations, and I am aware of no other means how to supply
an uart_8250_port to serial8250_em485_destroy() at that point.

Similarly, I got no idea on how to implement handling
"linux,rs485-enabled-at-boot-time" property without using
serial8250_get_port() directly (well, honestly I could try invoking
the corresponding ioctl somehow, but that's gonna be plain ugly at
least).

Regards,
Ilyas G.

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH v8 0/3] tty: Introduce software RS485 direction control support
@ 2016-02-01 18:09 Matwey V. Kornilov
  2016-02-01 18:09 ` [PATCH v8 3/3] tty: 8250_omap: Use software emulated RS485 direction control Matwey V. Kornilov
  0 siblings, 1 reply; 11+ messages in thread
From: Matwey V. Kornilov @ 2016-02-01 18:09 UTC (permalink / raw)
  To: gregkh, jslaby, peter, andy.shevchenko, gnomes
  Cc: Matwey V. Kornilov, linux-kernel, linux-serial

Changes from v7:
 - rework comments to follow guidelines
 - minor style changes
Changes from v6:
 - minor style changes
 - timers are not IRQSAFE now
Changes from v5:
 - rs485_emul variable has been renamed to em485 to follow function names convention
Changes from v4:
 - Add commit message to 1/3
Changes from v3:
 - Completely redesigned.
Changes from v2:
 - Introduced SER_RS485_SOFTWARE to show that software implementation is being used
 - serial8250_rs485_config is located as required
 - Timers are used to implement delay_before and delay_after timeouts

Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-02-18 18:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-11 16:40 [PATCH v8 3/3] tty: 8250_omap: Use software emulated RS485 direction control Ильяс Гасанов
2016-02-11 19:08 ` Matwey V. Kornilov
2016-02-11 20:19   ` Ильяс Гасанов
2016-02-12  7:57     ` Matwey V. Kornilov
2016-02-12  9:39       ` Ильяс Гасанов
2016-02-17 16:56         ` Ильяс Гасанов
2016-02-18  7:18           ` Ильяс Гасанов
2016-02-18  9:46             ` Ильяс Гасанов
2016-02-18 16:50               ` Peter Hurley
2016-02-18 18:15                 ` Ильяс Гасанов
  -- strict thread matches above, loose matches on Subject: below --
2016-02-01 18:09 [PATCH v8 0/3] tty: Introduce software RS485 direction control support Matwey V. Kornilov
2016-02-01 18:09 ` [PATCH v8 3/3] tty: 8250_omap: Use software emulated RS485 direction control Matwey V. Kornilov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox