- 论坛徽章:
- 0
|
本帖最后由 yv9200 于 2015-04-22 12:53 编辑
内核代码版本3.10.17,代码在driver/tty/serial/8250/8250_core.c中
static void autoconfig_16550a(struct uart_8250_port *up)
{
unsigned char status1, status2;
unsigned int iersave;
up->port.type = PORT_16550A;
up->capabilities |= UART_CAP_FIFO;
/*
* XR17V35x UARTs have an extra divisor register, DLD
* that gets enabled with when DLAB is set which will
* cause the device to incorrectly match and assign
* port type to PORT_16650. The EFR for this UART is
* found at offset 0x09. Instead check the Deice ID (DVID)
* register for a 2, 4 or 8 port UART.
*/
if (up->port.flags & UPF_EXAR_EFR) {
status1 = serial_in(up, UART_EXAR_DVID);
if (status1 == 0x82 || status1 == 0x84 || status1 == 0x8 {
DEBUG_AUTOCONF("Exar XR17V35x " ;
up->port.type = PORT_XR17V35X;
up->capabilities |= UART_CAP_AFE | UART_CAP_EFR |
UART_CAP_SLEEP;
return;
}
}
/*
* Check for presence of the EFR when DLAB is set.
* Only ST16C650V1 UARTs pass this test.
*/
serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
if (serial_in(up, UART_EFR) == 0) {
serial_out(up, UART_EFR, 0xA ;
if (serial_in(up, UART_EFR) != 0) {
DEBUG_AUTOCONF("EFRv1 " ;
up->port.type = PORT_16650;
up->capabilities |= UART_CAP_EFR | UART_CAP_SLEEP;
} else {
DEBUG_AUTOCONF("Motorola 8xxx DUART " ;
}
serial_out(up, UART_EFR, 0);
return;
}
/*
不知道又没有人遇到这样的问题,我用的是stc16c554的芯片,但是上面仅仅是对ST16C650V1做的判断,为什么会被默认成16650的串口,这是系统的bug?还有谁知道这个tty下面的串口他是通过什么找到当前正在使用的芯片的? |
|