aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLonnie Mendez <lmendez19@austin.rr.com>2006-03-01 11:45:24 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:50:00 -0500
commita5c44e29e5637b5e6fe59d225eb4f438688b3849 (patch)
tree1a39af521d6be62c57f1bc39083a95aaf6eac67d /drivers/usb
parenta847423905c6a8ccd6671d05f5877d893d10cd9f (diff)
[PATCH] USB: cypress_m8: add support for the Nokia ca42-version 2 cable
This patch adds support for the Nokia ca42 version 2 cable to the cypress_m8 driver. The device was tested by others with this patch and found to be compatible with the cypress_m8 driver. A special note should be taken that this cable seems to vary in the type of chipset used. This patch supports the cable with product id 0x4101. Signed-off-by: Lonnie Mendez <lmendez19@austin.rr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/cypress_m8.c70
-rw-r--r--drivers/usb/serial/cypress_m8.h5
2 files changed, 75 insertions, 0 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 71af3bf5adb7..7212fbe3b6f2 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -98,10 +98,16 @@ static struct usb_device_id id_table_cyphidcomrs232 [] = {
98 { } /* Terminating entry */ 98 { } /* Terminating entry */
99}; 99};
100 100
101static struct usb_device_id id_table_nokiaca42v2 [] = {
102 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) },
103 { } /* Terminating entry */
104};
105
101static struct usb_device_id id_table_combined [] = { 106static struct usb_device_id id_table_combined [] = {
102 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, 107 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) },
103 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, 108 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) },
104 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 109 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
110 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) },
105 { } /* Terminating entry */ 111 { } /* Terminating entry */
106}; 112};
107 113
@@ -149,6 +155,7 @@ struct cypress_buf {
149/* function prototypes for the Cypress USB to serial device */ 155/* function prototypes for the Cypress USB to serial device */
150static int cypress_earthmate_startup (struct usb_serial *serial); 156static int cypress_earthmate_startup (struct usb_serial *serial);
151static int cypress_hidcom_startup (struct usb_serial *serial); 157static int cypress_hidcom_startup (struct usb_serial *serial);
158static int cypress_ca42v2_startup (struct usb_serial *serial);
152static void cypress_shutdown (struct usb_serial *serial); 159static void cypress_shutdown (struct usb_serial *serial);
153static int cypress_open (struct usb_serial_port *port, struct file *filp); 160static int cypress_open (struct usb_serial_port *port, struct file *filp);
154static void cypress_close (struct usb_serial_port *port, struct file *filp); 161static void cypress_close (struct usb_serial_port *port, struct file *filp);
@@ -235,6 +242,34 @@ static struct usb_serial_driver cypress_hidcom_device = {
235 .write_int_callback = cypress_write_int_callback, 242 .write_int_callback = cypress_write_int_callback,
236}; 243};
237 244
245static struct usb_serial_driver cypress_ca42v2_device = {
246 .driver = {
247 .owner = THIS_MODULE,
248 .name = "nokiaca42v2",
249 },
250 .description = "Nokia CA-42 V2 Adapter",
251 .id_table = id_table_nokiaca42v2,
252 .num_interrupt_in = 1,
253 .num_interrupt_out = 1,
254 .num_bulk_in = NUM_DONT_CARE,
255 .num_bulk_out = NUM_DONT_CARE,
256 .num_ports = 1,
257 .attach = cypress_ca42v2_startup,
258 .shutdown = cypress_shutdown,
259 .open = cypress_open,
260 .close = cypress_close,
261 .write = cypress_write,
262 .write_room = cypress_write_room,
263 .ioctl = cypress_ioctl,
264 .set_termios = cypress_set_termios,
265 .tiocmget = cypress_tiocmget,
266 .tiocmset = cypress_tiocmset,
267 .chars_in_buffer = cypress_chars_in_buffer,
268 .throttle = cypress_throttle,
269 .unthrottle = cypress_unthrottle,
270 .read_int_callback = cypress_read_int_callback,
271 .write_int_callback = cypress_write_int_callback,
272};
238 273
239/***************************************************************************** 274/*****************************************************************************
240 * Cypress serial helper functions 275 * Cypress serial helper functions
@@ -286,6 +321,12 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m
286 __FUNCTION__); 321 __FUNCTION__);
287 new_baudrate = priv->baud_rate; 322 new_baudrate = priv->baud_rate;
288 } 323 }
324 } else if (priv->chiptype == CT_CA42V2) {
325 if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) {
326 err("%s - failed setting baud rate, unsupported speed",
327 __FUNCTION__);
328 new_baudrate = priv->baud_rate;
329 }
289 } else if (priv->chiptype == CT_GENERIC) { 330 } else if (priv->chiptype == CT_GENERIC) {
290 if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { 331 if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) {
291 err("%s - failed setting baud rate, unsupported speed", 332 err("%s - failed setting baud rate, unsupported speed",
@@ -499,6 +540,25 @@ static int cypress_hidcom_startup (struct usb_serial *serial)
499} /* cypress_hidcom_startup */ 540} /* cypress_hidcom_startup */
500 541
501 542
543static int cypress_ca42v2_startup (struct usb_serial *serial)
544{
545 struct cypress_private *priv;
546
547 dbg("%s", __FUNCTION__);
548
549 if (generic_startup(serial)) {
550 dbg("%s - Failed setting up port %d", __FUNCTION__,
551 serial->port[0]->number);
552 return 1;
553 }
554
555 priv = usb_get_serial_port_data(serial->port[0]);
556 priv->chiptype = CT_CA42V2;
557
558 return 0;
559} /* cypress_ca42v2_startup */
560
561
502static void cypress_shutdown (struct usb_serial *serial) 562static void cypress_shutdown (struct usb_serial *serial)
503{ 563{
504 struct cypress_private *priv; 564 struct cypress_private *priv;
@@ -943,6 +1003,10 @@ static void cypress_set_termios (struct usb_serial_port *port,
943 *(tty->termios) = tty_std_termios; 1003 *(tty->termios) = tty_std_termios;
944 tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | 1004 tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL |
945 CLOCAL; 1005 CLOCAL;
1006 } else if (priv->chiptype == CT_CA42V2) {
1007 *(tty->termios) = tty_std_termios;
1008 tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL |
1009 CLOCAL;
946 } 1010 }
947 priv->termios_initialized = 1; 1011 priv->termios_initialized = 1;
948 } 1012 }
@@ -1541,6 +1605,9 @@ static int __init cypress_init(void)
1541 retval = usb_serial_register(&cypress_hidcom_device); 1605 retval = usb_serial_register(&cypress_hidcom_device);
1542 if (retval) 1606 if (retval)
1543 goto failed_hidcom_register; 1607 goto failed_hidcom_register;
1608 retval = usb_serial_register(&cypress_ca42v2_device);
1609 if (retval)
1610 goto failed_ca42v2_register;
1544 retval = usb_register(&cypress_driver); 1611 retval = usb_register(&cypress_driver);
1545 if (retval) 1612 if (retval)
1546 goto failed_usb_register; 1613 goto failed_usb_register;
@@ -1549,6 +1616,8 @@ static int __init cypress_init(void)
1549 return 0; 1616 return 0;
1550failed_usb_register: 1617failed_usb_register:
1551 usb_deregister(&cypress_driver); 1618 usb_deregister(&cypress_driver);
1619failed_ca42v2_register:
1620 usb_serial_deregister(&cypress_ca42v2_device);
1552failed_hidcom_register: 1621failed_hidcom_register:
1553 usb_serial_deregister(&cypress_hidcom_device); 1622 usb_serial_deregister(&cypress_hidcom_device);
1554failed_em_register: 1623failed_em_register:
@@ -1565,6 +1634,7 @@ static void __exit cypress_exit (void)
1565 usb_deregister (&cypress_driver); 1634 usb_deregister (&cypress_driver);
1566 usb_serial_deregister (&cypress_earthmate_device); 1635 usb_serial_deregister (&cypress_earthmate_device);
1567 usb_serial_deregister (&cypress_hidcom_device); 1636 usb_serial_deregister (&cypress_hidcom_device);
1637 usb_serial_deregister (&cypress_ca42v2_device);
1568} 1638}
1569 1639
1570 1640
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
index 1fa119efe41a..e1c7c27e18b7 100644
--- a/drivers/usb/serial/cypress_m8.h
+++ b/drivers/usb/serial/cypress_m8.h
@@ -18,6 +18,10 @@
18/* Cypress HID->COM RS232 Adapter */ 18/* Cypress HID->COM RS232 Adapter */
19#define VENDOR_ID_CYPRESS 0x04b4 19#define VENDOR_ID_CYPRESS 0x04b4
20#define PRODUCT_ID_CYPHIDCOM 0x5500 20#define PRODUCT_ID_CYPHIDCOM 0x5500
21
22/* Nokia CA-42 USB to serial cable */
23#define VENDOR_ID_DAZZLE 0x07d0
24#define PRODUCT_ID_CA42 0x4101
21/* End of device listing */ 25/* End of device listing */
22 26
23/* Used for setting / requesting serial line settings */ 27/* Used for setting / requesting serial line settings */
@@ -34,6 +38,7 @@
34 38
35#define CT_EARTHMATE 0x01 39#define CT_EARTHMATE 0x01
36#define CT_CYPHIDCOM 0x02 40#define CT_CYPHIDCOM 0x02
41#define CT_CA42V2 0x03
37#define CT_GENERIC 0x0F 42#define CT_GENERIC 0x0F
38/* End of chiptype definitions */ 43/* End of chiptype definitions */
39 44