Skip to content

Commit

Permalink
USB: Add support for Olimex arm-usb-ocd JTAG interface serial port
Browse files Browse the repository at this point in the history
This patch adds support for the serial port on Olimex arm-usb-ocd
JTAG interface.

The device appears as two serial ports, but the first one is reserved
for the JTAG interface. The JTAG interface can be used with OpenOCD
from userspace. For more information, please see:

http://openocd.berlios.de/web/
http://www.olimex.com/dev/arm-usb-ocd.html

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Tony Lindgren authored and Greg Kroah-Hartman committed May 23, 2007
1 parent 5b7da8f commit fa91d43
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
38 changes: 36 additions & 2 deletions drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,18 @@ static __u16 product;

/* struct ftdi_sio_quirk is used by devices requiring special attention. */
struct ftdi_sio_quirk {
int (*probe)(struct usb_serial *);
void (*setup)(struct usb_serial *); /* Special settings during startup. */
};

static int ftdi_olimex_probe (struct usb_serial *serial);
static void ftdi_USB_UIRT_setup (struct usb_serial *serial);
static void ftdi_HE_TIRA1_setup (struct usb_serial *serial);

static struct ftdi_sio_quirk ftdi_olimex_quirk = {
.probe = ftdi_olimex_probe,
};

static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
.setup = ftdi_USB_UIRT_setup,
};
Expand Down Expand Up @@ -527,6 +533,8 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) },
{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
.driver_info = (kernel_ulong_t)&ftdi_olimex_quirk },
{ }, /* Optional parameter entry */
{ } /* Terminating entry */
};
Expand Down Expand Up @@ -671,7 +679,7 @@ static struct usb_serial_driver ftdi_sio_device = {

/*
* ***************************************************************************
* Utlity functions
* Utility functions
* ***************************************************************************
*/

Expand Down Expand Up @@ -1173,9 +1181,17 @@ static void remove_sysfs_attrs(struct usb_serial_port *port)
/* Probe function to check for special devices */
static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id)
{
struct ftdi_sio_quirk *quirk = (struct ftdi_sio_quirk *)id->driver_info;

if (quirk && quirk->probe) {
int ret = quirk->probe(serial);
if (ret != 0)
return ret;
}

usb_set_serial_data(serial, (void *)id->driver_info);

return (0);
return 0;
}

static int ftdi_sio_port_probe(struct usb_serial_port *port)
Expand Down Expand Up @@ -1270,6 +1286,24 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
priv->force_rtscts = 1;
} /* ftdi_HE_TIRA1_setup */

/*
* First port on Olimex arm-usb-ocd is reserved for JTAG interface
* and can be accessed from userspace using openocd.
*/
static int ftdi_olimex_probe(struct usb_serial *serial)
{
struct usb_device *udev = serial->dev;
struct usb_interface *interface = serial->interface;

dbg("%s",__FUNCTION__);

if (interface == udev->actconfig->interface[0]) {
info("Ignoring reserved serial port on Olimex arm-usb-ocd\n");
return -ENODEV;
}

return 0;
}

/* ftdi_shutdown is called from usbserial:usb_serial_disconnect
* it is called when the usb device is disconnected
Expand Down
4 changes: 4 additions & 0 deletions drivers/usb/serial/ftdi_sio.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@
*/
#define FTDI_MAXSTREAM_PID 0xEE18 /* Xbee PKG-U Module */

/* Olimex */
#define OLIMEX_VID 0x15BA
#define OLIMEX_ARM_USB_OCD_PID 0x0003

/* Commands */
#define FTDI_SIO_RESET 0 /* Reset the port */
#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
Expand Down

0 comments on commit fa91d43

Please sign in to comment.