force chip into serial mode

add 232RL product id
This commit is contained in:
mlelstv 2013-01-21 19:08:42 +00:00
parent 05b3b9d385
commit f9a45eb9c5
2 changed files with 43 additions and 11 deletions

View File

@ -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 @@ static const struct usb_devno uftdi_devs[] = {
{ 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 @@ uftdi_param(void *vsc, int portno, struct termios *t)
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) {

View File

@ -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 @@ enum {
#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 */