CH381L Linux驱动问题

我们在使用深圳数字鱼的pcie转2路串口的卡的时候发现linux驱动编译有问题。

驱动下载地址:http://www.wch.cn/download/CH38XDRV_ZIP.html

编译源码: zip里面的DRV_2S/LINUX/

编译主机:ubuntu 14.04,内核版本 3.13.0-55-generic

 lspci -v 是可以看到设备的。

02:00.0 Serial controller: Device 1c00:3253 (rev 10) (prog-if 05 [16850])
Subsystem: Device 1c00:3253
Flags: fast devsel, IRQ 17
I/O ports at e000 [size=256]
Memory at b0708000 (32-bit, prefetchable) [size=32K]
I/O ports at e100 [size=4]
Expansion ROM at b0700000 [disabled] [size=32K]
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable- Count=1/32 Maskable+ 64bit+
Capabilities: [80] Express Legacy Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting


编译错误:

tom@tom-desktop:/tmp/LINUX/driver:)make
make -C /lib/modules/3.13.0-55-
generic/build SUBDIRS=/tmp/LINUX/driver modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.
0-55-generic'
  CC [M]  /tmp/LINUX/driver/wch_serial.o
In file included from /tmp/LINUX/driver/wch_serial.
c:1:0:
/tmp/LINUX/driver/wch_common.
h: In function ‘ser_insert_char’:
/tmp/LINUX/driver/wch_common.
h:716:3: warning: passing argument 1 of
‘tty_insert_flip_char’ from incompatible pointer type [enabled by
default]
   tty_insert_flip_char(tty, ch, flag);
   ^
In file included from /tmp/LINUX/driver/wch_common.
h:42:0,
                 from /tmp/LINUX/driver/wch_serial.
c:1:
include/linux/tty_flip.h:17:
19: note: expected ‘struct tty_port *’ but
argument is of type ‘struct tty_struct *’
 static inline int tty_insert_flip_char(struct tty_port *port,
                   ^
In file included from /tmp/LINUX/driver/wch_serial.
c:1:0:
/tmp/LINUX/driver/wch_common.
h:722:3: warning: passing argument 1 of
‘tty_insert_flip_char’ from incompatible pointer type [enabled by
default]
   tty_insert_flip_char(tty, 0, TTY_OVERRUN);
   ^
In file included from /tmp/LINUX/driver/wch_common.
h:42:0,
                 from /tmp/LINUX/driver/wch_serial.
c:1:
include/linux/tty_flip.h:17:
19: note: expected ‘struct tty_port *’ but
argument is of type ‘struct tty_struct *’
 static inline int tty_insert_flip_char(struct tty_port *port,
                   ^
/tmp/LINUX/driver/wch_serial.
c: At top level:
/tmp/LINUX/driver/wch_serial.
c:12:40: error: array type has incomplete
element type
 static const struct serial_uart_config
wch_uart_config[PORT_SER_MAX_
UART + 1] = {
                                        ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_startup’:
/tmp/LINUX/driver/wch_serial.
c:718:35: error: invalid type argument of
‘->’ (have ‘struct ktermios’)
             if (info->tty->termios->c_cflag & CBAUD)
                                   ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_shutdown’:
/tmp/LINUX/driver/wch_serial.
c:759:42: error: invalid type argument of
‘->’ (have ‘struct ktermios’)
     if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
                                          ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_throttle’:
/tmp/LINUX/driver/wch_serial.
c:988:21: error: invalid type argument of
‘->’ (have ‘struct ktermios’)
     if (tty->termios->c_cflag & CRTSCTS)
                     ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_unthrottle’:
/tmp/LINUX/driver/wch_serial.
c:1025:21: error: invalid type argument
of ‘->’ (have ‘struct ktermios’)
     if (tty->termios->c_cflag & CRTSCTS)
                     ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_set_info’:
/tmp/LINUX/driver/wch_serial.
c:1181:25: error: ‘struct tty_struct’ has
no member named ‘low_latency’
         state->info->tty->low_latency = (port->flags &
WCH_UPF_LOW_LATENCY) ? 1 : 0;
                         ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_change_speed’:
/tmp/LINUX/driver/wch_serial.
c:2155:17: error: wrong type argument to
unary exclamation mark
     if (!tty || !tty->termios || port->type == PORT_UNKNOWN)
                 ^
/tmp/LINUX/driver/wch_serial.
c:2160:13: error: incompatible types when
assigning to type ‘struct ktermios *’ from type ‘struct ktermios’
     termios = tty->termios;
             ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_set_termios’:
/tmp/LINUX/driver/wch_serial.
c:2192:38: error: invalid type argument
of ‘->’ (have ‘struct ktermios’)
     unsigned int cflag = tty->termios->c_cflag;
                                      ^
/tmp/LINUX/driver/wch_serial.
c:2203:75: error: invalid type argument
of ‘->’ (have ‘struct ktermios’)
     if ((cflag ^ old_termios->c_cflag) == 0 &&
RELEVANT_IFLAG(tty->termios->
c_iflag ^ old_termios->c_iflag) == 0)
                                                                           ^
/tmp/LINUX/driver/wch_serial.
c:2201:35: note: in definition of macro
‘RELEVANT_IFLAG’
 #define RELEVANT_IFLAG(iflag)   ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|
INPCK))
                                   ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_update_termios’:
/tmp/LINUX/driver/wch_serial.
c:2248:25: error: invalid type argument
of ‘->’ (have ‘struct ktermios’)
         if (tty->termios->c_cflag & CBAUD)
                         ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_block_til_ready’:
/tmp/LINUX/driver/wch_serial.
c:2393:32: error: invalid type argument
of ‘->’ (have ‘struct ktermios’)
             (info->tty->termios->c_cflag & CLOCAL) ||
                                ^
/tmp/LINUX/driver/wch_serial.
c:2399:31: error: invalid type argument
of ‘->’ (have ‘struct ktermios’)
         if (info->tty->termios->c_cflag & CBAUD)
                               ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_open’:
/tmp/LINUX/driver/wch_serial.
c:2540:12: error: ‘struct tty_struct’ has
no member named ‘low_latency’
         tty->low_latency = (state->port->flags & WCH_UPF_LOW_LATENCY) ? 1 : 0;
            ^
/tmp/LINUX/driver/wch_serial.
c: In function ‘ser_receive_chars’:
/tmp/LINUX/driver/wch_serial.
c:3206:5: warning: passing argument 1 of
‘tty_flip_buffer_push’ from incompatible pointer type [enabled by
default]
     tty_flip_buffer_push(tty);
     ^
In file included from /tmp/LINUX/driver/wch_common.
h:42:0,
                 from /tmp/LINUX/driver/wch_serial.
c:1:
include/linux/tty_flip.h:14:
13: note: expected ‘struct tty_port *’ but
argument is of type ‘struct tty_struct *’
 extern void tty_flip_buffer_push(struct tty_port *port);
             ^
/tmp/LINUX/driver/wch_serial.
c: At top level:
/tmp/LINUX/driver/wch_serial.
c:12:40: warning: ‘wch_uart_config’
defined but not used [-Wunused-variable]
 static const struct serial_uart_config
wch_uart_config[PORT_SER_MAX_
UART + 1] = {
                                        ^
make[2]: *** [/tmp/LINUX/driver/wch_serial.
o] Error 1
make[1]: *** [_module_/tmp/LINUX/driver] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.
0-55-generic'
make: *** [modules] Error 2
tom@tom-desktop:/tmp/LINUX/
driver:)

应该是驱动是基于比较旧的内核开发的,请问你们有新驱动吗?为什么主流内核不能直接支持这款芯片。


您好,我们网站上的不是最新的驱动,您可以发邮件到tech@wch.cn寻要驱动。


谢谢,已经发了邮件了。


给你们的邮箱发送邮件不成功,试了gmail和qq邮箱,都没有成功。能不能把最新的驱动发到我邮箱,个人信息保护,已隐藏,谢谢了。


驱动已发到个人信息保护,已隐藏


只有登录才能回复,可以选择微信账号登录