All of lore.kernel.org
 help / color / mirror / Atom feed
* Directly accessing serial ports from drivers w/o TTYs ?
@ 2017-06-25 22:43 Enrico Weigelt, metux IT consult
  2017-06-26 14:51 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2017-06-25 22:43 UTC (permalink / raw)
  To: linux-kernel

Hi folks,


is there already a way for accessing serial ports from drivers,
w/o having to go through the TTY subsystem ?

Serdev seems provide a connection between arbitrary TTYs to device
drivers. But this implies always having a TTY for each UART (even if
it's never used outside the kernel).

Is there any way for accessing uarts more directly ?


--mtx

--
Enrico, Sohn von Wilfried, a.d.F. Weigelt,
metux IT consulting
+49-151-27565287

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

* Re: Directly accessing serial ports from drivers w/o TTYs ?
  2017-06-25 22:43 Directly accessing serial ports from drivers w/o TTYs ? Enrico Weigelt, metux IT consult
@ 2017-06-26 14:51 ` Alan Cox
  2017-06-29 11:44   ` Enrico Weigelt, metux IT consult
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2017-06-26 14:51 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult; +Cc: linux-kernel

On Mon, 26 Jun 2017 00:43:12 +0200
"Enrico Weigelt, metux IT consult" <enrico.weigelt@gr13.net> wrote:

> Hi folks,
> 
> 
> is there already a way for accessing serial ports from drivers,
> w/o having to go through the TTY subsystem ?
> 
> Serdev seems provide a connection between arbitrary TTYs to device
> drivers. But this implies always having a TTY for each UART (even if
> it's never used outside the kernel).
> 
> Is there any way for accessing uarts more directly ?

You can write your own driver for the physical hardware and claim it in
your driver. Shouldn't normally be needed except for bizarre cases when a
serial link is used for something very non tty like (eg as GPIO lines).

Otherwise all the low level tty device locking, queues and interfaces
assume there is a tty_struct attached to it, so yes you need a tty
struct.

Why do you need to do otherwise ?

Alan

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

* Re: Directly accessing serial ports from drivers w/o TTYs ?
  2017-06-26 14:51 ` Alan Cox
@ 2017-06-29 11:44   ` Enrico Weigelt, metux IT consult
  2017-06-30 17:23     ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2017-06-29 11:44 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On 26.06.2017 14:51, Alan Cox wrote:

Hi,

> You can write your own driver for the physical hardware and claim it in
> your driver. Shouldn't normally be needed except for bizarre cases when a
> serial link is used for something very non tty like (eg as GPIO lines).

In my case, it's not really a serial link, but an backplane w/ FIFOs, 
which looks like a serial ports to the host (AFAIK, historically coming
from older systems which actually had various serial controllers, eg.
rs232, rs485/mvb, etc). The backplane seems to simulate the lower
layers of an mvb network.

> Otherwise all the low level tty device locking, queues and interfaces
> assume there is a tty_struct attached to it, so yes you need a tty
> struct.

I was thinking about something that looks like serdev from consumer
side, but instead directly works on struct uart_port, w/o actually
allocating a tty (and also the funny things like signals, etc).

> Why do you need to do otherwise ?

Maybe it could offer better performance ?


--mtx

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

* Re: Directly accessing serial ports from drivers w/o TTYs ?
  2017-06-29 11:44   ` Enrico Weigelt, metux IT consult
@ 2017-06-30 17:23     ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2017-06-30 17:23 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult; +Cc: linux-kernel

> I was thinking about something that looks like serdev from consumer
> side, but instead directly works on struct uart_port, w/o actually
> allocating a tty (and also the funny things like signals, etc).

uart_port is only a subset of tty devices and also relies upon tty for
some of the locking and other behaviour.

> > Why do you need to do otherwise ?  
> 
> Maybe it could offer better performance ?

Unless you have very tight latency requirements I would be surprised if
you could do that much better even on a slow machine. If you don't need
tty semantics then you can probably beat it hands down by writing your
own custom driver for the hardware that doesn't pretend to be a tty in
the first place.

The cost in the tty stack is pretty much all the Unix tty API and POSIX
guarantees.

Alan

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

end of thread, other threads:[~2017-06-30 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-25 22:43 Directly accessing serial ports from drivers w/o TTYs ? Enrico Weigelt, metux IT consult
2017-06-26 14:51 ` Alan Cox
2017-06-29 11:44   ` Enrico Weigelt, metux IT consult
2017-06-30 17:23     ` Alan Cox

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.