Re: How to add uart driver for /dev/ttyS1

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

 



Am Mittwoch, den 15.07.2009, 11:44 +0800 schrieb vichy:
> 2009/7/14, Martyn Welch <martyn.welch@xxxxxxxxxxx>:
> > vichy wrote:
> >
> > > 2009/7/14, Martyn Welch <martyn.welch@xxxxxxxxxxx>:
> > >
> > > > vichy wrote:
> > > >
> > > >
> > > > > Dear all:
> > > > > while tracing 8250.c, serial8250_init, I find all the ports are
> > > > > assigned with the same uart_driver 8250 as below:
> > > > > static struct uart_driver serial8250_reg = {
> > > > >       .owner                  = THIS_MODULE,
> > > > >       .driver_name            = "serial",
> > > > >       .dev_name               = "ttyS",
> > > > >       .major                  = TTY_MAJOR,
> > > > >       .minor                  = 64,
> > > > >       .nr                     = UART_NR,
> > > > >       .cons                   = SERIAL8250_CONSOLE,
> > > > > };
> > > > >
> > > > > what make me curious is the minor# above is 64, but the minor number
> > > > > of /dev/ttyS1 is 65.
> > > > >
> > > > >
> > > > >
> > > >  Numbering starts at 0, the first serial port (/dev/ttyS0) is assigned
> > minor
> > > > 64.
> > > >
> > > hi:
> > > Thanks for your reminding.
> > > What makes me curious is how kernel connect /dev/ttyS1 with serial driver?
> > > By port number or minor number?
> > >
> > > I can see the minor of /dev/ttyS0 is 64, and serial driver is also
> > > register as minor 64.
> > > But what about /dev/ttyS1?
> > >
> >
> >  Ah, I think I understand. The above structure is related to the 8250
> > driver, which is shared by all of the serial ports conforming to the "8250
> > type" of serial port.
> >
> >  Looking at serial8250_register_port()
> > (http://lxr.linux.no/linux+v2.6.30/drivers/serial/8250.c#L3075),
> > which seems to be where individual ports are registered, there is an array
> > of type "uart_8250_port"
> > (http://lxr.linux.no/linux+v2.6.30/drivers/serial/8250.c#L2632)
> > which holds data pertaining to a specific port, which is then registered
> > with the serial core
> > (http://lxr.linux.no/linux+v2.6.30/drivers/serial/8250.c#L3116).
> Hi:
> thanks for your help.
> I have 2 8250 serial devices.
> and I want /dev/S1 to use the second 8250 device.
> Should I
> 1. registering 2 ports in kernel and kernel will connect it to
> /dev/ttyS1 automatically.
> 2. Or call 8250_init twice with and register uart_driver with minor number = 65?
> 
> if 1 is correct, can I boldly say the minor number of tty driver is meaningless?
> if 2 is correct, what is the correct dev node we should create in /dev
> about port2?


hi,

I do not really understand your problem.

tr@fuckup:~/work$ ls -al /dev/ttyS*
crw-rw---- 1 root dialout 4, 64 2009-07-12 14:46 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 2009-07-12 14:46 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 2009-07-12 14:46 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 2009-07-12 14:46 /dev/ttyS3

???

sincerely
TR



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux