免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1360 | 回复: 0
打印 上一主题 下一主题

[硬件及驱动] tty架构下用st16c554扩展serial遇到的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-04-21 18:43 |只看该作者 |倒序浏览
本帖最后由 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下面的串口他是通过什么找到当前正在使用的芯片的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP