linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Tony Lindgren <tony@atomide.com>, Felipe Balbi <balbi@ti.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH 5/6] tty: serial: 8250-core: add rs485 support
Date: Thu, 10 Jul 2014 17:55:08 +0200	[thread overview]
Message-ID: <53BEB75C.70304@linutronix.de> (raw)
In-Reply-To: <20140709190143.GF17769@csclub.uwaterloo.ca>

On 07/09/2014 09:01 PM, Lennart Sorensen wrote:
>> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
>> index c7c3bf7..bf06a4c 100644
>> --- a/drivers/tty/serial/8250/8250_core.c
>> +++ b/drivers/tty/serial/8250/8250_core.c
>> @@ -1281,10 +1283,34 @@ static void autoconfig_irq(struct uart_8250_port *up)
>>  
>>  static inline void __stop_tx(struct uart_8250_port *p)
>>  {
>> +	if (p->rs485.flags & SER_RS485_ENABLED) {
>> +		int ret;
>> +
>> +		ret = (p->rs485.flags & SER_RS485_RTS_AFTER_SEND) ? 1 : 0;
>> +		if (gpio_get_value(p->rts_gpio) != ret) {
>> +			if (p->rs485.delay_rts_after_send > 0)
>> +				mdelay(p->rs485.delay_rts_after_send);
>> +			gpio_set_value(p->rts_gpio, ret);
> 
> Usually the delay for RS485 is done in bit times, not msec.  Not sure
> how you expect this to work.  Not sure doing it in software is precise
> enough either.  It probably should be calculated based on the current
> baudrate with a bit time rather than msec in the DT data.  No one wants
> to have to change the DT data to change the baud rate.  After all this
> is very often used with modbus and the modbus rules specify turn around
> times in bit times.

My understanding is that this is not baudrate related. This is the
delay that the hardware (the transceiver) to perform the change and
work.
There is the ioctl() interface which can change the delay, too. The
only required thing is the gpio.

> I hope TI puts this into the UART in future designs where it belongs
> (similar to what Exar and many others already did).
> 

Sebastian

  reply	other threads:[~2014-07-10 15:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 17:49 (unknown), Sebastian Andrzej Siewior
2014-07-09 17:49 ` [PATCH 1/6] tty: serial: 8250 core: provide a function to export uart_8250_port Sebastian Andrzej Siewior
2014-07-10 14:30   ` Olivier Galibert
2014-07-16  8:22     ` Sebastian Andrzej Siewior
2014-07-09 17:49 ` [PATCH 2/6] tty: serial: 8250 core: allow to overwrite & export serial8250_startup() Sebastian Andrzej Siewior
2014-07-10 14:54   ` One Thousand Gnomes
2014-07-10 14:55   ` Sebastian Andrzej Siewior
2014-07-09 17:49 ` [PATCH 3/6] tty: serial: 8250 core: add runtime pm Sebastian Andrzej Siewior
2014-07-10  6:28   ` Tony Lindgren
2014-07-16  8:26     ` Sebastian Andrzej Siewior
2014-07-21 13:34   ` Mika Westerberg
2014-07-09 17:49 ` [PATCH 4/6] tty: serial: 8250-core: reorder serial8250_stop_rx() & serial8250_start_tx() Sebastian Andrzej Siewior
2014-07-09 17:49 ` [PATCH 5/6] tty: serial: 8250-core: add rs485 support Sebastian Andrzej Siewior
2014-07-09 19:01   ` Lennart Sorensen
2014-07-10 15:55     ` Sebastian Andrzej Siewior [this message]
2014-07-10 14:52   ` One Thousand Gnomes
2014-07-09 17:49 ` [PATCH 6/6] tty: serial: Add 8250-core based omap driver Sebastian Andrzej Siewior
2014-07-10  7:09   ` Tony Lindgren
2014-07-10 15:47     ` Sebastian Andrzej Siewior
2014-07-10 16:03       ` Carlos Hernandez
2014-07-10 16:14         ` menon.nishanth
2014-07-11  6:41       ` Tony Lindgren
2014-07-16 12:11         ` Sebastian Andrzej Siewior
2014-07-16 12:32           ` Tony Lindgren
2014-07-16 13:00             ` Sekhar Nori
2014-08-08 11:05   ` Heikki Krogerus
2014-07-09 17:58 ` [RFC v3] 8250-core based serial driver for OMAP Sebastian Andrzej Siewior

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=53BEB75C.70304@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=balbi@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lsorense@csclub.uwaterloo.ca \
    --cc=tony@atomide.com \
    /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).