Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56849
b: refs/heads/master
c: fa91d43
h: refs/heads/master
i:
  56847: e933072
v: v3
  • Loading branch information
Tony Lindgren authored and Greg Kroah-Hartman committed May 23, 2007
1 parent e07f6d5 commit 9a968a7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b7da8f6ff1aaf5a500dc798f4d1c2d6e98420a5
refs/heads/master: fa91d43b914b77637653d984416e17e182f7b807
38 changes: 36 additions & 2 deletions trunk/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 trunk/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 9a968a7

Please sign in to comment.