public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Laurent Pinchart <laurentp@cse-semaphore.com>,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH/RFC] 8250: Auto RS485 direction control
Date: Thu, 24 Jul 2008 13:24:02 +0100	[thread overview]
Message-ID: <20080724122402.GC9327@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20080724125706.19844a96@lxorguk.ukuu.org.uk>

On Thu, Jul 24, 2008 at 12:57:06PM +0100, Alan Cox wrote:
> On Thu, 24 Jul 2008 13:47:29 +0200
> Laurent Pinchart <laurentp@cse-semaphore.com> wrote:
> 
> > This patch adds support for the automatic RS485 direction control feature
> > present in 16850 UARTs.
> > 
> > A new termios c_cflag, CARTS, is introduced to configure automatic direction
> > control from userspace.
> > 
> > This is a first proposal. I'm open to suggestions regarding the CARTS name.
> > I assume the CARTS flag will have to be added to all asm/termbits.h headers.
> > Why are the termios bits definitions platform specific ?
> 
> Because many of them are made to match up with the existing previous
> OS on those systems (eg to match with Alpha OSF).
> 
> I've no fundamental objection to this but I do wonder whether this
> feature belongs in setserial rather than termios as it is so chip
> specific ?

It may be specific to certain chips, but of those drivers which support
hardware RS485 modes to date, everyone has invented their own ioctl to
switch to RS485 mode.  There's no unification between any of the serial
drivers for this.

On devices which don't support hardware RS485, what should be done is
the termios bit remains clear, so that programs can tell if the port
doesn't support it (as per POSIX.)

I would also stress that this feature should be limited to enabling
_hardware_ RS485 support, and not software emulation of that.  The
reason being is that with plain 16550 UARTs, the best you can do 
with interrupts is to know when the last character is transferred out
of the transmit holding register into the transmit shift register - in
other words, before the last character has finished transmission.

Knowing when that character has been transmitted involves polling the
LSR - and having the kernel sit in a loop waiting for that event is
extremely wasteful.  Scheduling to other processes... well, you don't
know if there's some timing constraint - eg, must deassert RTS 1us
after the stop bit of the last character.

Basically, software RS485 is very yucky, and we've always resisted
having that support in the kernel.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

  reply	other threads:[~2008-07-24 12:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 11:47 [PATCH/RFC] 8250: Auto RS485 direction control Laurent Pinchart
2008-07-24 11:57 ` Alan Cox
2008-07-24 12:24   ` Russell King [this message]
2008-07-24 12:27     ` Alan Cox
2008-07-24 12:52       ` Russell King
2008-07-24 13:00         ` Alan Cox
2008-07-24 13:18         ` Laurent Pinchart
2008-07-24 14:13         ` Matt Schulte
2008-07-24 14:47           ` Russell King
2008-07-24 12:10 ` Russell King
2008-08-04 14:14 ` Tosoni
2008-08-04 14:22   ` Grant Edwards
2008-08-04 14:36   ` Laurent Pinchart
2008-08-04 16:15     ` Grant Edwards
2008-08-04 16:21       ` Grant Edwards
2008-08-05  9:41       ` Laurent Pinchart
2008-08-05 12:55         ` Tosoni
2008-08-06 14:30           ` Christopher Gibson
2008-08-06 16:33             ` Tosoni
2008-08-09 10:08               ` Christopher Gibson
2008-08-07  8:50             ` Laurent Pinchart
2008-08-07 13:50               ` Grant Edwards
2008-08-10  3:49               ` Christopher Gibson
2008-08-10  3:57               ` Christopher Gibson
2008-08-29 12:22                 ` Christopher Gibson
2008-12-02 13:09                 ` [PATCH/RFC] " Christopher Gibson
2008-12-04 11:14                   ` Christopher Gibson
2008-08-04 16:47     ` [PATCH/RFC] 8250: " Tosoni
2008-08-04 17:46       ` Grant Edwards
2008-08-04 20:59         ` Matt Schulte
2008-08-05  9:23         ` Laurent Pinchart
2008-08-05  9:34         ` Tosoni

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=20080724122402.GC9327@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=laurentp@cse-semaphore.com \
    --cc=linux-serial@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