Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb force chip into serial mode
details: https://anonhg.NetBSD.org/src/rev/57b0aa67186b
branches: trunk
changeset: 784198:57b0aa67186b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Mon Jan 21 19:08:42 2013 +0000
description:
force chip into serial mode
add 232RL product id
diffstat:
sys/dev/usb/uftdi.c | 14 ++++++++++++--
sys/dev/usb/uftdireg.h | 40 +++++++++++++++++++++++++++++++---------
2 files changed, 43 insertions(+), 11 deletions(-)
diffs (100 lines):
diff -r b313a5b65d90 -r 57b0aa67186b sys/dev/usb/uftdi.c
--- a/sys/dev/usb/uftdi.c Mon Jan 21 17:14:23 2013 +0000
+++ b/sys/dev/usb/uftdi.c Mon Jan 21 19:08:42 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uftdi.c,v 1.55 2013/01/20 13:43:24 reinoud Exp $ */
+/* $NetBSD: uftdi.c,v 1.56 2013/01/21 19:08:42 mlelstv Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.55 2013/01/20 13:43:24 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.56 2013/01/21 19:08:42 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -126,6 +126,7 @@
{ USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_TWIST },
{ USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_SAMBA },
{ USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_232H },
+ { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_232RL },
{ USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C },
{ USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_4232H },
{ USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX },
@@ -525,6 +526,15 @@
if (sc->sc_dying)
return (EIO);
+ req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+ req.bRequest = FTDI_SIO_SET_BITMODE;
+ USETW(req.wValue, FTDI_BITMODE_RESET << 8 | 0x00);
+ USETW(req.wIndex, portno);
+ USETW(req.wLength, 0);
+ err = usbd_do_request(sc->sc_udev, &req, NULL);
+ if (err)
+ return (EIO);
+
switch (sc->sc_type) {
case UFTDI_TYPE_SIO:
switch (t->c_ospeed) {
diff -r b313a5b65d90 -r 57b0aa67186b sys/dev/usb/uftdireg.h
--- a/sys/dev/usb/uftdireg.h Mon Jan 21 17:14:23 2013 +0000
+++ b/sys/dev/usb/uftdireg.h Mon Jan 21 19:08:42 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uftdireg.h,v 1.7 2012/08/24 01:36:14 msaitoh Exp $ */
+/* $NetBSD: uftdireg.h,v 1.8 2013/01/21 19:08:42 mlelstv Exp $ */
/*
* Definitions for the FTDI USB Single Port Serial Converter -
@@ -17,14 +17,15 @@
/* Modified by Lennart Augustsson */
/* Vendor Request Interface */
-#define FTDI_SIO_RESET 0 /* Reset the port */
-#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
-#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
-#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
-#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */
-#define FTDI_SIO_GET_STATUS 5 /* Retrieve current value of status reg */
-#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
-#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
+#define FTDI_SIO_RESET 0 /* Reset the port */
+#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
+#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
+#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
+#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */
+#define FTDI_SIO_GET_STATUS 5 /* Retrieve current value of status reg */
+#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
+#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
+#define FTDI_SIO_SET_BITMODE 11 /* Set FIFO/Serial mode */
/* Port Identifier Table */
#define FTDI_PIT_DEFAULT 0 /* SIOA */
@@ -345,3 +346,24 @@
#define FTDI_GET_LSR(p) ((p)[1])
#define FTDI_LSR_MASK (~0x60) /* interesting bits */
#define FTDI_OUT_TAG(len, port) (((len) << 2) | (port))
+
+/*
+ * BmRequestType: 0100 0000B
+ * bRequest: FTDI_SIO_SET_BITMODE
+ * wValue: Bitmode value - see below
+ * wIndex: Port
+ * wLength: 0
+ * Data: None
+ *
+ * Not all modes are available on all chips
+ */
+/* FTDI_SIO_SET_BITMODE */
+#define FTDI_BITMODE_RESET 0x00 /* UART mode */
+#define FTDI_BITMODE_BITBANG 0x01 /* asynchrounous bitbang mode */
+#define FTDI_BITMODE_MPSSE 0x02 /* MPSSE mode */
+#define FTDI_BITMODE_SYNCBB 0x04 /* synchronous bitbang mode */
+#define FTDI_BITMODE_MCU 0x08 /* MCU Host Bus Emulation mode */
+#define FTDI_BITMODE_OPTO 0x10 /* Fast Opto-Isolated Serial Interface Mode */
+#define FTDI_BITMODE_CBUS 0x20 /* Bitbang on CBUS pins */
+#define FTDI_BITMODE_SYNCFF 0x40 /* Synchronous FIFO mode */
+
Home |
Main Index |
Thread Index |
Old Index