Merge remote-tracking branch 'stable/linux-3.0.y' into develop-3.0
[firefly-linux-kernel-4.4.55.git] / drivers / usb / serial / usb-serial.c
old mode 100644 (file)
new mode 100755 (executable)
index 637dfa4..c20bd51
@@ -53,6 +53,22 @@ static struct usb_driver usb_serial_driver = {
        .no_dynamic_id =        1,
        .supports_autosuspend = 1,
 };
+#if defined(CONFIG_MU509) || defined(CONFIG_BP_AUTO_MU509)
+static int MU509_USB = 0;
+#define MU509_USB_PORT     (SERIAL_TTY_MINORS - 10)
+#endif
+#if defined(CONFIG_MW100) || defined(CONFIG_BP_AUTO_MW100)
+static int MW100_USB = 0;
+#define MW100_USB_PORT     (SERIAL_TTY_MINORS - 10)
+#endif
+#if defined(CONFIG_MT6229) || defined(CONFIG_BP_AUTO_MT6229)
+static int MT6229_USB = 0;
+#define MT6229_USB_PORT     (SERIAL_TTY_MINORS - 10)
+#endif
+#if defined(CONFIG_SEW868) || defined(CONFIG_BP_AUTO_SEW868)
+static int SEW868_USB = 0;
+#define SEW868_USB_PORT     (SERIAL_TTY_MINORS - 10)
+#endif
 
 /* There is no MODULE_DEVICE_TABLE for usbserial.c.  Instead
    the MODULE_DEVICE_TABLE declarations in each serial driver
@@ -97,12 +113,29 @@ static struct usb_serial *get_free_serial(struct usb_serial *serial,
 {
        unsigned int i, j;
        int good_spot;
+       int a=0;
 
        dbg("%s %d", __func__, num_ports);
 
        *minor = 0;
        mutex_lock(&table_lock);
-       for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
+#if defined(CONFIG_MU509) || defined(CONFIG_BP_AUTO_MU509)
+       if (MU509_USB)
+               a= MU509_USB_PORT;
+#endif
+#if defined(CONFIG_MW100) || defined(CONFIG_BP_AUTO_MW100)
+       if (MW100_USB)          
+               a= MW100_USB_PORT;
+#endif
+#if defined(CONFIG_MT6229) || defined(CONFIG_BP_AUTO_MT6229)
+       if (MT6229_USB)         
+               a= MT6229_USB_PORT;
+#endif
+#if defined(CONFIG_SEW868) || defined(CONFIG_BP_AUTO_SEW868)
+       if (SEW868_USB)         
+               a= SEW868_USB_PORT;
+#endif
+       for (i = a; i < SERIAL_TTY_MINORS; ++i) {
                if (serial_table[i])
                        continue;
 
@@ -1060,6 +1093,30 @@ int usb_serial_probe(struct usb_interface *interface,
        } else {
                serial->attached = 1;
        }
+#if defined(CONFIG_MU509) || defined(CONFIG_BP_AUTO_MU509)
+               if ((le16_to_cpu(dev->descriptor.idVendor) == 0x12D1 ) && (le16_to_cpu(dev->descriptor.idProduct) == 0x1001))
+                       MU509_USB =1;
+               else
+                       MU509_USB = 0;
+#endif
+#if defined(CONFIG_MW100) || defined(CONFIG_BP_AUTO_MW100)
+       if ((le16_to_cpu(dev->descriptor.idVendor) == 0x19f5) && (le16_to_cpu(dev->descriptor.idProduct) == 0x9013))                    
+               MW100_USB =1;           
+       else                    
+               MW100_USB = 0;
+#endif
+#if defined(CONFIG_MT6229) || defined(CONFIG_BP_AUTO_MT6229)
+       if ((le16_to_cpu(dev->descriptor.idVendor) == 0x0E8D) && (le16_to_cpu(dev->descriptor.idProduct) == 0x00A2))                    
+               MT6229_USB =1;          
+       else                    
+               MT6229_USB = 0;
+#endif
+#if defined(CONFIG_SEW868) || defined(CONFIG_BP_AUTO_SEW868)
+       if ((le16_to_cpu(dev->descriptor.idVendor) == 0x19d2) && (le16_to_cpu(dev->descriptor.idProduct) == 0xffeb))                    
+               SEW868_USB =1;          
+       else                    
+               SEW868_USB = 0;
+#endif
 
        /* Avoid race with tty_open and serial_install by setting the
         * disconnected flag and not clearing it until all ports have been