Support multiple interface devices. The driver had previously hardcoded

support for only the first port, but the CP2105 can have multiple ports.
Although this allowed the first port to mostly work on multi port devices,
there could be issues with this arrangement.

Update the man page to reflect support for both ports and the CP2105.

Many thanks to Silicon Labs (www.silabs.com) for providing a CP2105-EK
dev board for testing.

MFC after:	2 weeks
This commit is contained in:
Gavin Atkinson 2012-08-04 15:11:36 +00:00
parent 2038943013
commit b5ba3bdb25
2 changed files with 15 additions and 22 deletions

View File

@ -16,12 +16,12 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 26, 2012
.Dd August 4, 2012
.Dt USLCOM 4
.Os
.Sh NAME
.Nm uslcom
.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104 based USB serial adapter
.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104/CP2105 based USB serial adapter
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following lines in your
@ -41,7 +41,7 @@ uslcom_load="YES"
.Sh DESCRIPTION
The
.Nm
driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104
driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104/CP2105
based USB serial adapters.
.Sh HARDWARE
The following devices should work with the
@ -155,7 +155,7 @@ Renesas RX-Stick for RX610
.It
Siemens MC60 Cable
.It
Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104 chips
Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104/CP2105 chips
.It
Software Bisque Paramount ME
.It
@ -210,6 +210,3 @@ The
.Nm
driver was written by
.An Jonathan Gray Aq jsg@openbsd.org .
.Sh CAVEATS
On devices with multiple ports attached to a single chip,
only the first port is currently supported.

View File

@ -60,7 +60,6 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, debug, CTLFLAG_RW,
#define USLCOM_BULK_BUF_SIZE 1024
#define USLCOM_CONFIG_INDEX 0
#define USLCOM_IFACE_INDEX 0
#define USLCOM_SET_DATA_BITS(x) ((x) << 8)
@ -103,8 +102,6 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, debug, CTLFLAG_RW,
#define USLCOM_PARITY_ODD 0x10
#define USLCOM_PARITY_EVEN 0x20
#define USLCOM_PORT_NO 0x0000
/* USLCOM_BREAK values */
#define USLCOM_BREAK_OFF 0x00
#define USLCOM_BREAK_ON 0x01
@ -138,6 +135,7 @@ struct uslcom_softc {
uint8_t sc_msr;
uint8_t sc_lsr;
uint8_t sc_IfIdx;
};
static device_probe_t uslcom_probe;
@ -367,9 +365,6 @@ uslcom_probe(device_t dev)
if (uaa->info.bConfigIndex != USLCOM_CONFIG_INDEX) {
return (ENXIO);
}
if (uaa->info.bIfaceIndex != USLCOM_IFACE_INDEX) {
return (ENXIO);
}
return (usbd_lookup_id_by_uaa(uslcom_devs, sizeof(uslcom_devs), uaa));
}
@ -387,6 +382,7 @@ uslcom_attach(device_t dev)
usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
sc->sc_udev = uaa->device;
sc->sc_IfIdx = uaa->info.bIfaceIndex;
error = usbd_transfer_setup(uaa->device,
&uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config,
@ -441,7 +437,7 @@ uslcom_open(struct ucom_softc *ucom)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_UART;
USETW(req.wValue, USLCOM_UART_ENABLE);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, 0);
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -465,7 +461,7 @@ uslcom_close(struct ucom_softc *ucom)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_UART;
USETW(req.wValue, USLCOM_UART_DISABLE);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, 0);
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -489,7 +485,7 @@ uslcom_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_CTRL;
USETW(req.wValue, ctl);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, 0);
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -513,7 +509,7 @@ uslcom_set_rts(struct ucom_softc *ucom, uint8_t onoff)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_CTRL;
USETW(req.wValue, ctl);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, 0);
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -544,7 +540,7 @@ uslcom_param(struct ucom_softc *ucom, struct termios *t)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_SET_BAUD_RATE;
USETW(req.wValue, 0);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, sizeof(baudrate));
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -581,7 +577,7 @@ uslcom_param(struct ucom_softc *ucom, struct termios *t)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_DATA;
USETW(req.wValue, data);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, 0);
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -603,7 +599,7 @@ uslcom_param(struct ucom_softc *ucom, struct termios *t)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_SET_FLOWCTRL;
USETW(req.wValue, 0);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, sizeof(flowctrl));
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -633,7 +629,7 @@ uslcom_set_break(struct ucom_softc *ucom, uint8_t onoff)
req.bmRequestType = USLCOM_WRITE;
req.bRequest = USLCOM_BREAK;
USETW(req.wValue, brk);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, 0);
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
@ -787,7 +783,7 @@ uslcom_control_callback(struct usb_xfer *xfer, usb_error_t error)
req.bmRequestType = USLCOM_READ;
req.bRequest = USLCOM_RCTRL;
USETW(req.wValue, 0);
USETW(req.wIndex, USLCOM_PORT_NO);
USETW(req.wIndex, sc->sc_IfIdx);
USETW(req.wLength, sizeof(buf));
usbd_xfer_set_frames(xfer, 2);