Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Add uxrcom driver for Exar XR21V141x USB serial ...
details: https://anonhg.NetBSD.org/src/rev/a09e1a3713b6
branches: trunk
changeset: 1009073:a09e1a3713b6
user: simonb <simonb%NetBSD.org@localhost>
date: Sun Apr 12 01:10:53 2020 +0000
description:
Add uxrcom driver for Exar XR21V141x USB serial adapters. Based in part
on the OpenBSD single-port XR21V1410 uxrcom driver, but adds support
for multi-port chipsets and uses the common umodem framework instead of
being a standalone driver.
Thanks to skrll@ for much USB clue and mrg@ for financing the
development of this driver.
diffstat:
distrib/sets/lists/man/mi | 5 +-
share/man/man4/Makefile | 6 +-
share/man/man4/ucom.4 | 6 +-
share/man/man4/uxrcom.4 | 79 ++++++++++
sys/dev/usb/files.usb | 7 +-
sys/dev/usb/ukyopon.c | 6 +-
sys/dev/usb/umodem.c | 6 +-
sys/dev/usb/umodem_common.c | 26 ++-
sys/dev/usb/usbdevices.config | 5 +-
sys/dev/usb/usbdevs | 8 +-
sys/dev/usb/uxrcom.c | 323 ++++++++++++++++++++++++++++++++++++++++++
11 files changed, 457 insertions(+), 20 deletions(-)
diffs (truncated from 674 to 300 lines):
diff -r 3a7f4fa69b30 -r a09e1a3713b6 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Sun Apr 12 00:04:45 2020 +0000
+++ b/distrib/sets/lists/man/mi Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1686 2020/04/04 15:39:16 jdolecek Exp $
+# $NetBSD: mi,v 1.1687 2020/04/12 01:10:53 simonb Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1957,6 +1957,7 @@
./usr/share/man/cat4/uvideo.0 man-sys-catman .cat
./usr/share/man/cat4/uvisor.0 man-sys-catman .cat
./usr/share/man/cat4/uvscom.0 man-sys-catman .cat
+./usr/share/man/cat4/uxrcom.0 man-sys-catman .cat
./usr/share/man/cat4/uyap.0 man-sys-catman .cat
./usr/share/man/cat4/uyurex.0 man-obsolete obsolete
./usr/share/man/cat4/vald.0 man-sys-catman .cat
@@ -5101,6 +5102,7 @@
./usr/share/man/html4/uvideo.html man-sys-htmlman html
./usr/share/man/html4/uvisor.html man-sys-htmlman html
./usr/share/man/html4/uvscom.html man-sys-htmlman html
+./usr/share/man/html4/uxrcom.html man-sys-htmlman html
./usr/share/man/html4/uyap.html man-sys-htmlman html
./usr/share/man/html4/uyurex.html man-obsolete obsolete
./usr/share/man/html4/vald.html man-sys-htmlman html
@@ -8169,6 +8171,7 @@
./usr/share/man/man4/uvideo.4 man-sys-man .man
./usr/share/man/man4/uvisor.4 man-sys-man .man
./usr/share/man/man4/uvscom.4 man-sys-man .man
+./usr/share/man/man4/uxrcom.4 man-sys-man .man
./usr/share/man/man4/uyap.4 man-sys-man .man
./usr/share/man/man4/uyurex.4 man-obsolete obsolete
./usr/share/man/man4/vald.4 man-sys-man .man
diff -r 3a7f4fa69b30 -r a09e1a3713b6 share/man/man4/Makefile
--- a/share/man/man4/Makefile Sun Apr 12 00:04:45 2020 +0000
+++ b/share/man/man4/Makefile Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.703 2020/04/04 15:39:13 jdolecek Exp $
+# $NetBSD: Makefile,v 1.704 2020/04/12 01:10:54 simonb Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -87,8 +87,8 @@
ulpt.4 umass.4 umcs.4 umct.4 umidi.4 umodem.4 ums.4 upgt.4 upl.4 \
uplcom.4 ure.4 url.4 urndis.4 urtw.4 urtwn.4 \
usb.4 usbnet.4 uscanner.4 uslsa.4 usmsc.4 usscanner.4 \
- ustir.4 uthum.4 utoppy.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uyap.4 \
- xhci.4 \
+ ustir.4 uthum.4 utoppy.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uxrcom.4 \
+ uyap.4 xhci.4 \
# Ir devices
MAN+= irframe.4 cir.4 irframetty.4 oboe.4
diff -r 3a7f4fa69b30 -r a09e1a3713b6 share/man/man4/ucom.4
--- a/share/man/man4/ucom.4 Sun Apr 12 00:04:45 2020 +0000
+++ b/share/man/man4/ucom.4 Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ucom.4,v 1.27 2019/05/05 00:12:34 pgoyette Exp $
+.\" $NetBSD: ucom.4,v 1.28 2020/04/12 01:10:54 simonb Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -50,6 +50,7 @@
.Cd "ucom* at uslsa?"
.Cd "ucom* at uvisor? portno ?"
.Cd "ucom* at uvscom?"
+.Cd "ucom* at uxrcom?"
.Sh DESCRIPTION
The
.Nm
@@ -103,7 +104,8 @@
.Xr usb 4 ,
.Xr uslsa 4 ,
.Xr uvisor 4 ,
-.Xr uvscom 4
+.Xr uvscom 4 ,
+.Xr uxrcom 4
.Sh HISTORY
The
.Nm
diff -r 3a7f4fa69b30 -r a09e1a3713b6 share/man/man4/uxrcom.4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/uxrcom.4 Sun Apr 12 01:10:53 2020 +0000
@@ -0,0 +1,79 @@
+.\" $OpenBSD: uxrcom.4,v 1.1 2019/03/27 22:11:21 kettenis Exp $
+.\"
+.\" Copyright (c) 2019 Mark Kettenis <kettenis%openbsd.org@localhost>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: March 27 2019 $
+.Dt UXRCOM 4
+.Os
+.Sh NAME
+.Nm uxrcom
+.Nd Exar XR21V141x USB serial adapter
+.Sh SYNOPSIS
+.Cd "uxrcom* at uhub?"
+.Cd "ucom* at uxrcom?"
+.Sh HARDWARE
+The
+.Nm
+driver supports serial adapters based on the
+XR21V1410, XR21V1412 and XR21V1414 chipsets.
+Devices range from single port to eight port (implemented as a
+USB hub and two
+.Nm
+four port instances behind it).
+Examples of hardware known to work with this driver are:
+.Pp
+.Bl -tag -width Dv -offset indent -compact
+.It Gearmo GM-U28RS232 8 Port USB to Serial DB9 RS232 Adapter
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver attaches the Exar XR21V141x multiport chipset with individual
+port drivers via
+.Xr ucom 4 ,
+which makes it behave like a
+.Xr tty 4 .
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr uhub 4 ,
+.Xr modem 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Ox 6.5
+and in
+.Nx 9.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver for the single port XR21V1410 was written by
+.An Mark Kettenis Aq Mt kettenis%openbsd.org@localhost .
+The multi-port
+.Nx
+driver is based on the
+.Ox
+driver but uses the common
+.Xr umodem 4
+framework.
+The
+.Nx
+driver was written by
+by
+.An Simon Burge
+.Aq simonb%netbsd.org@localhost .
diff -r 3a7f4fa69b30 -r a09e1a3713b6 sys/dev/usb/files.usb
--- a/sys/dev/usb/files.usb Sun Apr 12 00:04:45 2020 +0000
+++ b/sys/dev/usb/files.usb Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.usb,v 1.172 2020/02/09 15:46:15 maya Exp $
+# $NetBSD: files.usb,v 1.173 2020/04/12 01:10:54 simonb Exp $
#
# Config file and device description for machine-independent USB code.
# Included by ports that need it. Ports that use it must provide
@@ -429,6 +429,11 @@
attach uvscom at usbdevif
file dev/usb/uvscom.c uvscom
+# Exar XR21V141x serial driver (mostly CDC)
+device uxrcom: ucombus, umodem_common
+attach uxrcom at usbifif
+file dev/usb/uxrcom.c uxrcom
+
# Belkin & other serial driver
define ubsa_common
file dev/usb/ubsa_common.c ubsa_common
diff -r 3a7f4fa69b30 -r a09e1a3713b6 sys/dev/usb/ukyopon.c
--- a/sys/dev/usb/ukyopon.c Sun Apr 12 00:04:45 2020 +0000
+++ b/sys/dev/usb/ukyopon.c Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukyopon.c,v 1.25 2020/01/07 06:42:26 maxv Exp $ */
+/* $NetBSD: ukyopon.c,v 1.26 2020/04/12 01:10:54 simonb Exp $ */
/*
* Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.25 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.26 2020/04/12 01:10:54 simonb Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -130,6 +130,8 @@
struct usbif_attach_arg *uiaa = aux;
struct ucom_attach_args ucaa;
+ memset(&ucaa, 0, sizeof(ucaa));
+
ucaa.ucaa_portno = (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX) ?
UKYOPON_PORT_MODEM : UKYOPON_PORT_DATA;
ucaa.ucaa_methods = &ukyopon_methods;
diff -r 3a7f4fa69b30 -r a09e1a3713b6 sys/dev/usb/umodem.c
--- a/sys/dev/usb/umodem.c Sun Apr 12 00:04:45 2020 +0000
+++ b/sys/dev/usb/umodem.c Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umodem.c,v 1.73 2020/01/07 06:42:26 maxv Exp $ */
+/* $NetBSD: umodem.c,v 1.74 2020/04/12 01:10:54 simonb Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.73 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.74 2020/04/12 01:10:54 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -114,6 +114,8 @@
struct usbif_attach_arg *uiaa = aux;
struct ucom_attach_args ucaa;
+ memset(&ucaa, 0, sizeof(ucaa));
+
ucaa.ucaa_portno = UCOM_UNK_PORTNO;
ucaa.ucaa_methods = &umodem_methods;
ucaa.ucaa_info = NULL;
diff -r 3a7f4fa69b30 -r a09e1a3713b6 sys/dev/usb/umodem_common.c
--- a/sys/dev/usb/umodem_common.c Sun Apr 12 00:04:45 2020 +0000
+++ b/sys/dev/usb/umodem_common.c Sun Apr 12 01:10:53 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umodem_common.c,v 1.32 2020/03/14 02:35:33 christos Exp $ */
+/* $NetBSD: umodem_common.c,v 1.33 2020/04/12 01:10:54 simonb Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.32 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.33 2020/04/12 01:10:54 simonb Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -105,6 +105,12 @@
static void umodem_set_line_state(struct umodem_softc *);
static void umodem_intr(struct usbd_xfer *, void *, usbd_status);
+/*
+ * NOTE: Callers of umodem_common_attach() should initialise their ucaa
+ * to 0 before assigning any fields. ucaa_ibufsize, ucaa_ibufsize and
+ * ucaa_obufsize may be set by the caller, but if 0 are set to default
+ * umodem values.
+ */
int
umodem_common_attach(device_t self, struct umodem_softc *sc,
struct usbif_attach_arg *uiaa, struct ucom_attach_args *ucaa)
@@ -239,10 +245,16 @@
sc->sc_dtr = -1;
- /* ucaa_bulkin, ucaa_bulkout set above */
- ucaa->ucaa_ibufsize = UMODEMIBUFSIZE;
- ucaa->ucaa_obufsize = UMODEMOBUFSIZE;
- ucaa->ucaa_ibufsizepad = UMODEMIBUFSIZE;
+ /*
+ * ucaa_bulkin, ucaa_bulkout set above. ucaa_ibufsize,
+ * ucaa_ibufsize, ucaa_obufsize may be initialised by caller
+ */
+ if (ucaa->ucaa_ibufsize == 0)
+ ucaa->ucaa_ibufsize = UMODEMIBUFSIZE;
+ if (ucaa->ucaa_obufsize == 0)
+ ucaa->ucaa_obufsize = UMODEMOBUFSIZE;
+ if (ucaa->ucaa_ibufsizepad == 0)
+ ucaa->ucaa_ibufsizepad = UMODEMIBUFSIZE;
ucaa->ucaa_opkthdrlen = 0;
ucaa->ucaa_device = sc->sc_udev;
ucaa->ucaa_iface = sc->sc_data_iface;
@@ -356,7 +368,7 @@
sc->sc_notify_buf.data[0],
sc->sc_notify_buf.data[1]));
/* Currently, lsr is always zero. */
- sc->sc_lsr = sc->sc_msr = 0;
+ sc->sc_lsr = sc->sc_msr = 0;
mstatus = sc->sc_notify_buf.data[0];
if (ISSET(mstatus, UCDC_N_SERIAL_RI))
diff -r 3a7f4fa69b30 -r a09e1a3713b6 sys/dev/usb/usbdevices.config
Home |
Main Index |
Thread Index |
Old Index