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

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

 



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).

Martyn

appreciate your kind help,
vichy

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



--
Martyn Welch MEng MPhil MIET (Principal Software Engineer)   T:+44(0)127322748
GE Fanuc Intelligent Platforms Ltd,        |Registered in England and Wales
Tove Valley Business Park, Towcester,      |(3828642) at 100 Barbirolli Square,
Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB  VAT:GB 927559189

--
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