Re: [PATCH] USB: Add support for Olimex arm-usb-ocd JTAG interface serial port

Tony Lindgren <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
* Greg KH <[email protected]> [070503 19:40]:
> On Fri, May 04, 2007 at 12:53:51AM +0000, Tony Lindgren wrote:
> > 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;
> > +	}
> 
> It would probably make more sense to make the device_data field hold the
> pointer to the quirk entry, that way you don't have a big if statement
> all the time here.

OK, and there are probably other chips that could use it too.

> Care to rework this?

Yeah I'll update it.

Tony

-------------------------------------------------------------------------
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/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.