Hi,
Here's a little patch to add support for the Olimex arm-usb-ocd JTAG.
Regards,
Tony
From: Tony Lindgren <[EMAIL PROTECTED]>
Subject: [PATCH] USB: Add support for Olimex arm-usb-ocd JTAG interface serial
port
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 <[EMAIL PROTECTED]>
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -524,6 +524,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) },
{ USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) },
{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
+ { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID) },
{ }, /* Optional parameter entry */
{ } /* Terminating entry */
};
@@ -668,7 +669,7 @@ static struct usb_serial_driver ftdi_sio_device = {
/*
* ***************************************************************************
- * Utlity functions
+ * Utility functions
* ***************************************************************************
*/
@@ -1167,12 +1168,38 @@ static void remove_sysfs_attrs(struct usb_serial_port
*port)
* ***************************************************************************
*/
+static int ftdi_port_quirks(struct usb_serial *serial)
+{
+ struct usb_device *udev = serial->dev;
+ struct usb_device_descriptor desc = udev->descriptor;
+ struct usb_interface *interface = serial->interface;
+
+ /*
+ * First port on Olimex arm-usb-ocd is reserved for JTAG interface
+ * and can be accessed from userspace using openocd.
+ */
+ if ((le16_to_cpu(desc.idVendor) == OLIMEX_VID) &&
+ (le16_to_cpu(desc.idProduct) == OLIMEX_ARM_USB_OCD_PID) &&
+ (interface == udev->actconfig->interface[0])) {
+ info("Ignoring reserved serial port on Olimex arm-usb-ocd\n");
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
/* Probe function to check for special devices */
static int ftdi_sio_probe (struct usb_serial *serial, const struct
usb_device_id *id)
{
+ int ret;
+
+ ret = ftdi_port_quirks(serial);
+ if (ret != 0)
+ return ret;
+
usb_set_serial_data(serial, (void *)id->driver_info);
- return (0);
+ return ret;
}
static int ftdi_sio_port_probe(struct usb_serial_port *port)
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -517,6 +517,10 @@
#define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz)
*/
#define FTDI_IBS_PROD_PID 0xff3f /* future device */
+/* 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 */
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel