Merge 3.5-rc3 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2012 23:24:02 +0000 (16:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2012 23:24:02 +0000 (16:24 -0700)
This lets us catch the USB fixes that went into 3.5-rc3 into this branch,
as we want them here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 files changed:
drivers/usb/class/cdc-wdm.c
drivers/usb/core/driver.c
drivers/usb/core/file.c
drivers/usb/core/message.c
drivers/usb/core/sysfs.c
drivers/usb/early/ehci-dbgp.c
drivers/usb/host/Kconfig
drivers/usb/host/ehci-fsl.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/ehci.h
drivers/usb/host/ohci-nxp.c
drivers/usb/host/ohci-omap.c
drivers/usb/host/ohci.h
drivers/usb/serial/keyspan.c
drivers/usb/serial/option.c
drivers/usb/serial/quatech2.c
drivers/usb/storage/protocol.c
include/linux/mod_devicetable.h
include/linux/usb.h
include/linux/usb/hcd.h
include/linux/usb/renesas_usbhs.h
scripts/mod/file2alias.c
tools/usb/testusb.c

index 8fd398dffced7fe90afb5a6b13464279f3a7c5c6..25e7d72f339e9eabecce2006e0ecf9f146ee3a62 100644 (file)
@@ -32,8 +32,6 @@
 #define DRIVER_AUTHOR "Oliver Neukum"
 #define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management"
 
-#define HUAWEI_VENDOR_ID       0x12D1
-
 static const struct usb_device_id wdm_ids[] = {
        {
                .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
@@ -41,29 +39,6 @@ static const struct usb_device_id wdm_ids[] = {
                .bInterfaceClass = USB_CLASS_COMM,
                .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM
        },
-       {
-               /* 
-                * Huawei E392, E398 and possibly other Qualcomm based modems
-                * embed the Qualcomm QMI protocol inside CDC on CDC ECM like
-                * control interfaces.  Userspace access to this is required
-                * to configure the accompanying data interface
-                */
-               .match_flags        = USB_DEVICE_ID_MATCH_VENDOR |
-                                       USB_DEVICE_ID_MATCH_INT_INFO,
-               .idVendor           = HUAWEI_VENDOR_ID,
-               .bInterfaceClass    = USB_CLASS_VENDOR_SPEC,
-               .bInterfaceSubClass = 1,
-               .bInterfaceProtocol = 9, /* NOTE: CDC ECM control interface! */
-       },
-       {
-                /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
-               .match_flags        = USB_DEVICE_ID_MATCH_VENDOR |
-                                     USB_DEVICE_ID_MATCH_INT_INFO,
-               .idVendor           = HUAWEI_VENDOR_ID,
-               .bInterfaceClass    = USB_CLASS_VENDOR_SPEC,
-               .bInterfaceSubClass = 1,
-               .bInterfaceProtocol = 57, /* NOTE: CDC ECM control interface! */
-       },
        { }
 };
 
index f536aebc958e71d459f71ee5b9ae19f717a851c6..69781016a266816af9feab64ad91d56d2001e1f4 100644 (file)
@@ -367,6 +367,7 @@ static int usb_probe_interface(struct device *dev)
        return error;
 
  err:
+       usb_set_intfdata(intf, NULL);
        intf->needs_remote_wakeup = 0;
        intf->condition = USB_INTERFACE_UNBOUND;
        usb_cancel_queued_reset(intf);
@@ -622,14 +623,15 @@ int usb_match_one_id(struct usb_interface *interface,
        if (!usb_match_device(dev, id))
                return 0;
 
-       /* The interface class, subclass, and protocol should never be
+       /* The interface class, subclass, protocol and number should never be
         * checked for a match if the device class is Vendor Specific,
         * unless the match record specifies the Vendor ID. */
        if (dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC &&
                        !(id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) &&
                        (id->match_flags & (USB_DEVICE_ID_MATCH_INT_CLASS |
                                USB_DEVICE_ID_MATCH_INT_SUBCLASS |
-                               USB_DEVICE_ID_MATCH_INT_PROTOCOL)))
+                               USB_DEVICE_ID_MATCH_INT_PROTOCOL |
+                               USB_DEVICE_ID_MATCH_INT_NUMBER)))
                return 0;
 
        if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
@@ -644,6 +646,10 @@ int usb_match_one_id(struct usb_interface *interface,
            (id->bInterfaceProtocol != intf->desc.bInterfaceProtocol))
                return 0;
 
+       if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_NUMBER) &&
+           (id->bInterfaceNumber != intf->desc.bInterfaceNumber))
+               return 0;
+
        return 1;
 }
 EXPORT_SYMBOL_GPL(usb_match_one_id);
index e673b26e598f3391627550bff784c21f2be97486..e5387a47ef6fea27f978782bbed9375f4ff22d1d 100644 (file)
@@ -92,7 +92,7 @@ static int init_usb_class(void)
        }
 
        kref_init(&usb_class->kref);
-       usb_class->class = class_create(THIS_MODULE, "usb");
+       usb_class->class = class_create(THIS_MODULE, "usbmisc");
        if (IS_ERR(usb_class->class)) {
                result = IS_ERR(usb_class->class);
                printk(KERN_ERR "class_create failed for usb devices\n");
index bdd1c6749d88a9206208a27f7cbd7d966ebeb386..8b9d669e37845a2fa08824fc04ee5ddcd966f037 100644 (file)
@@ -1559,7 +1559,7 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env)
 
        if (add_uevent_var(env,
                   "MODALIAS=usb:"
-                  "v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
+                  "v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02Xin%02X",
                   le16_to_cpu(usb_dev->descriptor.idVendor),
                   le16_to_cpu(usb_dev->descriptor.idProduct),
                   le16_to_cpu(usb_dev->descriptor.bcdDevice),
@@ -1568,7 +1568,8 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env)
                   usb_dev->descriptor.bDeviceProtocol,
                   alt->desc.bInterfaceClass,
                   alt->desc.bInterfaceSubClass,
-                  alt->desc.bInterfaceProtocol))
+                  alt->desc.bInterfaceProtocol,
+                  alt->desc.bInterfaceNumber))
                return -ENOMEM;
 
        return 0;
index 9a56e3adf476f07073500f7a9364b2e4290b8adc..777f03c3772506526e69c4d1e14eab2f61dfd274 100644 (file)
@@ -840,7 +840,7 @@ static ssize_t show_modalias(struct device *dev,
        alt = intf->cur_altsetting;
 
        return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02X"
-                       "ic%02Xisc%02Xip%02X\n",
+                       "ic%02Xisc%02Xip%02Xin%02X\n",
                        le16_to_cpu(udev->descriptor.idVendor),
                        le16_to_cpu(udev->descriptor.idProduct),
                        le16_to_cpu(udev->descriptor.bcdDevice),
@@ -849,7 +849,8 @@ static ssize_t show_modalias(struct device *dev,
                        udev->descriptor.bDeviceProtocol,
                        alt->desc.bInterfaceClass,
                        alt->desc.bInterfaceSubClass,
-                       alt->desc.bInterfaceProtocol);
+                       alt->desc.bInterfaceProtocol,
+                       alt->desc.bInterfaceNumber);
 }
 static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
 
index 1fc8f1249806ab964645b5395e2f2d099a80a757..ee0ebacf8227df070dc4a40daf8cd873007ca296 100644 (file)
@@ -334,7 +334,7 @@ static int dbgp_control_msg(unsigned devnum, int requesttype,
        int ret;
 
        read = (requesttype & USB_DIR_IN) != 0;
-       if (size > (read ? DBGP_MAX_PACKET:0))
+       if (size > (read ? DBGP_MAX_PACKET : 0))
                return -1;
 
        /* Compute the control message */
index 83e58df29fe3ad32b1a7fc3c27cecc84f4e0a472..18ba33da34ecd28e675cbfb4661d302eae0bb2d1 100644 (file)
@@ -652,7 +652,7 @@ config USB_HCD_BCMA
        select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
        select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
        help
-         Enbale support for the EHCI and OCHI host controller on an bcma bus.
+         Enable support for the EHCI and OCHI host controller on an bcma bus.
          It converts the bcma driver into two platform device drivers
          for ehci and ohci.
 
@@ -664,7 +664,7 @@ config USB_HCD_SSB
        select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
        select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
        help
-         Enbale support for the EHCI and OCHI host controller on an bcma bus.
+         Enable support for the EHCI and OCHI host controller on an bcma bus.
          It converts the bcma driver into two platform device drivers
          for ehci and ohci.
 
index 43362577b54afb6f42530c9743474e9c3ffe028c..3379945b095e23e47833b9c534ea1a98f2e5734a 100644 (file)
@@ -142,19 +142,19 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
        if (pdata->operating_mode == FSL_USB2_DR_OTG) {
                struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
-               ehci->transceiver = usb_get_transceiver();
-               dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, transceiver=0x%p\n",
-                       hcd, ehci, ehci->transceiver);
+               hcd->phy = usb_get_transceiver();
+               dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, phy=0x%p\n",
+                       hcd, ehci, hcd->phy);
 
-               if (ehci->transceiver) {
-                       retval = otg_set_host(ehci->transceiver->otg,
+               if (hcd->phy) {
+                       retval = otg_set_host(hcd->phy->otg,
                                              &ehci_to_hcd(ehci)->self);
                        if (retval) {
-                               usb_put_transceiver(ehci->transceiver);
+                               usb_put_transceiver(hcd->phy);
                                goto err4;
                        }
                } else {
-                       dev_err(&pdev->dev, "can't find transceiver\n");
+                       dev_err(&pdev->dev, "can't find phy\n");
                        retval = -ENODEV;
                        goto err4;
                }
@@ -190,11 +190,10 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
                               struct platform_device *pdev)
 {
        struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
-       struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
-       if (ehci->transceiver) {
-               otg_set_host(ehci->transceiver->otg, NULL);
-               usb_put_transceiver(ehci->transceiver);
+       if (hcd->phy) {
+               otg_set_host(hcd->phy->otg, NULL);
+               usb_put_transceiver(hcd->phy);
        }
 
        usb_remove_hcd(hcd);
index fc9e7cc6ac9b90c7914625f90d12875263ceb202..dd5eef6af6df6143bf1098ce8cea68b1266299b2 100644 (file)
@@ -724,7 +724,7 @@ static int ehci_hub_control (
 #ifdef CONFIG_USB_OTG
                        if ((hcd->self.otg_port == (wIndex + 1))
                            && hcd->self.b_hnp_enable) {
-                               otg_start_hnp(ehci->transceiver->otg);
+                               otg_start_hnp(hcd->phy->otg);
                                break;
                        }
 #endif
index 2694ed6558d2d954c03a4ba3b77eabdc64f9c7f6..85c3572155d1faf992f271b1612e7f7d928ae4d6 100644 (file)
@@ -175,10 +175,6 @@ struct ehci_hcd {                  /* one per controller */
 #ifdef DEBUG
        struct dentry           *debug_dir;
 #endif
-       /*
-        * OTG controllers and transceivers need software interaction
-        */
-       struct usb_phy  *transceiver;
 };
 
 /* convert between an HCD pointer and the corresponding EHCI_HCD */
index 1e364ec962fb90ea75573c92fc6a92ec6b25612c..a446386bf779208518b760ffcfb94cc346dc4f5b 100644 (file)
 #define USB_HOST_NEED_CLK_EN   (1 << 21)
 #define PAD_CONTROL_LAST_DRIVEN        (1 << 19)
 
-#define USB_OTG_CLK_CTRL       IO_ADDRESS(USB_CONFIG_BASE + 0xFF4)
-#define USB_OTG_CLK_STAT       IO_ADDRESS(USB_CONFIG_BASE + 0xFF8)
-
-/* USB_OTG_CLK_CTRL bit defines */
-#define AHB_M_CLOCK_ON         (1 << 4)
-#define OTG_CLOCK_ON           (1 << 3)
-#define I2C_CLOCK_ON           (1 << 2)
-#define DEV_CLOCK_ON           (1 << 1)
-#define HOST_CLOCK_ON          (1 << 0)
-
 #define USB_OTG_STAT_CONTROL   IO_ADDRESS(USB_CONFIG_BASE + 0x110)
 
 /* USB_OTG_STAT_CONTROL bit defines */
@@ -72,7 +62,9 @@ static struct i2c_client *isp1301_i2c_client;
 
 extern int usb_disabled(void);
 
-static struct clk *usb_clk;
+static struct clk *usb_pll_clk;
+static struct clk *usb_dev_clk;
+static struct clk *usb_otg_clk;
 
 static void isp1301_configure_pnx4008(void)
 {
@@ -249,8 +241,6 @@ static const struct hc_driver ohci_nxp_hc_driver = {
        .start_port_reset = ohci_start_port_reset,
 };
 
-#define USB_CLOCK_MASK (AHB_M_CLOCK_ON| OTG_CLOCK_ON | HOST_CLOCK_ON | I2C_CLOCK_ON)
-
 static void nxp_set_usb_bits(void)
 {
        if (machine_is_pnx4008()) {
@@ -327,41 +317,63 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
        /* Enable AHB slave USB clock, needed for further USB clock control */
        __raw_writel(USB_SLAVE_HCLK_EN | PAD_CONTROL_LAST_DRIVEN, USB_CTRL);
 
-       isp1301_configure();
-
        /* Enable USB PLL */
-       usb_clk = clk_get(&pdev->dev, "ck_pll5");
-       if (IS_ERR(usb_clk)) {
+       usb_pll_clk = clk_get(&pdev->dev, "ck_pll5");
+       if (IS_ERR(usb_pll_clk)) {
                dev_err(&pdev->dev, "failed to acquire USB PLL\n");
-               ret = PTR_ERR(usb_clk);
+               ret = PTR_ERR(usb_pll_clk);
                goto out1;
        }
 
-       ret = clk_enable(usb_clk);
+       ret = clk_enable(usb_pll_clk);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to start USB PLL\n");
                goto out2;
        }
 
-       ret = clk_set_rate(usb_clk, 48000);
+       ret = clk_set_rate(usb_pll_clk, 48000);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to set USB clock rate\n");
                goto out3;
        }
 
+       /* Enable USB device clock */
+       usb_dev_clk = clk_get(&pdev->dev, "ck_usbd");
+       if (IS_ERR(usb_dev_clk)) {
+               dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
+               ret = PTR_ERR(usb_dev_clk);
+               goto out4;
+       }
+
+       ret = clk_enable(usb_dev_clk);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
+               goto out5;
+       }
+
+       /* Enable USB otg clocks */
+       usb_otg_clk = clk_get(&pdev->dev, "ck_usb_otg");
+       if (IS_ERR(usb_otg_clk)) {
+               dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
+               ret = PTR_ERR(usb_dev_clk);
+               goto out6;
+       }
+
        __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
 
-       /* Set to enable all needed USB clocks */
-       __raw_writel(USB_CLOCK_MASK, USB_OTG_CLK_CTRL);
+       ret = clk_enable(usb_otg_clk);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
+               goto out7;
+       }
 
-       while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) !=
-              USB_CLOCK_MASK) ;
+       isp1301_configure();
 
        hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
        if (!hcd) {
                dev_err(&pdev->dev, "Failed to allocate HC buffer\n");
                ret = -ENOMEM;
-               goto out3;
+               goto out8;
        }
 
        /* Set all USB bits in the Start Enable register */
@@ -371,14 +383,14 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
        if (!res) {
                dev_err(&pdev->dev, "Failed to get MEM resource\n");
                ret =  -ENOMEM;
-               goto out4;
+               goto out8;
        }
 
        hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
        if (!hcd->regs) {
                dev_err(&pdev->dev, "Failed to devm_request_and_ioremap\n");
                ret =  -ENOMEM;
-               goto out4;
+               goto out8;
        }
        hcd->rsrc_start = res->start;
        hcd->rsrc_len = resource_size(res);
@@ -386,7 +398,7 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
                ret = -ENXIO;
-               goto out4;
+               goto out8;
        }
 
        nxp_start_hc();
@@ -400,13 +412,21 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
                return ret;
 
        nxp_stop_hc();
-out4:
+out8:
        nxp_unset_usb_bits();
        usb_put_hcd(hcd);
+out7:
+       clk_disable(usb_otg_clk);
+out6:
+       clk_put(usb_otg_clk);
+out5:
+       clk_disable(usb_dev_clk);
+out4:
+       clk_put(usb_dev_clk);
 out3:
-       clk_disable(usb_clk);
+       clk_disable(usb_pll_clk);
 out2:
-       clk_put(usb_clk);
+       clk_put(usb_pll_clk);
 out1:
        isp1301_i2c_client = NULL;
 out:
@@ -422,8 +442,10 @@ static int usb_hcd_nxp_remove(struct platform_device *pdev)
        release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
        usb_put_hcd(hcd);
        nxp_unset_usb_bits();
-       clk_disable(usb_clk);
-       clk_put(usb_clk);
+       clk_disable(usb_pll_clk);
+       clk_put(usb_pll_clk);
+       clk_disable(usb_dev_clk);
+       clk_put(usb_dev_clk);
        i2c_unregister_device(isp1301_i2c_client);
        isp1301_i2c_client = NULL;
 
index 9ce35d0d9d5daad531209e6b651a1fcc714efb18..eccddb461396d58ee6b10636f2379e21c0f67fc0 100644 (file)
@@ -167,14 +167,15 @@ static int omap_1510_local_bus_init(void)
 
 static void start_hnp(struct ohci_hcd *ohci)
 {
-       const unsigned  port = ohci_to_hcd(ohci)->self.otg_port - 1;
+       struct usb_hcd *hcd = ohci_to_hcd(ohci);
+       const unsigned  port = hcd->self.otg_port - 1;
        unsigned long   flags;
        u32 l;
 
-       otg_start_hnp(ohci->transceiver->otg);
+       otg_start_hnp(hcd->phy->otg);
 
        local_irq_save(flags);
-       ohci->transceiver->state = OTG_STATE_A_SUSPEND;
+       hcd->phy->state = OTG_STATE_A_SUSPEND;
        writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]);
        l = omap_readl(OTG_CTRL);
        l &= ~OTG_A_BUSREQ;
@@ -211,18 +212,18 @@ static int ohci_omap_init(struct usb_hcd *hcd)
 
 #ifdef CONFIG_USB_OTG
        if (need_transceiver) {
-               ohci->transceiver = usb_get_transceiver();
-               if (ohci->transceiver) {
-                       int     status = otg_set_host(ohci->transceiver->otg,
+               hcd->phy = usb_get_transceiver();
+               if (hcd->phy) {
+                       int     status = otg_set_host(hcd->phy->otg,
                                                &ohci_to_hcd(ohci)->self);
-                       dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n",
-                                       ohci->transceiver->label, status);
+                       dev_dbg(hcd->self.controller, "init %s phy, status %d\n",
+                                       hcd->phy->label, status);
                        if (status) {
-                               usb_put_transceiver(ohci->transceiver);
+                               usb_put_transceiver(hcd->phy);
                                return status;
                        }
                } else {
-                       dev_err(hcd->self.controller, "can't find transceiver\n");
+                       dev_err(hcd->self.controller, "can't find phy\n");
                        return -ENODEV;
                }
                ohci->start_hnp = start_hnp;
@@ -403,9 +404,9 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
 
        usb_remove_hcd(hcd);
-       if (ohci->transceiver) {
-               (void) otg_set_host(ohci->transceiver->otg, 0);
-               usb_put_transceiver(ohci->transceiver);
+       if (hcd->phy) {
+               (void) otg_set_host(hcd->phy->otg, 0);
+               usb_put_transceiver(hcd->phy);
        }
        if (machine_is_omap_osk())
                gpio_free(9);
index 1b19aea25a2bc1281d601cbe64de7e74274c1a24..d3299143d9e2cbc8c0f4a2f307da6318252010b8 100644 (file)
@@ -372,11 +372,6 @@ struct ohci_hcd {
        struct ed               *ed_controltail;        /* last in ctrl list */
        struct ed               *periodic [NUM_INTS];   /* shadow int_table */
 
-       /*
-        * OTG controllers and transceivers need software interaction;
-        * other external transceivers should be software-transparent
-        */
-       struct usb_phy  *transceiver;
        void (*start_hnp)(struct ohci_hcd *ohci);
 
        /*
index a1b99243dac9e77ac83be2e1b94316ff5014601c..9a0ca83559053c47fb8866b9a66c617eeb11378f 100644 (file)
@@ -1036,15 +1036,12 @@ static int keyspan_write_room(struct tty_struct *tty)
 static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
 {
        struct keyspan_port_private     *p_priv;
-       struct keyspan_serial_private   *s_priv;
-       struct usb_serial               *serial = port->serial;
        const struct keyspan_device_details     *d_details;
        int                             i, err;
        int                             baud_rate, device_port;
        struct urb                      *urb;
        unsigned int                    cflag = 0;
 
-       s_priv = usb_get_serial_data(serial);
        p_priv = usb_get_serial_port_data(port);
        d_details = p_priv->device_details;
 
@@ -1130,10 +1127,8 @@ static void keyspan_close(struct usb_serial_port *port)
 {
        int                     i;
        struct usb_serial       *serial = port->serial;
-       struct keyspan_serial_private   *s_priv;
        struct keyspan_port_private     *p_priv;
 
-       s_priv = usb_get_serial_data(serial);
        p_priv = usb_get_serial_port_data(port);
 
        p_priv->rts_state = 0;
index e668a2460bd456a80ef2140f8c2693172d58ad1a..9520c4c547431639b7e49217f208a732ef74b126 100644 (file)
@@ -1276,6 +1276,10 @@ static struct usb_serial_driver * const serial_drivers[] = {
 
 static bool debug;
 
+struct option_private {
+       u8 bInterfaceNumber;
+};
+
 module_usb_serial_driver(serial_drivers, option_ids);
 
 static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
@@ -1306,51 +1310,78 @@ static int option_probe(struct usb_serial *serial,
                        const struct usb_device_id *id)
 {
        struct usb_wwan_intf_private *data;
-
-       /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */
-       if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID &&
-               serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 &&
-               serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8)
+       struct option_private *priv;
+       struct usb_interface_descriptor *iface_desc =
+                               &serial->interface->cur_altsetting->desc;
+       struct usb_device_descriptor *dev_desc = &serial->dev->descriptor;
+
+       /*
+        * D-Link DWM 652 still exposes CD-Rom emulation interface in modem
+        * mode.
+        */
+       if (dev_desc->idVendor == DLINK_VENDOR_ID &&
+               dev_desc->idProduct == DLINK_PRODUCT_DWM_652 &&
+               iface_desc->bInterfaceClass == 0x08)
                return -ENODEV;
 
        /* Bandrich modem and AT command interface is 0xff */
-       if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID ||
-               serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) &&
-               serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff)
+       if ((dev_desc->idVendor == BANDRICH_VENDOR_ID ||
+               dev_desc->idVendor == PIRELLI_VENDOR_ID) &&
+               iface_desc->bInterfaceClass != 0xff)
                return -ENODEV;
-
-       /* Don't bind reserved interfaces (like network ones) which often have
+       /*
+        * Don't bind reserved interfaces (like network ones) which often have
         * the same class/subclass/protocol as the serial interfaces.  Look at
         * the Windows driver .INF files for reserved interface numbers.
         */
        if (is_blacklisted(
-               serial->interface->cur_altsetting->desc.bInterfaceNumber,
+               iface_desc->bInterfaceNumber,
                OPTION_BLACKLIST_RESERVED_IF,
                (const struct option_blacklist_info *) id->driver_info))
                return -ENODEV;
-
-       /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */
-       if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID &&
-               serial->dev->descriptor.idProduct == SAMSUNG_PRODUCT_GT_B3730 &&
-               serial->interface->cur_altsetting->desc.bInterfaceClass != USB_CLASS_CDC_DATA)
+       /*
+        * Don't bind network interface on Samsung GT-B3730, it is handled by
+        * a separate module.
+        */
+       if (dev_desc->idVendor == SAMSUNG_VENDOR_ID &&
+               dev_desc->idProduct == SAMSUNG_PRODUCT_GT_B3730 &&
+               iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
                return -ENODEV;
 
-       data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
+       data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
        if (!data)
                return -ENOMEM;
-       data->send_setup = option_send_setup;
+
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+       if (!priv) {
+               kfree(data);
+               return -ENOMEM;
+       }
+
+       priv->bInterfaceNumber = iface_desc->bInterfaceNumber;
+       data->private = priv;
+
+       if (!is_blacklisted(iface_desc->bInterfaceNumber,
+                       OPTION_BLACKLIST_SENDSETUP,
+                       (struct option_blacklist_info *)id->driver_info)) {
+               data->send_setup = option_send_setup;
+       }
        spin_lock_init(&data->susp_lock);
-       data->private = (void *)id->driver_info;
+
+       usb_set_serial_data(serial, data);
+
        return 0;
 }
 
 static void option_release(struct usb_serial *serial)
 {
-       struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
+       struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
+       struct option_private *priv = intfdata->private;
 
        usb_wwan_release(serial);
 
        kfree(priv);
+       kfree(intfdata);
 }
 
 static void option_instat_callback(struct urb *urb)
@@ -1417,18 +1448,11 @@ static void option_instat_callback(struct urb *urb)
 static int option_send_setup(struct usb_serial_port *port)
 {
        struct usb_serial *serial = port->serial;
-       struct usb_wwan_intf_private *intfdata =
-               (struct usb_wwan_intf_private *) serial->private;
+       struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
+       struct option_private *priv = intfdata->private;
        struct usb_wwan_port_private *portdata;
-       int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
        int val = 0;
 
-       if (is_blacklisted(ifNum, OPTION_BLACKLIST_SENDSETUP,
-                       (struct option_blacklist_info *) intfdata->private)) {
-               dbg("No send_setup on blacklisted interface #%d\n", ifNum);
-               return -EIO;
-       }
-
        portdata = usb_get_serial_port_data(port);
 
        if (portdata->dtr_state)
@@ -1436,9 +1460,9 @@ static int option_send_setup(struct usb_serial_port *port)
        if (portdata->rts_state)
                val |= 0x02;
 
-       return usb_control_msg(serial->dev,
-               usb_rcvctrlpipe(serial->dev, 0),
-               0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT);
+       return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+                               0x22, 0x21, val, priv->bInterfaceNumber, NULL,
+                               0, USB_CTRL_SET_TIMEOUT);
 }
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
index 8dd88ebe9863d34e5ca786417389a127d9900075..151670b6b72a9871bcf88fd5e611b3247bae9904 100644 (file)
@@ -345,7 +345,6 @@ static void qt2_set_termios(struct tty_struct *tty,
 static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
 {
        struct usb_serial *serial;
-       struct qt2_serial_private *serial_priv;
        struct qt2_port_private *port_priv;
        u8 *data;
        u16 device_port;
@@ -357,7 +356,6 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
        serial = port->serial;
 
        port_priv = usb_get_serial_port_data(port);
-       serial_priv = usb_get_serial_data(serial);
 
        /* set the port to RS232 mode */
        status = qt2_control_msg(serial->dev, QT2_GET_SET_QMCR,
@@ -417,13 +415,11 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
 static void qt2_close(struct usb_serial_port *port)
 {
        struct usb_serial *serial;
-       struct qt2_serial_private *serial_priv;
        struct qt2_port_private *port_priv;
        unsigned long flags;
        int i;
 
        serial = port->serial;
-       serial_priv = usb_get_serial_data(serial);
        port_priv = usb_get_serial_port_data(port);
 
        port_priv->is_open = false;
index 82dd834709c78f7627b82a53d5e268fb006744a2..5dfb4c36a1b0a2aeb55dd4863c33fae132d2ce7b 100644 (file)
@@ -66,7 +66,7 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
         * NOTE: This only works because a scsi_cmnd struct field contains
         * a unsigned char cmnd[16], so we know we have storage available
         */
-       for (; srb->cmd_len<12; srb->cmd_len++)
+       for (; srb->cmd_len < 12; srb->cmd_len++)
                srb->cmnd[srb->cmd_len] = 0;
 
        /* send the command to the transport layer */
@@ -76,14 +76,14 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
 void usb_stor_ufi_command(struct scsi_cmnd *srb, struct us_data *us)
 {
        /* fix some commands -- this is a form of mode translation
-        * UFI devices only accept 12 byte long commands 
+        * UFI devices only accept 12 byte long commands
         *
         * NOTE: This only works because a scsi_cmnd struct field contains
         * a unsigned char cmnd[16], so we know we have storage available
         */
 
        /* Pad the ATAPI command with zeros */
-       for (; srb->cmd_len<12; srb->cmd_len++)
+       for (; srb->cmd_len < 12; srb->cmd_len++)
                srb->cmnd[srb->cmd_len] = 0;
 
        /* set command length to 12 bytes (this affects the transport layer) */
index 5db93821f9c7d473d1d4fe87f9e3fc5d988044bb..6955045199b09c006bce030bf21b8b0bdb011d15 100644 (file)
@@ -78,6 +78,9 @@ struct ieee1394_device_id {
  *     of a given interface; other interfaces may support other classes.
  * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
  * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
+ * @bInterfaceNumber: Number of interface; composite devices may use
+ *     fixed interface numbers to differentiate between vendor-specific
+ *     interfaces.
  * @driver_info: Holds information used by the driver.  Usually it holds
  *     a pointer to a descriptor understood by the driver, or perhaps
  *     device flags.
@@ -115,8 +118,12 @@ struct usb_device_id {
        __u8            bInterfaceSubClass;
        __u8            bInterfaceProtocol;
 
+       /* Used for vendor-specific interface matches */
+       __u8            bInterfaceNumber;
+
        /* not matched against */
-       kernel_ulong_t  driver_info;
+       kernel_ulong_t  driver_info
+               __attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
 /* Some useful macros to use to create struct usb_device_id */
@@ -130,6 +137,7 @@ struct usb_device_id {
 #define USB_DEVICE_ID_MATCH_INT_CLASS          0x0080
 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS       0x0100
 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL       0x0200
+#define USB_DEVICE_ID_MATCH_INT_NUMBER         0x0400
 
 #define HID_ANY_ID                             (~0)
 #define HID_BUS_ANY                            0xffff
index dea39dc551d44c3602f1b7c33800dfba57a0a5b3..f717fbdaee8e1726ef6e1ce08ce9175b4765b205 100644 (file)
@@ -776,6 +776,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
        .idProduct = (prod), \
        .bInterfaceProtocol = (pr)
 
+/**
+ * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ * @num: bInterfaceNumber value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific interface number of devices.
+ */
+#define USB_DEVICE_INTERFACE_NUMBER(vend, prod, num) \
+       .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
+                      USB_DEVICE_ID_MATCH_INT_NUMBER, \
+       .idVendor = (vend), \
+       .idProduct = (prod), \
+       .bInterfaceNumber = (num)
+
 /**
  * USB_DEVICE_INFO - macro used to describe a class of usb devices
  * @cl: bDeviceClass value
index 49b3ac29726adf3040d47384b51948401ac44887..c5fdb148fc02ccea72ca2b911caa0ab0f7f4be88 100644 (file)
@@ -93,6 +93,12 @@ struct usb_hcd {
         */
        const struct hc_driver  *driver;        /* hw-specific hooks */
 
+       /*
+        * OTG and some Host controllers need software interaction with phys;
+        * other external phys should be software-transparent
+        */
+       struct usb_phy  *phy;
+
        /* Flags that need to be manipulated atomically because they can
         * change while the host controller is running.  Always use
         * set_bit() or clear_bit() to change their values.
index 547e59cc00eadfb4a9992f5238fc2b42e7646314..c5d36c65c33bfe7e77f6a984a66f7a06e1683f84 100644 (file)
@@ -132,6 +132,14 @@ struct renesas_usbhs_driver_param {
         * option:
         *
         * dma id for dmaengine
+        * The data transfer direction on D0FIFO/D1FIFO should be
+        * fixed for keeping consistency.
+        * So, the platform id settings will be..
+        *      .d0_tx_id = xx_TX,
+        *      .d1_rx_id = xx_RX,
+        * or
+        *      .d1_tx_id = xx_TX,
+        *      .d0_rx_id = xx_RX,
         */
        int d0_tx_id;
        int d0_rx_id;
index 5759751a1f61212ec02e16de995a8a0482b37c11..7ed6864ef65b7372a0e671280fe80a35794606ae 100644 (file)
@@ -156,7 +156,7 @@ static void device_id_check(const char *modname, const char *device_id,
 }
 
 /* USB is special because the bcdDevice can be matched against a numeric range */
-/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipN" */
+/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipNinN" */
 static void do_usb_entry(struct usb_device_id *id,
                         unsigned int bcdDevice_initial, int bcdDevice_initial_digits,
                         unsigned char range_lo, unsigned char range_hi,
@@ -210,6 +210,9 @@ static void do_usb_entry(struct usb_device_id *id,
        ADD(alias, "ip",
            id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL,
            id->bInterfaceProtocol);
+       ADD(alias, "in",
+           id->match_flags&USB_DEVICE_ID_MATCH_INT_NUMBER,
+           id->bInterfaceNumber);
 
        add_wildcard(alias);
        buf_printf(&mod->dev_table_buf,
index 82d7c590c02601c17477fff14ce7643d8af69a22..b0adb2710c0220660b0e76bc7a1d6cab73916c34 100644 (file)
@@ -425,7 +425,7 @@ int main (int argc, char **argv)
        /* for easy use when hotplugging */
        device = getenv ("DEVICE");
 
-       while ((c = getopt (argc, argv, "D:aA:c:g:hns:t:v:")) != EOF)
+       while ((c = getopt (argc, argv, "D:aA:c:g:hlns:t:v:")) != EOF)
        switch (c) {
        case 'D':       /* device, if only one */
                device = optarg;
@@ -468,10 +468,21 @@ int main (int argc, char **argv)
        case 'h':
        default:
 usage:
-               fprintf (stderr, "usage: %s [-n] [-D dev | -a | -A usbfs-dir]\n"
-                       "\t[-c iterations]  [-t testnum]\n"
-                       "\t[-s packetsize] [-g sglen] [-v vary]\n",
-                       argv [0]);
+               fprintf (stderr,
+                       "usage: %s [options]\n"
+                       "Options:\n"
+                       "\t-D dev               only test specific device\n"
+                       "\t-A usbfs-dir\n"
+                       "\t-a           test all recognized devices\n"
+                       "\t-l           loop forever(for stress test)\n"
+                       "\t-t testnum   only run specified case\n"
+                       "\t-n           no test running, show devices to be tested\n"
+                       "Case arguments:\n"
+                       "\t-c iterations        default 1000\n"
+                       "\t-s packetsize        default 512\n"
+                       "\t-g sglen     default 32\n"
+                       "\t-v vary              default 512\n",
+                       argv[0]);
                return 1;
        }
        if (optind != argc)