]> err.no Git - linux-2.6/blobdiff - drivers/usb/serial/sierra.c
USB: Add support for Sierra Wireless Aircard 595U
[linux-2.6] / drivers / usb / serial / sierra.c
index 4b5097fa48d726cbeb7e66e8b8a45840fedda1a3..ac1829c6e8f02da29aecc3a5383a0c1dfa7a2b2e 100644 (file)
   Portions based on the option driver by Matthias Urlichs <smurf@smurf.noris.de>
   Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
 
-  History:
 */
 
-#define DRIVER_VERSION "v.1.0.5"
+#define DRIVER_VERSION "v.1.0.6"
 #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>"
 #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
 
 
 
 static struct usb_device_id id_table [] = {
+       { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
        { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
+       { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
        { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
-       { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
        { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
-       { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
+       { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless AirCard 595U */
+       { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
        { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
+       { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
-       { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 for Europe */
        { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
 
@@ -55,14 +56,16 @@ static struct usb_device_id id_table_1port [] = {
 };
 
 static struct usb_device_id id_table_3port [] = {
+       { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
        { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
+       { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
        { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
-       { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
        { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
-       { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
+       { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless AirCard 595U */
+       { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
        { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
+       { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
-       { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 for Europe */
        { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
        { }
@@ -81,7 +84,7 @@ static int debug;
 
 /* per port private data */
 #define N_IN_URB       4
-#define N_OUT_URB      1
+#define N_OUT_URB      4
 #define IN_BUFLEN      4096
 #define OUT_BUFLEN     128
 
@@ -145,7 +148,7 @@ static void sierra_break_ctl(struct usb_serial_port *port, int break_state)
 }
 
 static void sierra_set_termios(struct usb_serial_port *port,
-                       struct termios *old_termios)
+                       struct ktermios *old_termios)
 {
        dbg("%s", __FUNCTION__);
 
@@ -396,6 +399,8 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
        struct usb_serial *serial = port->serial;
        int i, err;
        struct urb *urb;
+       int result;
+       __u16 set_mode_dzero = 0x0000;
 
        portdata = usb_get_serial_port_data(port);
 
@@ -442,17 +447,17 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
 
        port->tty->low_latency = 1;
 
+       /* set mode to D0 */
+       result = usb_control_msg(serial->dev,
+                                usb_rcvctrlpipe(serial->dev, 0),
+                                0x00, 0x40, set_mode_dzero, 0, NULL,
+                                0, USB_CTRL_SET_TIMEOUT);
+
        sierra_send_setup(port);
 
        return (0);
 }
 
-static inline void stop_urb(struct urb *urb)
-{
-       if (urb && urb->status == -EINPROGRESS)
-               usb_kill_urb(urb);
-}
-
 static void sierra_close(struct usb_serial_port *port, struct file *filp)
 {
        int i;
@@ -470,9 +475,9 @@ static void sierra_close(struct usb_serial_port *port, struct file *filp)
 
                /* Stop reading/writing urbs */
                for (i = 0; i < N_IN_URB; i++)
-                       stop_urb(portdata->in_urbs[i]);
+                       usb_unlink_urb(portdata->in_urbs[i]);
                for (i = 0; i < N_OUT_URB; i++)
-                       stop_urb(portdata->out_urbs[i]);
+                       usb_unlink_urb(portdata->out_urbs[i]);
        }
        port->tty = NULL;
 }
@@ -574,17 +579,26 @@ static void sierra_shutdown(struct usb_serial *serial)
        /* Stop reading/writing urbs */
        for (i = 0; i < serial->num_ports; ++i) {
                port = serial->port[i];
+               if (!port)
+                       continue;
                portdata = usb_get_serial_port_data(port);
+               if (!portdata)
+                       continue;
+
                for (j = 0; j < N_IN_URB; j++)
-                       stop_urb(portdata->in_urbs[j]);
+                       usb_unlink_urb(portdata->in_urbs[j]);
                for (j = 0; j < N_OUT_URB; j++)
-                       stop_urb(portdata->out_urbs[j]);
+                       usb_unlink_urb(portdata->out_urbs[j]);
        }
 
        /* Now free them */
        for (i = 0; i < serial->num_ports; ++i) {
                port = serial->port[i];
+               if (!port)
+                       continue;
                portdata = usb_get_serial_port_data(port);
+               if (!portdata)
+                       continue;
 
                for (j = 0; j < N_IN_URB; j++) {
                        if (portdata->in_urbs[j]) {
@@ -603,6 +617,8 @@ static void sierra_shutdown(struct usb_serial *serial)
        /* Now free per port private data */
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
+               if (!port)
+                       continue;
                kfree(usb_get_serial_port_data(port));
        }
 }
@@ -614,6 +630,7 @@ static struct usb_serial_driver sierra_1port_device = {
        },
        .description       = "Sierra USB modem (1 port)",
        .id_table          = id_table_1port,
+       .usb_driver        = &sierra_driver,
        .num_interrupt_in  = NUM_DONT_CARE,
        .num_bulk_in       = 1,
        .num_bulk_out      = 1,
@@ -642,6 +659,7 @@ static struct usb_serial_driver sierra_3port_device = {
        },
        .description       = "Sierra USB modem (3 port)",
        .id_table          = id_table_3port,
+       .usb_driver        = &sierra_driver,
        .num_interrupt_in  = NUM_DONT_CARE,
        .num_bulk_in       = 3,
        .num_bulk_out      = 3,