Re: pty for real device ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 04, 2019 at 06:09:44PM +0200, Ranran wrote:
> On Fri, Jan 4, 2019 at 9:57 AM Greg KH <greg@xxxxxxxxx> wrote:
> >
> > On Fri, Jan 04, 2019 at 08:48:25AM +0200, Ranran wrote:
> > > Hello,
> > >
> > > I would like to ask if it make sense to create pty for a serial real device.
> > >
> > > The full story:
> > > I have FPGA behind PCIe with several devices: serial, i2c and others.
> > > I thought of implementing in userspace the device driver using
> > > uio_pci_generic (it's basically memory access and interrupts for
> > > serial).
> > > Now if we need the serial to be like a regular serial in Linux, then I
> > > can use the pty with the serial userspace implementation, and then the
> > > we get pty device node which can be treated just as a regular tty,
> > > Right ?
> > >
> > > Does it make sense to use pty this way with a real device ?
> >
> > If your fpga has a uart on it, why not just use a real kernel driver to
> > control it?  It will be much easier in the long-run that way instead of
> > trying to fake it all in userspace.
> >
> The FPGA has several devices mapped to pci with one vector table for
> all these fpga devices.

So individual PCI devices?  Or one PCI device with different BARs for
the different devices?

If it's a FPGA, you should be able to reprogram it to look like a
standard UART device, that way no kernel changes are needed at all.  I
recommend doing that as it's the easiest way in the long-term.

> Is a platform driver should be used to connect tha uart and the
> canbus, each to its pci driver or is it best to write one single pci
> driver for all these devices and register each device (uart, canbus)
> seperately in the custom pci driver?

It all depends on how you have to talk to your device, but if it is PCI,
it's not a platform device, it's a PCI device.  Don't abuse platform
devices :)

good luck,

greg k-h



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux