Merge 5.4-rc6 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Nov 2019 05:41:09 +0000 (06:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Nov 2019 05:41:09 +0000 (06:41 +0100)
We need the USB fixes in here to build on top of.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
53 files changed:
Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb3.txt
Documentation/devicetree/bindings/usb/renesas,usb3-peri.txt
Documentation/devicetree/bindings/usb/renesas,usbhs.txt
Documentation/devicetree/bindings/usb/ti,hd3ss3220.txt [new file with mode: 0644]
Documentation/devicetree/bindings/usb/usb-xhci.txt
Documentation/devicetree/bindings/usb/usb251xb.txt
drivers/usb/chipidea/ci_hdrc_tegra.c
drivers/usb/core/config.c
drivers/usb/core/devio.c
drivers/usb/core/hub.c
drivers/usb/dwc3/Kconfig
drivers/usb/gadget/legacy/Kconfig
drivers/usb/gadget/legacy/acm_ms.c
drivers/usb/gadget/legacy/mass_storage.c
drivers/usb/gadget/udc/Kconfig
drivers/usb/gadget/udc/at91_udc.c
drivers/usb/gadget/udc/bcm63xx_udc.c
drivers/usb/gadget/udc/bdc/bdc_core.c
drivers/usb/gadget/udc/bdc/bdc_udc.c
drivers/usb/gadget/udc/gr_udc.c
drivers/usb/gadget/udc/pxa25x_udc.c
drivers/usb/gadget/udc/pxa27x_udc.c
drivers/usb/gadget/udc/r8a66597-udc.c
drivers/usb/gadget/udc/renesas_usb3.c
drivers/usb/gadget/udc/s3c-hsudc.c
drivers/usb/host/Kconfig
drivers/usb/host/isp1362-hcd.c
drivers/usb/host/ohci-at91.c
drivers/usb/host/u132-hcd.c
drivers/usb/host/xhci-tegra.c
drivers/usb/image/microtek.c
drivers/usb/isp1760/isp1760-hcd.c
drivers/usb/misc/Kconfig
drivers/usb/misc/ftdi-elan.c
drivers/usb/misc/sisusbvga/Kconfig
drivers/usb/misc/usb251xb.c
drivers/usb/mtu3/mtu3_gadget_ep0.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_gadget.c
drivers/usb/phy/phy-keystone.c
drivers/usb/phy/phy-mxs-usb.c
drivers/usb/renesas_usbhs/common.c
drivers/usb/renesas_usbhs/common.h
drivers/usb/renesas_usbhs/mod.c
drivers/usb/renesas_usbhs/mod_gadget.c
drivers/usb/serial/Kconfig
drivers/usb/storage/scsiglue.c
drivers/usb/typec/Kconfig
drivers/usb/typec/Makefile
drivers/usb/typec/hd3ss3220.c [new file with mode: 0644]
drivers/usb/usbip/stub_tx.c

index 372f0eeb5a2ad10209364275ce1bee72dc5489f3..f1f95f6787393b8ee654d9e58a924b2adbcfbb6f 100644 (file)
@@ -8,6 +8,7 @@ Required Properties:
          - "renesas,r8a7745-usb-dmac" (RZ/G1E)
          - "renesas,r8a77470-usb-dmac" (RZ/G1C)
          - "renesas,r8a774a1-usb-dmac" (RZ/G2M)
+         - "renesas,r8a774b1-usb-dmac" (RZ/G2N)
          - "renesas,r8a774c0-usb-dmac" (RZ/G2E)
          - "renesas,r8a7790-usb-dmac" (R-Car H2)
          - "renesas,r8a7791-usb-dmac" (R-Car M2-W)
index 503a8cfb31843e5532d3a611b82745f84c926418..7734b219d9aa0232709855cd955a07300728e463 100644 (file)
@@ -10,6 +10,8 @@ Required properties:
              SoC.
              "renesas,usb2-phy-r8a774a1" if the device is a part of an R8A774A1
              SoC.
+             "renesas,usb2-phy-r8a774b1" if the device is a part of an R8A774B1
+             SoC.
              "renesas,usb2-phy-r8a774c0" if the device is a part of an R8A774C0
              SoC.
              "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795
index 9d9826609c2f9a6cfe5ee10fb89db2d39cf49e93..0fe433b9a59256049684f1ba5aa7e5262a27c064 100644 (file)
@@ -8,6 +8,8 @@ need this driver.
 
 Required properties:
 - compatible: "renesas,r8a774a1-usb3-phy" if the device is a part of an R8A774A1
+             SoC.
+             "renesas,r8a774b1-usb3-phy" if the device is a part of an R8A774B1
              SoC.
              "renesas,r8a7795-usb3-phy" if the device is a part of an R8A7795
              SoC.
index 35039e7205150ea082ef5783b327397701947fb3..1343dfcaa19c81f397106eb8739b2530297a6a4b 100644 (file)
@@ -3,6 +3,7 @@ Renesas Electronics USB3.0 Peripheral driver
 Required properties:
   - compatible: Must contain one of the following:
        - "renesas,r8a774a1-usb3-peri"
+       - "renesas,r8a774b1-usb3-peri"
        - "renesas,r8a774c0-usb3-peri"
        - "renesas,r8a7795-usb3-peri"
        - "renesas,r8a7796-usb3-peri"
@@ -22,6 +23,12 @@ Required properties:
 Optional properties:
   - phys: phandle + phy specifier pair
   - phy-names: must be "usb"
+  - usb-role-switch: support role switch. see usb/generic.txt
+
+Sub-nodes:
+- any connector to the data bus of this controller should be modelled using the
+  OF graph bindings specified in bindings/graph.txt, if the "usb-role-switch"
+  property is used.
 
 Example of R-Car H3 ES1.x:
        usb3_peri0: usb@ee020000 {
@@ -39,3 +46,20 @@ Example of R-Car H3 ES1.x:
                interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cpg CPG_MOD 327>;
        };
+
+Example of RZ/G2E:
+       usb3_peri0: usb@ee020000 {
+               compatible = "renesas,r8a774c0-usb3-peri",
+                            "renesas,rcar-gen3-usb3-peri";
+               reg = <0 0xee020000 0 0x400>;
+               interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cpg CPG_MOD 328>;
+               companion = <&xhci0>;
+               usb-role-switch;
+
+               port {
+                       usb3_role_switch: endpoint {
+                               remote-endpoint = <&hd3ss3220_ep>;
+                       };
+               };
+       };
index e39255ea6e4f1bdd27d434b4d4dbcdba44d968b6..06abe9901dfbf422a25e3c0aa6460cf92c8a585b 100644 (file)
@@ -8,6 +8,7 @@ Required properties:
        - "renesas,usbhs-r8a7745" for r8a7745 (RZ/G1E) compatible device
        - "renesas,usbhs-r8a77470" for r8a77470 (RZ/G1C) compatible device
        - "renesas,usbhs-r8a774a1" for r8a774a1 (RZ/G2M) compatible device
+       - "renesas,usbhs-r8a774b1" for r8a774b1 (RZ/G2N) compatible device
        - "renesas,usbhs-r8a774c0" for r8a774c0 (RZ/G2E) compatible device
        - "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
        - "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
diff --git a/Documentation/devicetree/bindings/usb/ti,hd3ss3220.txt b/Documentation/devicetree/bindings/usb/ti,hd3ss3220.txt
new file mode 100644 (file)
index 0000000..25780e9
--- /dev/null
@@ -0,0 +1,38 @@
+TI HD3SS3220 TypeC DRP Port Controller.
+
+Required properties:
+ - compatible: Must be "ti,hd3ss3220".
+ - reg: I2C slave address, must be 0x47 or 0x67 based on ADDR pin.
+ - interrupts: An interrupt specifier.
+
+Required sub-node:
+ - connector: The "usb-c-connector" attached to the hd3ss3220 chip. The
+   bindings of the connector node are specified in:
+
+       Documentation/devicetree/bindings/connector/usb-connector.txt
+
+Example:
+hd3ss3220@47 {
+       compatible = "ti,hd3ss3220";
+       reg = <0x47>;
+       interrupt-parent = <&gpio6>;
+       interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+
+       connector {
+               compatible = "usb-c-connector";
+               label = "USB-C";
+               data-role = "dual";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@1 {
+                               reg = <1>;
+                               hd3ss3220_ep: endpoint {
+                                       remote-endpoint = <&usb3_role_switch>;
+                               };
+                       };
+               };
+       };
+};
index b49b819571f9c5bfe3d699c6486b6474edaef2b6..3f378951d624bfc6b45035a23e77dc0c42a33b62 100644 (file)
@@ -10,6 +10,7 @@ Required properties:
     - "renesas,xhci-r8a7743" for r8a7743 SoC
     - "renesas,xhci-r8a7744" for r8a7744 SoC
     - "renesas,xhci-r8a774a1" for r8a774a1 SoC
+    - "renesas,xhci-r8a774b1" for r8a774b1 SoC
     - "renesas,xhci-r8a774c0" for r8a774c0 SoC
     - "renesas,xhci-r8a7790" for r8a7790 SoC
     - "renesas,xhci-r8a7791" for r8a7791 SoC
index 17915f64b8ee3c628e6c7e86385d31a942d11067..4d5808b1cee0fc630d2b2171f1b0a0ff416de486 100644 (file)
@@ -12,6 +12,7 @@ Required properties :
 
 Optional properties :
  - reset-gpios : Should specify the gpio for hub reset
+ - vdd-supply : Should specify the phandle to the regulator supplying vdd
  - skip-config : Skip Hub configuration, but only send the USB-Attach command
  - vendor-id : Set USB Vendor ID of the hub (16 bit, default is 0x0424)
  - product-id : Set USB Product ID of the hub (16 bit, default depends on type)
index 12025358bb3c23e7d66b167084e41f5f4d685c31..0c9911d44ee56aede77f7a52c4e09c8822246afb 100644 (file)
@@ -24,35 +24,23 @@ struct tegra_udc_soc_info {
        unsigned long flags;
 };
 
-static const struct tegra_udc_soc_info tegra20_udc_soc_info = {
-       .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
-};
-
-static const struct tegra_udc_soc_info tegra30_udc_soc_info = {
-       .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
-};
-
-static const struct tegra_udc_soc_info tegra114_udc_soc_info = {
-       .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
-};
-
-static const struct tegra_udc_soc_info tegra124_udc_soc_info = {
+static const struct tegra_udc_soc_info tegra_udc_soc_info = {
        .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
 };
 
 static const struct of_device_id tegra_udc_of_match[] = {
        {
                .compatible = "nvidia,tegra20-udc",
-               .data = &tegra20_udc_soc_info,
+               .data = &tegra_udc_soc_info,
        }, {
                .compatible = "nvidia,tegra30-udc",
-               .data = &tegra30_udc_soc_info,
+               .data = &tegra_udc_soc_info,
        }, {
                .compatible = "nvidia,tegra114-udc",
-               .data = &tegra114_udc_soc_info,
+               .data = &tegra_udc_soc_info,
        }, {
                .compatible = "nvidia,tegra124-udc",
-               .data = &tegra124_udc_soc_info,
+               .data = &tegra_udc_soc_info,
        }, {
                /* sentinel */
        }
index 1ac1095bfeac8448ff7fae2179a033fb558bb6ff..5f40117e68e76e07949d95182abfe39af7936a21 100644 (file)
@@ -805,10 +805,10 @@ int usb_get_configuration(struct usb_device *dev)
 {
        struct device *ddev = &dev->dev;
        int ncfg = dev->descriptor.bNumConfigurations;
-       int result = -ENOMEM;
        unsigned int cfgno, length;
        unsigned char *bigbuffer;
        struct usb_config_descriptor *desc;
+       int result;
 
        if (ncfg > USB_MAXCONFIG) {
                dev_warn(ddev, "too many configurations: %d, "
@@ -824,16 +824,16 @@ int usb_get_configuration(struct usb_device *dev)
        length = ncfg * sizeof(struct usb_host_config);
        dev->config = kzalloc(length, GFP_KERNEL);
        if (!dev->config)
-               goto err2;
+               return -ENOMEM;
 
        length = ncfg * sizeof(char *);
        dev->rawdescriptors = kzalloc(length, GFP_KERNEL);
        if (!dev->rawdescriptors)
-               goto err2;
+               return -ENOMEM;
 
        desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
        if (!desc)
-               goto err2;
+               return -ENOMEM;
 
        for (cfgno = 0; cfgno < ncfg; cfgno++) {
                /* We grab just the first descriptor so we know how long
@@ -895,9 +895,7 @@ int usb_get_configuration(struct usb_device *dev)
 err:
        kfree(desc);
        dev->descriptor.bNumConfigurations = cfgno;
-err2:
-       if (result == -ENOMEM)
-               dev_err(ddev, "out of memory\n");
+
        return result;
 }
 
index 3f899552f6e3c2a8e9a1c58db09c61b5be4bd927..879d03f5127c7e8963a0523d9c18b4f622e0470f 100644 (file)
@@ -764,8 +764,15 @@ static int claimintf(struct usb_dev_state *ps, unsigned int ifnum)
        intf = usb_ifnum_to_if(dev, ifnum);
        if (!intf)
                err = -ENOENT;
-       else
+       else {
+               unsigned int old_suppress;
+
+               /* suppress uevents while claiming interface */
+               old_suppress = dev_get_uevent_suppress(&intf->dev);
+               dev_set_uevent_suppress(&intf->dev, 1);
                err = usb_driver_claim_interface(&usbfs_driver, intf, ps);
+               dev_set_uevent_suppress(&intf->dev, old_suppress);
+       }
        if (err == 0)
                set_bit(ifnum, &ps->ifclaimed);
        return err;
@@ -785,7 +792,13 @@ static int releaseintf(struct usb_dev_state *ps, unsigned int ifnum)
        if (!intf)
                err = -ENOENT;
        else if (test_and_clear_bit(ifnum, &ps->ifclaimed)) {
+               unsigned int old_suppress;
+
+               /* suppress uevents while releasing interface */
+               old_suppress = dev_get_uevent_suppress(&intf->dev);
+               dev_set_uevent_suppress(&intf->dev, 1);
                usb_driver_release_interface(&usbfs_driver, intf);
+               dev_set_uevent_suppress(&intf->dev, old_suppress);
                err = 0;
        }
        return err;
@@ -1550,10 +1563,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
                uurb->buffer_length = le16_to_cpu(dr->wLength);
                uurb->buffer += 8;
                if ((dr->bRequestType & USB_DIR_IN) && uurb->buffer_length) {
-                       is_in = 1;
+                       is_in = true;
                        uurb->endpoint |= USB_DIR_IN;
                } else {
-                       is_in = 0;
+                       is_in = false;
                        uurb->endpoint &= ~USB_DIR_IN;
                }
                if (is_in)
index 236313f41f4a12ca0a4d78eba5526facfcb9f629..fdcfa85b5b12e7fd7b09fd9fd380cad101ae548a 100644 (file)
@@ -4930,6 +4930,91 @@ hub_power_remaining(struct usb_hub *hub)
        return remaining;
 }
 
+
+static int descriptors_changed(struct usb_device *udev,
+               struct usb_device_descriptor *old_device_descriptor,
+               struct usb_host_bos *old_bos)
+{
+       int             changed = 0;
+       unsigned        index;
+       unsigned        serial_len = 0;
+       unsigned        len;
+       unsigned        old_length;
+       int             length;
+       char            *buf;
+
+       if (memcmp(&udev->descriptor, old_device_descriptor,
+                       sizeof(*old_device_descriptor)) != 0)
+               return 1;
+
+       if ((old_bos && !udev->bos) || (!old_bos && udev->bos))
+               return 1;
+       if (udev->bos) {
+               len = le16_to_cpu(udev->bos->desc->wTotalLength);
+               if (len != le16_to_cpu(old_bos->desc->wTotalLength))
+                       return 1;
+               if (memcmp(udev->bos->desc, old_bos->desc, len))
+                       return 1;
+       }
+
+       /* Since the idVendor, idProduct, and bcdDevice values in the
+        * device descriptor haven't changed, we will assume the
+        * Manufacturer and Product strings haven't changed either.
+        * But the SerialNumber string could be different (e.g., a
+        * different flash card of the same brand).
+        */
+       if (udev->serial)
+               serial_len = strlen(udev->serial) + 1;
+
+       len = serial_len;
+       for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
+               old_length = le16_to_cpu(udev->config[index].desc.wTotalLength);
+               len = max(len, old_length);
+       }
+
+       buf = kmalloc(len, GFP_NOIO);
+       if (!buf)
+               /* assume the worst */
+               return 1;
+
+       for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
+               old_length = le16_to_cpu(udev->config[index].desc.wTotalLength);
+               length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf,
+                               old_length);
+               if (length != old_length) {
+                       dev_dbg(&udev->dev, "config index %d, error %d\n",
+                                       index, length);
+                       changed = 1;
+                       break;
+               }
+               if (memcmp(buf, udev->rawdescriptors[index], old_length)
+                               != 0) {
+                       dev_dbg(&udev->dev, "config index %d changed (#%d)\n",
+                               index,
+                               ((struct usb_config_descriptor *) buf)->
+                                       bConfigurationValue);
+                       changed = 1;
+                       break;
+               }
+       }
+
+       if (!changed && serial_len) {
+               length = usb_string(udev, udev->descriptor.iSerialNumber,
+                               buf, serial_len);
+               if (length + 1 != serial_len) {
+                       dev_dbg(&udev->dev, "serial string error %d\n",
+                                       length);
+                       changed = 1;
+               } else if (memcmp(buf, udev->serial, length) != 0) {
+                       dev_dbg(&udev->dev, "serial string changed\n");
+                       changed = 1;
+               }
+       }
+
+       kfree(buf);
+       return changed;
+}
+
 static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
                u16 portchange)
 {
@@ -5167,7 +5252,9 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 {
        struct usb_port *port_dev = hub->ports[port1 - 1];
        struct usb_device *udev = port_dev->child;
+       struct usb_device_descriptor descriptor;
        int status = -ENODEV;
+       int retval;
 
        dev_dbg(&port_dev->dev, "status %04x, change %04x, %s\n", portstatus,
                        portchange, portspeed(hub, portstatus));
@@ -5188,7 +5275,30 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
        if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
                        udev->state != USB_STATE_NOTATTACHED) {
                if (portstatus & USB_PORT_STAT_ENABLE) {
-                       status = 0;             /* Nothing to do */
+                       /*
+                        * USB-3 connections are initialized automatically by
+                        * the hostcontroller hardware. Therefore check for
+                        * changed device descriptors before resuscitating the
+                        * device.
+                        */
+                       descriptor = udev->descriptor;
+                       retval = usb_get_device_descriptor(udev,
+                                       sizeof(udev->descriptor));
+                       if (retval < 0) {
+                               dev_dbg(&udev->dev,
+                                               "can't read device descriptor %d\n",
+                                               retval);
+                       } else {
+                               if (descriptors_changed(udev, &descriptor,
+                                               udev->bos)) {
+                                       dev_dbg(&udev->dev,
+                                                       "device descriptor has changed\n");
+                                       /* for disconnect() calls */
+                                       udev->descriptor = descriptor;
+                               } else {
+                                       status = 0; /* Nothing to do */
+                               }
+                       }
 #ifdef CONFIG_PM
                } else if (udev->state == USB_STATE_SUSPENDED &&
                                udev->persist_enabled) {
@@ -5550,90 +5660,6 @@ void usb_hub_cleanup(void)
        usb_deregister(&hub_driver);
 } /* usb_hub_cleanup() */
 
-static int descriptors_changed(struct usb_device *udev,
-               struct usb_device_descriptor *old_device_descriptor,
-               struct usb_host_bos *old_bos)
-{
-       int             changed = 0;
-       unsigned        index;
-       unsigned        serial_len = 0;
-       unsigned        len;
-       unsigned        old_length;
-       int             length;
-       char            *buf;
-
-       if (memcmp(&udev->descriptor, old_device_descriptor,
-                       sizeof(*old_device_descriptor)) != 0)
-               return 1;
-
-       if ((old_bos && !udev->bos) || (!old_bos && udev->bos))
-               return 1;
-       if (udev->bos) {
-               len = le16_to_cpu(udev->bos->desc->wTotalLength);
-               if (len != le16_to_cpu(old_bos->desc->wTotalLength))
-                       return 1;
-               if (memcmp(udev->bos->desc, old_bos->desc, len))
-                       return 1;
-       }
-
-       /* Since the idVendor, idProduct, and bcdDevice values in the
-        * device descriptor haven't changed, we will assume the
-        * Manufacturer and Product strings haven't changed either.
-        * But the SerialNumber string could be different (e.g., a
-        * different flash card of the same brand).
-        */
-       if (udev->serial)
-               serial_len = strlen(udev->serial) + 1;
-
-       len = serial_len;
-       for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
-               old_length = le16_to_cpu(udev->config[index].desc.wTotalLength);
-               len = max(len, old_length);
-       }
-
-       buf = kmalloc(len, GFP_NOIO);
-       if (!buf)
-               /* assume the worst */
-               return 1;
-
-       for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
-               old_length = le16_to_cpu(udev->config[index].desc.wTotalLength);
-               length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf,
-                               old_length);
-               if (length != old_length) {
-                       dev_dbg(&udev->dev, "config index %d, error %d\n",
-                                       index, length);
-                       changed = 1;
-                       break;
-               }
-               if (memcmp(buf, udev->rawdescriptors[index], old_length)
-                               != 0) {
-                       dev_dbg(&udev->dev, "config index %d changed (#%d)\n",
-                               index,
-                               ((struct usb_config_descriptor *) buf)->
-                                       bConfigurationValue);
-                       changed = 1;
-                       break;
-               }
-       }
-
-       if (!changed && serial_len) {
-               length = usb_string(udev, udev->descriptor.iSerialNumber,
-                               buf, serial_len);
-               if (length + 1 != serial_len) {
-                       dev_dbg(&udev->dev, "serial string error %d\n",
-                                       length);
-                       changed = 1;
-               } else if (memcmp(buf, udev->serial, length) != 0) {
-                       dev_dbg(&udev->dev, "serial string changed\n");
-                       changed = 1;
-               }
-       }
-
-       kfree(buf);
-       return changed;
-}
-
 /**
  * usb_reset_and_verify_device - perform a USB port reset to reinitialize a device
  * @udev: device to reset (not in SUSPENDED or NOTATTACHED state)
index 556a876c7896251811288f99968f8636ecf310b6..0d97e6bfaf36181ae602af958ab5d1b7c7051da6 100644 (file)
@@ -104,7 +104,7 @@ config USB_DWC3_MESON_G12A
        select USB_ROLE_SWITCH
        select REGMAP_MMIO
        help
-         Support USB2/3 functionality in Amlogic G12A platforms.
+        Support USB2/3 functionality in Amlogic G12A platforms.
         Say 'Y' or 'M' if you have one such device.
 
 config USB_DWC3_OF_SIMPLE
@@ -112,7 +112,7 @@ config USB_DWC3_OF_SIMPLE
        depends on OF && COMMON_CLK
        default USB_DWC3
        help
-         Support USB2/3 functionality in simple SoC integrations.
+        Support USB2/3 functionality in simple SoC integrations.
         Currently supports Xilinx and Qualcomm DWC USB3 IP.
         Say 'Y' or 'M' if you have one such device.
 
index 69ff7f8c86f5090d64e5ba6485fe922bde12080a..38eaa9417b385b721e68e17ed470a6282cf132ae 100644 (file)
@@ -154,16 +154,16 @@ config USB_ETH_EEM
        select USB_LIBCOMPOSITE
        select USB_F_EEM
        help
-         CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
-         and therefore can be supported by more hardware.  Technically ECM and
-         EEM are designed for different applications.  The ECM model extends
-         the network interface to the target (e.g. a USB cable modem), and the
-         EEM model is for mobile devices to communicate with hosts using
-         ethernet over USB.  For Linux gadgets, however, the interface with
-         the host is the same (a usbX device), so the differences are minimal.
-
-         If you say "y" here, the Ethernet gadget driver will use the EEM
-         protocol rather than ECM.  If unsure, say "n".
+        CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
+        and therefore can be supported by more hardware.  Technically ECM and
+        EEM are designed for different applications.  The ECM model extends
+        the network interface to the target (e.g. a USB cable modem), and the
+        EEM model is for mobile devices to communicate with hosts using
+        ethernet over USB.  For Linux gadgets, however, the interface with
+        the host is the same (a usbX device), so the differences are minimal.
+
+        If you say "y" here, the Ethernet gadget driver will use the EEM
+        protocol rather than ECM.  If unsure, say "n".
 
 config USB_G_NCM
        tristate "Network Control Model (NCM) support"
index af16672d511879f0dd2d20d2e61bf1a36d8e6dc0..59be2d8417c9cef33edebf64aa9fd86421a32709 100644 (file)
@@ -105,7 +105,6 @@ static struct usb_function *f_msg;
  */
 static int acm_ms_do_config(struct usb_configuration *c)
 {
-       struct fsg_opts *opts;
        int     status;
 
        if (gadget_is_otg(c->cdev->gadget)) {
@@ -113,8 +112,6 @@ static int acm_ms_do_config(struct usb_configuration *c)
                c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
        }
 
-       opts = fsg_opts_from_func_inst(fi_msg);
-
        f_acm = usb_get_function(f_acm_inst);
        if (IS_ERR(f_acm))
                return PTR_ERR(f_acm);
index fd5595ac5bf7bd474ea35cf00e348f7cffba1b74..f18f77584fc21ae43a6a11524e7288578a155ea5 100644 (file)
@@ -105,7 +105,6 @@ FSG_MODULE_PARAMETERS(/* no prefix */, mod_data);
 
 static int msg_do_config(struct usb_configuration *c)
 {
-       struct fsg_opts *opts;
        int ret;
 
        if (gadget_is_otg(c->cdev->gadget)) {
@@ -113,8 +112,6 @@ static int msg_do_config(struct usb_configuration *c)
                c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
        }
 
-       opts = fsg_opts_from_func_inst(fi_msg);
-
        f_msg = usb_get_function(fi_msg);
        if (IS_ERR(f_msg))
                return PTR_ERR(f_msg);
index d354036ff6c86a0ba94bd779d9ae5da81871a360..f5a601a86af37cb100f2259b2f83bc601a6dff6c 100644 (file)
@@ -123,7 +123,7 @@ config USB_GR_UDC
        tristate "Aeroflex Gaisler GRUSBDC USB Peripheral Controller Driver"
        depends on HAS_DMA
        help
-          Select this to support Aeroflex Gaisler GRUSBDC cores from the GRLIB
+         Select this to support Aeroflex Gaisler GRUSBDC cores from the GRLIB
          VHDL IP core library.
 
 config USB_OMAP
index 194ffb1ed462094593b334970533f5ccfd24f22a..1b2b548c59a0eee9a6b2bdffc1f56048e016659b 100644 (file)
@@ -1808,7 +1808,6 @@ static int at91udc_probe(struct platform_device *pdev)
        struct device   *dev = &pdev->dev;
        struct at91_udc *udc;
        int             retval;
-       struct resource *res;
        struct at91_ep  *ep;
        int             i;
 
@@ -1839,8 +1838,7 @@ static int at91udc_probe(struct platform_device *pdev)
                        ep->is_pingpong = 1;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       udc->udp_baseaddr = devm_ioremap_resource(dev, res);
+       udc->udp_baseaddr = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(udc->udp_baseaddr))
                return PTR_ERR(udc->udp_baseaddr);
 
index 97b16463f3ef6013e6199410c64626abe03a07b3..7fcf4a8eaeb6234bae7a63bfdc63d488ba3481f5 100644 (file)
@@ -2282,7 +2282,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct bcm63xx_usbd_platform_data *pd = dev_get_platdata(dev);
        struct bcm63xx_udc *udc;
-       struct resource *res;
        int rc = -ENOMEM, i, irq;
 
        udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL);
@@ -2298,13 +2297,11 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       udc->usbd_regs = devm_ioremap_resource(dev, res);
+       udc->usbd_regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(udc->usbd_regs))
                return PTR_ERR(udc->usbd_regs);
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       udc->iudma_regs = devm_ioremap_resource(dev, res);
+       udc->iudma_regs = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(udc->iudma_regs))
                return PTR_ERR(udc->iudma_regs);
 
index cc4a16e253ac5c5c1d2b449e0473da6cac647f45..02a3a774670b1682619fdd58de3aa4e9d5615bc0 100644 (file)
@@ -480,7 +480,6 @@ static void bdc_phy_exit(struct bdc *bdc)
 static int bdc_probe(struct platform_device *pdev)
 {
        struct bdc *bdc;
-       struct resource *res;
        int ret = -ENOMEM;
        int irq;
        u32 temp;
@@ -508,8 +507,7 @@ static int bdc_probe(struct platform_device *pdev)
 
        bdc->clk = clk;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       bdc->regs = devm_ioremap_resource(dev, res);
+       bdc->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(bdc->regs)) {
                dev_err(dev, "ioremap error\n");
                return -ENOMEM;
index 7bfd58c846f73d662d09bce0e8e925e4008fc6be..248426a3e88a7447a9f8eb605f543f92dbd1ef58 100644 (file)
@@ -195,7 +195,7 @@ static void handle_link_state_change(struct bdc *bdc, u32 uspc)
                break;
        case BDC_LINK_STATE_U0:
                if (bdc->devstatus & REMOTE_WAKEUP_ISSUED) {
-                                       bdc->devstatus &= ~REMOTE_WAKEUP_ISSUED;
+                       bdc->devstatus &= ~REMOTE_WAKEUP_ISSUED;
                        if (bdc->gadget.speed == USB_SPEED_SUPER) {
                                bdc_function_wake_fh(bdc, 0);
                                bdc->devstatus |= FUNC_WAKE_ISSUED;
index 7a0e9a58c2d8403bacdcbad08939b2a4453074a8..c63383221b5aca665336f1792b69bec98185e549 100644 (file)
@@ -2118,7 +2118,6 @@ static int gr_request_irq(struct gr_udc *dev, int irq)
 static int gr_probe(struct platform_device *pdev)
 {
        struct gr_udc *dev;
-       struct resource *res;
        struct gr_regs __iomem *regs;
        int retval;
        u32 status;
@@ -2128,8 +2127,7 @@ static int gr_probe(struct platform_device *pdev)
                return -ENOMEM;
        dev->dev = &pdev->dev;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev->dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
                return PTR_ERR(regs);
 
index d4be53559f2e160ec9e37f49641e07c1ba45ff2e..cfafdd92c2a841d7c425b52a9bb8b8e921fcd5aa 100644 (file)
@@ -2321,7 +2321,6 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
        struct pxa25x_udc *dev = &memory;
        int retval, irq;
        u32 chiprev;
-       struct resource *res;
 
        pr_info("%s: version %s\n", driver_name, DRIVER_VERSION);
 
@@ -2367,8 +2366,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
        if (irq < 0)
                return -ENODEV;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       dev->regs = devm_ioremap_resource(&pdev->dev, res);
+       dev->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(dev->regs))
                return PTR_ERR(dev->regs);
 
index 014233252299c9496d27f46aeef218f520fe169b..5f107f277f30941dde4cf6d1cde7016c279440a0 100644 (file)
@@ -2356,7 +2356,6 @@ MODULE_DEVICE_TABLE(of, udc_pxa_dt_ids);
  */
 static int pxa_udc_probe(struct platform_device *pdev)
 {
-       struct resource *regs;
        struct pxa_udc *udc = &memory;
        int retval = 0, gpio;
        struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
@@ -2378,8 +2377,7 @@ static int pxa_udc_probe(struct platform_device *pdev)
                udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
        }
 
-       regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       udc->regs = devm_ioremap_resource(&pdev->dev, regs);
+       udc->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(udc->regs))
                return PTR_ERR(udc->regs);
        udc->irq = platform_get_irq(pdev, 0);
index 11e25a3f4f1fa86ea42677d7efbbdd1f0f83e6b5..582a16165ea9ce354762e66f7a2b7f53760c47bb 100644 (file)
@@ -1838,7 +1838,7 @@ static int r8a66597_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        char clk_name[8];
-       struct resource *res, *ires;
+       struct resource *ires;
        int irq;
        void __iomem *reg = NULL;
        struct r8a66597 *r8a66597 = NULL;
@@ -1846,8 +1846,7 @@ static int r8a66597_probe(struct platform_device *pdev)
        int i;
        unsigned long irq_trigger;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       reg = devm_ioremap_resource(&pdev->dev, res);
+       reg = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(reg))
                return PTR_ERR(reg);
 
index 33703140233aa592001eaeb64298b5f119da9b0a..b18ad83342e35fa9f54965187cc564a3d55aedb3 100644 (file)
@@ -2733,7 +2733,6 @@ static struct usb_role_switch_desc renesas_usb3_role_switch_desc = {
 static int renesas_usb3_probe(struct platform_device *pdev)
 {
        struct renesas_usb3 *usb3;
-       struct resource *res;
        int irq, ret;
        const struct renesas_usb3_priv *priv;
        const struct soc_device_attribute *attr;
@@ -2752,8 +2751,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)
        if (!usb3)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       usb3->reg = devm_ioremap_resource(&pdev->dev, res);
+       usb3->reg = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(usb3->reg))
                return PTR_ERR(usb3->reg);
 
index 858993c73442243c2a005934eb91e21b0dc1ae9e..21252fbc0319de648bf423b157c5860db5707c30 100644 (file)
@@ -1263,7 +1263,6 @@ static const struct usb_gadget_ops s3c_hsudc_gadget_ops = {
 static int s3c_hsudc_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct resource *res;
        struct s3c_hsudc *hsudc;
        struct s3c24xx_hsudc_platdata *pd = dev_get_platdata(&pdev->dev);
        int ret, i;
@@ -1290,9 +1289,7 @@ static int s3c_hsudc_probe(struct platform_device *pdev)
                goto err_supplies;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-       hsudc->regs = devm_ioremap_resource(&pdev->dev, res);
+       hsudc->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(hsudc->regs)) {
                ret = PTR_ERR(hsudc->regs);
                goto err_res;
index 79b2e79dddd0674b83d0406c41edb183dc85557e..d6164ede63d369e726f5b40654d31138b0762a57 100644 (file)
@@ -220,12 +220,12 @@ config USB_EHCI_HCD_ORION
          Marvell PXA/MMP USB controller" for those.
 
 config USB_EHCI_HCD_SPEAR
-        tristate "Support for ST SPEAr on-chip EHCI USB controller"
-        depends on USB_EHCI_HCD && PLAT_SPEAR
-        default y
-        ---help---
-          Enables support for the on-chip EHCI controller on
-          ST SPEAr chips.
+       tristate "Support for ST SPEAr on-chip EHCI USB controller"
+       depends on USB_EHCI_HCD && PLAT_SPEAR
+       default y
+       ---help---
+         Enables support for the on-chip EHCI controller on
+         ST SPEAr chips.
 
 config USB_EHCI_HCD_STI
        tristate "Support for ST STiHxxx on-chip EHCI USB controller"
@@ -237,12 +237,12 @@ config USB_EHCI_HCD_STI
          STMicroelectronics consumer electronics SoC's.
 
 config USB_EHCI_HCD_AT91
-        tristate  "Support for Atmel on-chip EHCI USB controller"
-        depends on USB_EHCI_HCD && ARCH_AT91
-        default y
-        ---help---
-          Enables support for the on-chip EHCI controller on
-          Atmel chips.
+       tristate  "Support for Atmel on-chip EHCI USB controller"
+       depends on USB_EHCI_HCD && ARCH_AT91
+       default y
+       ---help---
+         Enables support for the on-chip EHCI controller on
+         Atmel chips.
 
 config USB_EHCI_TEGRA
        tristate "NVIDIA Tegra HCD support"
@@ -250,8 +250,8 @@ config USB_EHCI_TEGRA
        select USB_EHCI_ROOT_HUB_TT
        select USB_TEGRA_PHY
        help
-         This driver enables support for the internal USB Host Controllers
-         found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
+        This driver enables support for the internal USB Host Controllers
+        found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
 
 config USB_EHCI_HCD_PPC_OF
        bool "EHCI support for PPC USB controller on OF platform bus"
@@ -409,12 +409,12 @@ config USB_OHCI_HCD_OMAP1
          Enables support for the OHCI controller on OMAP1/2 chips.
 
 config USB_OHCI_HCD_SPEAR
-        tristate "Support for ST SPEAr on-chip OHCI USB controller"
-        depends on USB_OHCI_HCD && PLAT_SPEAR
-        default y
-        ---help---
-          Enables support for the on-chip OHCI controller on
-          ST SPEAr chips.
+       tristate "Support for ST SPEAr on-chip OHCI USB controller"
+       depends on USB_OHCI_HCD && PLAT_SPEAR
+       default y
+       ---help---
+         Enables support for the on-chip OHCI controller on
+         ST SPEAr chips.
 
 config USB_OHCI_HCD_STI
        tristate "Support for ST STiHxxx on-chip OHCI USB controller"
@@ -426,12 +426,12 @@ config USB_OHCI_HCD_STI
          STMicroelectronics consumer electronics SoC's.
 
 config USB_OHCI_HCD_S3C2410
-        tristate "OHCI support for Samsung S3C24xx/S3C64xx SoC series"
-        depends on USB_OHCI_HCD && (ARCH_S3C24XX || ARCH_S3C64XX)
-        default y
-        ---help---
-          Enables support for the on-chip OHCI controller on
-          S3C24xx/S3C64xx chips.
+       tristate "OHCI support for Samsung S3C24xx/S3C64xx SoC series"
+       depends on USB_OHCI_HCD && (ARCH_S3C24XX || ARCH_S3C64XX)
+       default y
+       ---help---
+         Enables support for the on-chip OHCI controller on
+         S3C24xx/S3C64xx chips.
 
 config USB_OHCI_HCD_LPC32XX
        tristate "Support for LPC on-chip OHCI USB controller"
@@ -440,8 +440,8 @@ config USB_OHCI_HCD_LPC32XX
        depends on USB_ISP1301
        default y
        ---help---
-          Enables support for the on-chip OHCI controller on
-          NXP chips.
+         Enables support for the on-chip OHCI controller on
+         NXP chips.
 
 config USB_OHCI_HCD_PXA27X
        tristate "Support for PXA27X/PXA3XX on-chip OHCI USB controller"
@@ -456,8 +456,8 @@ config USB_OHCI_HCD_AT91
        depends on USB_OHCI_HCD && ARCH_AT91 && OF
        default y
        ---help---
-          Enables support for the on-chip OHCI controller on
-          Atmel chips.
+         Enables support for the on-chip OHCI controller on
+         Atmel chips.
 
 config USB_OHCI_HCD_OMAP3
        tristate "OHCI support for OMAP3 and later chips"
@@ -716,11 +716,11 @@ config USB_IMX21_HCD
        tristate "i.MX21 HCD support"
        depends on ARM && ARCH_MXC
        help
-         This driver enables support for the on-chip USB host in the
-         i.MX21 processor.
+        This driver enables support for the on-chip USB host in the
+        i.MX21 processor.
 
-         To compile this driver as a module, choose M here: the
-         module will be called "imx21-hcd".
+        To compile this driver as a module, choose M here: the
+        module will be called "imx21-hcd".
 
 config USB_HCD_BCMA
        tristate "BCMA usb host driver"
index 96f8daa11f2556260b22c5967b70eb40fa915aa4..4a3a2852523f276261d7a87ecadfefd5cedc09cf 100644 (file)
@@ -2627,7 +2627,7 @@ static int isp1362_probe(struct platform_device *pdev)
 {
        struct usb_hcd *hcd;
        struct isp1362_hcd *isp1362_hcd;
-       struct resource *addr, *data, *irq_res;
+       struct resource *data, *irq_res;
        void __iomem *addr_reg;
        void __iomem *data_reg;
        int irq;
@@ -2651,8 +2651,7 @@ static int isp1362_probe(struct platform_device *pdev)
 
        irq = irq_res->start;
 
-       addr = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       addr_reg = devm_ioremap_resource(&pdev->dev, addr);
+       addr_reg = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(addr_reg))
                return PTR_ERR(addr_reg);
 
index fc35a7993b7b600690f9a3a8dbc7f6d59799ff8f..b635c6a1b1a91d43b430f22bd6ee4969dc8fcc93 100644 (file)
@@ -115,7 +115,6 @@ static void at91_start_hc(struct platform_device *pdev)
 static void at91_stop_hc(struct platform_device *pdev)
 {
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
-       struct ohci_regs __iomem *regs = hcd->regs;
        struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
 
        dev_dbg(&pdev->dev, "stop\n");
@@ -123,7 +122,7 @@ static void at91_stop_hc(struct platform_device *pdev)
        /*
         * Put the USB host controller into reset.
         */
-       writel(0, &regs->control);
+       usb_hcd_platform_shutdown(pdev);
 
        /*
         * Stop the USB clocks.
@@ -628,6 +627,7 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
 
                /* flush the writes */
                (void) ohci_readl (ohci, &ohci->regs->control);
+               msleep(1);
                at91_stop_clock(ohci_at91);
        }
 
@@ -642,8 +642,8 @@ ohci_hcd_at91_drv_resume(struct device *dev)
 
        if (ohci_at91->wakeup)
                disable_irq_wake(hcd->irq);
-
-       at91_start_clock(ohci_at91);
+       else
+               at91_start_clock(ohci_at91);
 
        ohci_resume(hcd, false);
 
index 4efee34f154fcb772b72856f34bd3df4f092c73b..e9209e3e62487ea9b1dc6436c7484f145d3ba192 100644 (file)
@@ -71,7 +71,7 @@ INT_MODULE_PARM(testing, 0);
 /* Some boards misreport power switching/overcurrent*/
 static bool distrust_firmware = true;
 module_param(distrust_firmware, bool, 0);
-MODULE_PARM_DESC(distrust_firmware, "true to distrust firmware power/overcurren"
+MODULE_PARM_DESC(distrust_firmware, "true to distrust firmware power/overcurrent"
        "t setup");
 static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait);
 /*
index 2ff7c911fbd0d694f8c937f36418bf0949676fd3..540b47a9982471f20fce10f100a69130fc28077a 100644 (file)
 #define XUSB_CFG_CSB_BASE_ADDR                 0x800
 
 /* FPCI mailbox registers */
-#define XUSB_CFG_ARU_MBOX_CMD                  0x0e4
+/* XUSB_CFG_ARU_MBOX_CMD */
 #define  MBOX_DEST_FALC                                BIT(27)
 #define  MBOX_DEST_PME                         BIT(28)
 #define  MBOX_DEST_SMI                         BIT(29)
 #define  MBOX_DEST_XHCI                                BIT(30)
 #define  MBOX_INT_EN                           BIT(31)
-#define XUSB_CFG_ARU_MBOX_DATA_IN              0x0e8
+/* XUSB_CFG_ARU_MBOX_DATA_IN and XUSB_CFG_ARU_MBOX_DATA_OUT */
 #define  CMD_DATA_SHIFT                                0
 #define  CMD_DATA_MASK                         0xffffff
 #define  CMD_TYPE_SHIFT                                24
 #define  CMD_TYPE_MASK                         0xff
-#define XUSB_CFG_ARU_MBOX_DATA_OUT             0x0ec
-#define XUSB_CFG_ARU_MBOX_OWNER                        0x0f0
+/* XUSB_CFG_ARU_MBOX_OWNER */
 #define  MBOX_OWNER_NONE                       0
 #define  MBOX_OWNER_FW                         1
 #define  MBOX_OWNER_SW                         2
@@ -146,6 +145,13 @@ struct tegra_xusb_phy_type {
        unsigned int num;
 };
 
+struct tega_xusb_mbox_regs {
+       u16 cmd;
+       u16 data_in;
+       u16 data_out;
+       u16 owner;
+};
+
 struct tegra_xusb_soc {
        const char *firmware;
        const char * const *supply_names;
@@ -160,6 +166,8 @@ struct tegra_xusb_soc {
                } usb2, ulpi, hsic, usb3;
        } ports;
 
+       struct tega_xusb_mbox_regs mbox;
+
        bool scale_ss_clock;
        bool has_ipfs;
 };
@@ -395,15 +403,15 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,
         * ACK/NAK messages.
         */
        if (!(msg->cmd == MBOX_CMD_ACK || msg->cmd == MBOX_CMD_NAK)) {
-               value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_OWNER);
+               value = fpci_readl(tegra, tegra->soc->mbox.owner);
                if (value != MBOX_OWNER_NONE) {
                        dev_err(tegra->dev, "mailbox is busy\n");
                        return -EBUSY;
                }
 
-               fpci_writel(tegra, MBOX_OWNER_SW, XUSB_CFG_ARU_MBOX_OWNER);
+               fpci_writel(tegra, MBOX_OWNER_SW, tegra->soc->mbox.owner);
 
-               value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_OWNER);
+               value = fpci_readl(tegra, tegra->soc->mbox.owner);
                if (value != MBOX_OWNER_SW) {
                        dev_err(tegra->dev, "failed to acquire mailbox\n");
                        return -EBUSY;
@@ -413,17 +421,17 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,
        }
 
        value = tegra_xusb_mbox_pack(msg);
-       fpci_writel(tegra, value, XUSB_CFG_ARU_MBOX_DATA_IN);
+       fpci_writel(tegra, value, tegra->soc->mbox.data_in);
 
-       value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_CMD);
+       value = fpci_readl(tegra, tegra->soc->mbox.cmd);
        value |= MBOX_INT_EN | MBOX_DEST_FALC;
-       fpci_writel(tegra, value, XUSB_CFG_ARU_MBOX_CMD);
+       fpci_writel(tegra, value, tegra->soc->mbox.cmd);
 
        if (wait_for_idle) {
                unsigned long timeout = jiffies + msecs_to_jiffies(250);
 
                while (time_before(jiffies, timeout)) {
-                       value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_OWNER);
+                       value = fpci_readl(tegra, tegra->soc->mbox.owner);
                        if (value == MBOX_OWNER_NONE)
                                break;
 
@@ -431,7 +439,7 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,
                }
 
                if (time_after(jiffies, timeout))
-                       value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_OWNER);
+                       value = fpci_readl(tegra, tegra->soc->mbox.owner);
 
                if (value != MBOX_OWNER_NONE)
                        return -ETIMEDOUT;
@@ -598,16 +606,16 @@ static irqreturn_t tegra_xusb_mbox_thread(int irq, void *data)
 
        mutex_lock(&tegra->lock);
 
-       value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_DATA_OUT);
+       value = fpci_readl(tegra, tegra->soc->mbox.data_out);
        tegra_xusb_mbox_unpack(&msg, value);
 
-       value = fpci_readl(tegra, XUSB_CFG_ARU_MBOX_CMD);
+       value = fpci_readl(tegra, tegra->soc->mbox.cmd);
        value &= ~MBOX_DEST_SMI;
-       fpci_writel(tegra, value, XUSB_CFG_ARU_MBOX_CMD);
+       fpci_writel(tegra, value, tegra->soc->mbox.cmd);
 
        /* clear mailbox owner if no ACK/NAK is required */
        if (!tegra_xusb_mbox_cmd_requires_ack(msg.cmd))
-               fpci_writel(tegra, MBOX_OWNER_NONE, XUSB_CFG_ARU_MBOX_OWNER);
+               fpci_writel(tegra, MBOX_OWNER_NONE, tegra->soc->mbox.owner);
 
        tegra_xusb_mbox_handle(tegra, &msg);
 
@@ -970,7 +978,7 @@ static int tegra_xusb_powerdomain_init(struct device *dev,
 static int tegra_xusb_probe(struct platform_device *pdev)
 {
        struct tegra_xusb_mbox_msg msg;
-       struct resource *res, *regs;
+       struct resource *regs;
        struct tegra_xusb *tegra;
        struct xhci_hcd *xhci;
        unsigned int i, j, k;
@@ -992,14 +1000,12 @@ static int tegra_xusb_probe(struct platform_device *pdev)
        if (IS_ERR(tegra->regs))
                return PTR_ERR(tegra->regs);
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       tegra->fpci_base = devm_ioremap_resource(&pdev->dev, res);
+       tegra->fpci_base = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(tegra->fpci_base))
                return PTR_ERR(tegra->fpci_base);
 
        if (tegra->soc->has_ipfs) {
-               res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
-               tegra->ipfs_base = devm_ioremap_resource(&pdev->dev, res);
+               tegra->ipfs_base = devm_platform_ioremap_resource(pdev, 2);
                if (IS_ERR(tegra->ipfs_base))
                        return PTR_ERR(tegra->ipfs_base);
        }
@@ -1128,8 +1134,9 @@ static int tegra_xusb_probe(struct platform_device *pdev)
                goto put_powerdomains;
        }
 
-       for (i = 0; i < tegra->soc->num_supplies; i++)
-               tegra->supplies[i].supply = tegra->soc->supply_names[i];
+       regulator_bulk_set_supply_names(tegra->supplies,
+                                       tegra->soc->supply_names,
+                                       tegra->soc->num_supplies);
 
        err = devm_regulator_bulk_get(&pdev->dev, tegra->soc->num_supplies,
                                      tegra->supplies);
@@ -1375,6 +1382,12 @@ static const struct tegra_xusb_soc tegra124_soc = {
        },
        .scale_ss_clock = true,
        .has_ipfs = true,
+       .mbox = {
+               .cmd = 0xe4,
+               .data_in = 0xe8,
+               .data_out = 0xec,
+               .owner = 0xf0,
+       },
 };
 MODULE_FIRMWARE("nvidia/tegra124/xusb.bin");
 
@@ -1407,6 +1420,12 @@ static const struct tegra_xusb_soc tegra210_soc = {
        },
        .scale_ss_clock = false,
        .has_ipfs = true,
+       .mbox = {
+               .cmd = 0xe4,
+               .data_in = 0xe8,
+               .data_out = 0xec,
+               .owner = 0xf0,
+       },
 };
 MODULE_FIRMWARE("nvidia/tegra210/xusb.bin");
 
@@ -1432,12 +1451,48 @@ static const struct tegra_xusb_soc tegra186_soc = {
        },
        .scale_ss_clock = false,
        .has_ipfs = false,
+       .mbox = {
+               .cmd = 0xe4,
+               .data_in = 0xe8,
+               .data_out = 0xec,
+               .owner = 0xf0,
+       },
+};
+
+static const char * const tegra194_supply_names[] = {
+};
+
+static const struct tegra_xusb_phy_type tegra194_phy_types[] = {
+       { .name = "usb3", .num = 4, },
+       { .name = "usb2", .num = 4, },
+};
+
+static const struct tegra_xusb_soc tegra194_soc = {
+       .firmware = "nvidia/tegra194/xusb.bin",
+       .supply_names = tegra194_supply_names,
+       .num_supplies = ARRAY_SIZE(tegra194_supply_names),
+       .phy_types = tegra194_phy_types,
+       .num_types = ARRAY_SIZE(tegra194_phy_types),
+       .ports = {
+               .usb3 = { .offset = 0, .count = 4, },
+               .usb2 = { .offset = 4, .count = 4, },
+       },
+       .scale_ss_clock = false,
+       .has_ipfs = false,
+       .mbox = {
+               .cmd = 0x68,
+               .data_in = 0x6c,
+               .data_out = 0x70,
+               .owner = 0x74,
+       },
 };
+MODULE_FIRMWARE("nvidia/tegra194/xusb.bin");
 
 static const struct of_device_id tegra_xusb_of_match[] = {
        { .compatible = "nvidia,tegra124-xusb", .data = &tegra124_soc },
        { .compatible = "nvidia,tegra210-xusb", .data = &tegra210_soc },
        { .compatible = "nvidia,tegra186-xusb", .data = &tegra186_soc },
+       { .compatible = "nvidia,tegra194-xusb", .data = &tegra194_soc },
        { },
 };
 MODULE_DEVICE_TABLE(of, tegra_xusb_of_match);
index 7a6b122c833fbeaece8a02782ab26581c6480f2f..360416680e8237c4a1407d555e943d90749877b7 100644 (file)
@@ -566,7 +566,6 @@ static int
 mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback)
 {
        struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
-       int err = 0;
        int res;
 
        MTS_DEBUG_GOT_HERE();
@@ -613,7 +612,7 @@ mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback
 
        }
 out:
-       return err;
+       return 0;
 }
 
 static DEF_SCSI_QCMD(mts_scsi_queuecommand)
index 320fc4739835a19e1a0c4642c7d0f94322f79de3..579a21bd70adb117c13d3a030c22fb6d3e209845 100644 (file)
@@ -1032,8 +1032,6 @@ static int check_atl_transfer(struct usb_hcd *hcd, struct ptd *ptd,
                        urb->status = -EOVERFLOW;
                else if (FROM_DW3_CERR(ptd->dw3))
                        urb->status = -EPIPE;  /* Stall */
-               else if (ptd->dw3 & DW3_ERROR_BIT)
-                       urb->status = -EPROTO; /* XactErr */
                else
                        urb->status = -EPROTO; /* Unknown */
 /*
index 9bce583aada3af2e27af4ec8569ea38aa2e4e96b..653aa34aba6c3a3e238b073289fb5c12471d2583 100644 (file)
@@ -181,8 +181,8 @@ config USB_TEST
          including sample test device firmware and "how to use it".
 
 config USB_EHSET_TEST_FIXTURE
-        tristate "USB EHSET Test Fixture driver"
-        help
+       tristate "USB EHSET Test Fixture driver"
+       help
          Say Y here if you want to support the special test fixture device
          used for the USB-IF Embedded Host High-Speed Electrical Test procedure.
 
@@ -237,13 +237,13 @@ config USB_HSIC_USB3503
        depends on I2C
        select REGMAP_I2C
        help
-         This option enables support for SMSC USB3503 HSIC to USB 2.0 Driver.
+        This option enables support for SMSC USB3503 HSIC to USB 2.0 Driver.
 
 config USB_HSIC_USB4604
        tristate "USB4604 HSIC to USB20 Driver"
        depends on I2C
        help
-         This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
+        This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
 
 config USB_LINK_LAYER_TEST
        tristate "USB Link Layer Test driver"
index cdee3af33ad7b307ae9b3ec9b379b0d8875b6a27..8a3d9c0c8d8bc54304b5d46dc801ea1476af64f1 100644 (file)
@@ -333,7 +333,8 @@ static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi)
                *respond->result = -ESHUTDOWN;
                *respond->value = 0;
                complete(&respond->wait_completion);
-       } mutex_unlock(&ftdi->u132_lock);
+       }
+       mutex_unlock(&ftdi->u132_lock);
 }
 
 static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi)
@@ -763,7 +764,8 @@ static int ftdi_elan_total_command_size(struct usb_ftdi *ftdi, int command_size)
                struct u132_command *command = &ftdi->command[COMMAND_MASK &
                                                              i++];
                total_size += 5 + command->follows;
-       } return total_size;
+       }
+       return total_size;
 }
 
 static int ftdi_elan_command_engine(struct usb_ftdi *ftdi)
index 9b632ab24f03305c81daad362c852f8b5215da07..c16121276a213a9de1a030dea57d28424ad0adbe 100644 (file)
@@ -4,7 +4,7 @@ config USB_SISUSBVGA
        tristate "USB 2.0 SVGA dongle support (Net2280/SiS315)"
        depends on (USB_MUSB_HDRC || USB_EHCI_HCD)
        select FONT_SUPPORT if USB_SISUSBVGA_CON
-        ---help---
+       ---help---
          Say Y here if you intend to attach a USB2VGA dongle based on a
          Net2280 and a SiS315 chip.
 
index 6ca9111d150a34b5fe567cc77e07c2c95c2b470e..5bba19937da1e80b1423c394ff2fa47549b5275b 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/nls.h>
 #include <linux/of_device.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 
 /* Internal Register Set Addresses & Default Values acc. to DS00001692C */
 struct usb251xb {
        struct device *dev;
        struct i2c_client *i2c;
+       struct regulator *vdd;
        u8 skip_config;
        struct gpio_desc *gpio_reset;
        u16 vendor_id;
@@ -261,20 +263,19 @@ static int usb251x_check_gpio_chip(struct usb251xb *hub)
 }
 #endif
 
-static void usb251xb_reset(struct usb251xb *hub, int state)
+static void usb251xb_reset(struct usb251xb *hub)
 {
        if (!hub->gpio_reset)
                return;
 
        i2c_lock_bus(hub->i2c->adapter, I2C_LOCK_SEGMENT);
 
-       gpiod_set_value_cansleep(hub->gpio_reset, state);
+       gpiod_set_value_cansleep(hub->gpio_reset, 1);
+       usleep_range(1, 10);    /* >=1us RESET_N asserted */
+       gpiod_set_value_cansleep(hub->gpio_reset, 0);
 
        /* wait for hub recovery/stabilization */
-       if (!state)
-               usleep_range(500, 750); /* >=500us at power on */
-       else
-               usleep_range(1, 10);    /* >=1us at power down */
+       usleep_range(500, 750); /* >=500us after RESET_N deasserted */
 
        i2c_unlock_bus(hub->i2c->adapter, I2C_LOCK_SEGMENT);
 }
@@ -292,7 +293,7 @@ static int usb251xb_connect(struct usb251xb *hub)
                i2c_wb[0] = 0x01;
                i2c_wb[1] = USB251XB_STATUS_COMMAND_ATTACH;
 
-               usb251xb_reset(hub, 0);
+               usb251xb_reset(hub);
 
                err = i2c_smbus_write_i2c_block_data(hub->i2c,
                                USB251XB_ADDR_STATUS_COMMAND, 2, i2c_wb);
@@ -342,7 +343,7 @@ static int usb251xb_connect(struct usb251xb *hub)
        i2c_wb[USB251XB_ADDR_PORT_MAP_7]        = hub->port_map7;
        i2c_wb[USB251XB_ADDR_STATUS_COMMAND] = USB251XB_STATUS_COMMAND_ATTACH;
 
-       usb251xb_reset(hub, 0);
+       usb251xb_reset(hub);
 
        /* write registers */
        for (i = 0; i < (USB251XB_I2C_REG_SZ / USB251XB_I2C_WRITE_SZ); i++) {
@@ -420,6 +421,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
                return err;
        }
 
+       hub->vdd = devm_regulator_get(dev, "vdd");
+       if (IS_ERR(hub->vdd))
+               return PTR_ERR(hub->vdd);
+
        if (of_property_read_u16_array(np, "vendor-id", &hub->vendor_id, 1))
                hub->vendor_id = USB251XB_DEF_VENDOR_ID;
 
@@ -665,6 +670,10 @@ static int usb251xb_probe(struct usb251xb *hub)
        if (err)
                return err;
 
+       err = regulator_enable(hub->vdd);
+       if (err)
+               return err;
+
        err = usb251xb_connect(hub);
        if (err) {
                dev_err(dev, "Failed to connect hub (%d)\n", err);
@@ -692,6 +701,29 @@ static int usb251xb_i2c_probe(struct i2c_client *i2c,
        return usb251xb_probe(hub);
 }
 
+static int __maybe_unused usb251xb_suspend(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct usb251xb *hub = i2c_get_clientdata(client);
+
+       return regulator_disable(hub->vdd);
+}
+
+static int __maybe_unused usb251xb_resume(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct usb251xb *hub = i2c_get_clientdata(client);
+       int err;
+
+       err = regulator_enable(hub->vdd);
+       if (err)
+               return err;
+
+       return usb251xb_connect(hub);
+}
+
+static SIMPLE_DEV_PM_OPS(usb251xb_pm_ops, usb251xb_suspend, usb251xb_resume);
+
 static const struct i2c_device_id usb251xb_id[] = {
        { "usb2512b", 0 },
        { "usb2512bi", 0 },
@@ -709,6 +741,7 @@ static struct i2c_driver usb251xb_i2c_driver = {
        .driver = {
                .name = DRIVER_NAME,
                .of_match_table = of_match_ptr(usb251xb_of_match),
+               .pm = &usb251xb_pm_ops,
        },
        .probe    = usb251xb_i2c_probe,
        .id_table = usb251xb_id,
index 4da216c997263b7d2fdd3493178a6302e7c2f44b..2be182bd793a9f025dba76f6cfc44e5dfea89b5b 100644 (file)
@@ -153,6 +153,15 @@ static void ep0_stall_set(struct mtu3_ep *mep0, bool set, u32 pktrdy)
                set ? "SEND" : "CLEAR", decode_ep0_state(mtu));
 }
 
+static void ep0_do_status_stage(struct mtu3 *mtu)
+{
+       void __iomem *mbase = mtu->mac_base;
+       u32 value;
+
+       value = mtu3_readl(mbase, U3D_EP0CSR) & EP0_W1C_BITS;
+       mtu3_writel(mbase, U3D_EP0CSR, value | EP0_SETUPPKTRDY | EP0_DATAEND);
+}
+
 static int ep0_queue(struct mtu3_ep *mep0, struct mtu3_request *mreq);
 
 static void ep0_dummy_complete(struct usb_ep *ep, struct usb_request *req)
@@ -297,8 +306,7 @@ static int handle_test_mode(struct mtu3 *mtu, struct usb_ctrlrequest *setup)
                ep0_load_test_packet(mtu);
 
        /* send status before entering test mode. */
-       value = mtu3_readl(mbase, U3D_EP0CSR) & EP0_W1C_BITS;
-       mtu3_writel(mbase, U3D_EP0CSR, value | EP0_SETUPPKTRDY | EP0_DATAEND);
+       ep0_do_status_stage(mtu);
 
        /* wait for ACK status sent by host */
        readl_poll_timeout_atomic(mbase + U3D_EP0CSR, value,
@@ -632,7 +640,6 @@ __acquires(mtu->lock)
 {
        struct usb_ctrlrequest setup;
        struct mtu3_request *mreq;
-       void __iomem *mbase = mtu->mac_base;
        int handled = 0;
 
        ep0_read_setup(mtu, &setup);
@@ -664,14 +671,19 @@ finish:
        if (mtu->test_mode) {
                ;       /* nothing to do */
        } else if (handled == USB_GADGET_DELAYED_STATUS) {
-               /* handle the delay STATUS phase till receive ep_queue on ep0 */
-               mtu->delayed_status = true;
-       } else if (le16_to_cpu(setup.wLength) == 0) { /* no data stage */
 
-               mtu3_writel(mbase, U3D_EP0CSR,
-                       (mtu3_readl(mbase, U3D_EP0CSR) & EP0_W1C_BITS)
-                       | EP0_SETUPPKTRDY | EP0_DATAEND);
+               mreq = next_ep0_request(mtu);
+               if (mreq) {
+                       /* already asked us to continue delayed status */
+                       ep0_do_status_stage(mtu);
+                       ep0_req_giveback(mtu, &mreq->request);
+               } else {
+                       /* do delayed STATUS stage till receive ep0_queue */
+                       mtu->delayed_status = true;
+               }
+       } else if (le16_to_cpu(setup.wLength) == 0) { /* no data stage */
 
+               ep0_do_status_stage(mtu);
                /* complete zlp request directly */
                mreq = next_ep0_request(mtu);
                if (mreq && !mreq->request.length)
@@ -802,12 +814,9 @@ static int ep0_queue(struct mtu3_ep *mep, struct mtu3_request *mreq)
        }
 
        if (mtu->delayed_status) {
-               u32 csr;
 
                mtu->delayed_status = false;
-               csr = mtu3_readl(mtu->mac_base, U3D_EP0CSR) & EP0_W1C_BITS;
-               csr |= EP0_SETUPPKTRDY | EP0_DATAEND;
-               mtu3_writel(mtu->mac_base, U3D_EP0CSR, csr);
+               ep0_do_status_stage(mtu);
                /* needn't giveback the request for handling delay STATUS */
                return 0;
        }
index bd63450af76a95d1cb2bd069acf8d2ae41b5c6e6..15cca912c53e3e5849ac3f54b9f4ab8d57340d6a 100644 (file)
@@ -2431,14 +2431,12 @@ static int musb_probe(struct platform_device *pdev)
 {
        struct device   *dev = &pdev->dev;
        int             irq = platform_get_irq_byname(pdev, "mc");
-       struct resource *iomem;
        void __iomem    *base;
 
        if (irq <= 0)
                return -ENODEV;
 
-       iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(dev, iomem);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);
 
index ffe462a657b15d8b592ac7801dc6f4be4629c86f..2cb31fc0cd601eb469dfe5c2054cadd7aaefd080 100644 (file)
@@ -1085,7 +1085,6 @@ static int musb_gadget_disable(struct usb_ep *ep)
        u8              epnum;
        struct musb_ep  *musb_ep;
        void __iomem    *epio;
-       int             status = 0;
 
        musb_ep = to_musb_ep(ep);
        musb = musb_ep->musb;
@@ -1118,7 +1117,7 @@ static int musb_gadget_disable(struct usb_ep *ep)
 
        musb_dbg(musb, "%s", musb_ep->end_point.name);
 
-       return status;
+       return 0;
 }
 
 /*
index 19871266312d98b24e20fd031fbb106067ac0ac7..110e6e9ad6215157e0af629e33e961e090c1d217 100644 (file)
@@ -66,15 +66,13 @@ static int keystone_usbphy_probe(struct platform_device *pdev)
 {
        struct device           *dev = &pdev->dev;
        struct keystone_usbphy  *k_phy;
-       struct resource         *res;
        int ret;
 
        k_phy = devm_kzalloc(dev, sizeof(*k_phy), GFP_KERNEL);
        if (!k_phy)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       k_phy->phy_ctrl = devm_ioremap_resource(dev, res);
+       k_phy->phy_ctrl = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(k_phy->phy_ctrl))
                return PTR_ERR(k_phy->phy_ctrl);
 
index 70b8c8248caf79f6de106589dac0e8a6b0e12c0a..67b39dc62b373c5f9da8d5b667ddf708180b6068 100644 (file)
@@ -710,7 +710,6 @@ static enum usb_charger_type mxs_phy_charger_detect(struct usb_phy *phy)
 
 static int mxs_phy_probe(struct platform_device *pdev)
 {
-       struct resource *res;
        void __iomem *base;
        struct clk *clk;
        struct mxs_phy *mxs_phy;
@@ -723,8 +722,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
        if (!of_id)
                return -ENODEV;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(&pdev->dev, res);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);
 
index a3c30b609433bacca844f3d0c0c174c6301e0d51..d438b7871446ead04b7b6d687088a73cc25e1d11 100644 (file)
@@ -590,7 +590,7 @@ static int usbhs_probe(struct platform_device *pdev)
 {
        const struct renesas_usbhs_platform_info *info;
        struct usbhs_priv *priv;
-       struct resource *res, *irq_res;
+       struct resource *irq_res;
        struct device *dev = &pdev->dev;
        int ret, gpio;
        u32 tmp;
@@ -619,8 +619,7 @@ static int usbhs_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->base = devm_ioremap_resource(&pdev->dev, res);
+       priv->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->base))
                return PTR_ERR(priv->base);
 
index 0824099b905e8935c3e9909399eab68c03517f71..ef1735d014daedf971dc0388079012544085eab5 100644 (file)
@@ -161,11 +161,12 @@ struct usbhs_priv;
 #define VBSTS  (1 << 7)        /* VBUS_0 and VBUSIN_0 Input Status */
 #define VALID  (1 << 3)        /* USB Request Receive */
 
-#define DVSQ_MASK              (0x3 << 4)      /* Device State */
+#define DVSQ_MASK              (0x7 << 4)      /* Device State */
 #define  POWER_STATE           (0 << 4)
 #define  DEFAULT_STATE         (1 << 4)
 #define  ADDRESS_STATE         (2 << 4)
 #define  CONFIGURATION_STATE   (3 << 4)
+#define  SUSPENDED_STATE       (4 << 4)
 
 #define CTSQ_MASK              (0x7)   /* Control Transfer Stage */
 #define  IDLE_SETUP_STAGE      0       /* Idle stage or setup stage */
index 10fc655960141c01af6f8b21529a7fdf5e66af83..b98112cefaa4f667ea705777164302bafb448039 100644 (file)
@@ -169,17 +169,7 @@ void usbhs_mod_remove(struct usbhs_priv *priv)
  */
 int usbhs_status_get_device_state(struct usbhs_irq_state *irq_state)
 {
-       int state = irq_state->intsts0 & DVSQ_MASK;
-
-       switch (state) {
-       case POWER_STATE:
-       case DEFAULT_STATE:
-       case ADDRESS_STATE:
-       case CONFIGURATION_STATE:
-               return state;
-       }
-
-       return -EIO;
+       return (int)irq_state->intsts0 & DVSQ_MASK;
 }
 
 int usbhs_status_get_ctrl_stage(struct usbhs_irq_state *irq_state)
@@ -348,10 +338,6 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
         *      usbhs_interrupt
         */
 
-       /*
-        * it don't enable DVSE (intenb0) here
-        * but "mod->irq_dev_state" will be called.
-        */
        if (info->irq_vbus)
                intenb0 |= VBSE;
 
@@ -362,6 +348,9 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
                if (mod->irq_ctrl_stage)
                        intenb0 |= CTRE;
 
+               if (mod->irq_dev_state)
+                       intenb0 |= DVSE;
+
                if (mod->irq_empty && mod->irq_bempsts) {
                        usbhs_write(priv, BEMPENB, mod->irq_bempsts);
                        intenb0 |= BEMPE;
index cd38d74b322320db3c9607f4ab30758d701949be..53489cafecc18bc9ea32d6b5efdd944e15cc74e1 100644 (file)
@@ -457,12 +457,18 @@ static int usbhsg_irq_dev_state(struct usbhs_priv *priv,
 {
        struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv);
        struct device *dev = usbhsg_gpriv_to_dev(gpriv);
+       int state = usbhs_status_get_device_state(irq_state);
 
        gpriv->gadget.speed = usbhs_bus_get_speed(priv);
 
-       dev_dbg(dev, "state = %x : speed : %d\n",
-               usbhs_status_get_device_state(irq_state),
-               gpriv->gadget.speed);
+       dev_dbg(dev, "state = %x : speed : %d\n", state, gpriv->gadget.speed);
+
+       if (gpriv->gadget.speed != USB_SPEED_UNKNOWN &&
+           (state & SUSPENDED_STATE)) {
+               if (gpriv->driver && gpriv->driver->suspend)
+                       gpriv->driver->suspend(&gpriv->gadget);
+               usb_gadget_set_state(&gpriv->gadget, USB_STATE_SUSPENDED);
+       }
 
        return 0;
 }
index 67279c6bce33845952a4e1547affcc55491a993a..0a8c16a8cda2af73aab2e76c5a9d6f1929af74bb 100644 (file)
@@ -271,17 +271,17 @@ config USB_SERIAL_F8153X
 config USB_SERIAL_GARMIN
        tristate "USB Garmin GPS driver"
        help
-         Say Y here if you want to connect to your Garmin GPS.
-         Should work with most Garmin GPS devices which have a native USB port.
+        Say Y here if you want to connect to your Garmin GPS.
+        Should work with most Garmin GPS devices which have a native USB port.
 
-         See <http://sourceforge.net/projects/garmin-gps> for the latest
-         version of the driver.
+        See <http://sourceforge.net/projects/garmin-gps> for the latest
+        version of the driver.
 
-         To compile this driver as a module, choose M here: the
-         module will be called garmin_gps.
+        To compile this driver as a module, choose M here: the
+        module will be called garmin_gps.
 
 config USB_SERIAL_IPW
-        tristate "USB IPWireless (3G UMTS TDD) Driver"
+       tristate "USB IPWireless (3G UMTS TDD) Driver"
        select USB_SERIAL_WWAN
        help
          Say Y here if you want to use a IPWireless USB modem such as
@@ -341,20 +341,20 @@ config USB_SERIAL_KLSI
          module will be called kl5kusb105.
 
 config USB_SERIAL_KOBIL_SCT
-        tristate "USB KOBIL chipcard reader"
-        ---help---
-          Say Y here if you want to use one of the following KOBIL USB chipcard
-          readers:
-
-            - USB TWIN
-            - KAAN Standard Plus
-            - KAAN SIM
-            - SecOVID Reader Plus
-            - B1 Professional
-            - KAAN Professional
-
-          Note that you need a current CT-API.
-          To compile this driver as a module, choose M here: the
+       tristate "USB KOBIL chipcard reader"
+       ---help---
+         Say Y here if you want to use one of the following KOBIL USB chipcard
+         readers:
+
+           - USB TWIN
+           - KAAN Standard Plus
+           - KAAN SIM
+           - SecOVID Reader Plus
+           - B1 Professional
+           - KAAN Professional
+
+         Note that you need a current CT-API.
+         To compile this driver as a module, choose M here: the
          module will be called kobil_sct.
 
 config USB_SERIAL_MCT_U232
@@ -458,7 +458,7 @@ config USB_SERIAL_OTI6858
        tristate "USB Ours Technology Inc. OTi-6858 USB To RS232 Bridge Controller"
        help
          Say Y here if you want to use the OTi-6858 single port USB to serial
-          converter device.
+         converter device.
 
          To compile this driver as a module, choose M here: the
          module will be called oti6858.
index 54a3c8195c969785a6ab2a359a2787f321cce553..66a4dcbbb1fc9de2c5f160497926848ace8bb37a 100644 (file)
@@ -369,8 +369,8 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
 
        /* check for state-transition errors */
        if (us->srb != NULL) {
-               printk(KERN_ERR "usb-storage: Error in %s: us->srb = %p\n",
-                       __func__, us->srb);
+               dev_err(&us->pusb_intf->dev,
+                       "Error in %s: us->srb = %p\n", __func__, us->srb);
                return SCSI_MLQUEUE_HOST_BUSY;
        }
 
index 895e2418de53b13e260e5f9918502542f0ba5163..b4f2aac7ae8a9b9856f17c3852129e4807b02928 100644 (file)
@@ -50,6 +50,17 @@ source "drivers/usb/typec/tcpm/Kconfig"
 
 source "drivers/usb/typec/ucsi/Kconfig"
 
+config TYPEC_HD3SS3220
+       tristate "TI HD3SS3220 Type-C DRP Port controller driver"
+       depends on I2C
+       depends on USB_ROLE_SWITCH
+       help
+         Say Y or M here if your system has TI HD3SS3220 Type-C DRP Port
+         controller driver.
+
+         If you choose to build this driver as a dynamically linked module, the
+         module will be called hd3ss3220.ko.
+
 config TYPEC_TPS6598X
        tristate "TI TPS6598x USB Power Delivery controller driver"
        depends on I2C
index 6696b7263d61a864c8d2f46d4b3bc1e373ae4dad..7753a5c3cd4629893badebede6b3d02a3c2bbcb3 100644 (file)
@@ -4,5 +4,6 @@ typec-y                         := class.o mux.o bus.o
 obj-$(CONFIG_TYPEC)            += altmodes/
 obj-$(CONFIG_TYPEC_TCPM)       += tcpm/
 obj-$(CONFIG_TYPEC_UCSI)       += ucsi/
+obj-$(CONFIG_TYPEC_HD3SS3220)  += hd3ss3220.o
 obj-$(CONFIG_TYPEC_TPS6598X)   += tps6598x.o
 obj-$(CONFIG_TYPEC)            += mux/
diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
new file mode 100644 (file)
index 0000000..8afaf57
--- /dev/null
@@ -0,0 +1,261 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * TI HD3SS3220 Type-C DRP Port Controller Driver
+ *
+ * Copyright (C) 2019 Renesas Electronics Corp.
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/usb/role.h>
+#include <linux/irqreturn.h>
+#include <linux/interrupt.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/usb/typec.h>
+#include <linux/delay.h>
+
+#define HD3SS3220_REG_CN_STAT_CTRL     0x09
+#define HD3SS3220_REG_GEN_CTRL         0x0A
+#define HD3SS3220_REG_DEV_REV          0xA0
+
+/* Register HD3SS3220_REG_CN_STAT_CTRL*/
+#define HD3SS3220_REG_CN_STAT_CTRL_ATTACHED_STATE_MASK (BIT(7) | BIT(6))
+#define HD3SS3220_REG_CN_STAT_CTRL_AS_DFP              BIT(6)
+#define HD3SS3220_REG_CN_STAT_CTRL_AS_UFP              BIT(7)
+#define HD3SS3220_REG_CN_STAT_CTRL_TO_ACCESSORY                (BIT(7) | BIT(6))
+#define HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS          BIT(4)
+
+/* Register HD3SS3220_REG_GEN_CTRL*/
+#define HD3SS3220_REG_GEN_CTRL_SRC_PREF_MASK           (BIT(2) | BIT(1))
+#define HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_DEFAULT    0x00
+#define HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_TRY_SNK    BIT(1)
+#define HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_TRY_SRC    (BIT(2) | BIT(1))
+
+struct hd3ss3220 {
+       struct device *dev;
+       struct regmap *regmap;
+       struct usb_role_switch  *role_sw;
+       struct typec_port *port;
+       struct typec_capability typec_cap;
+};
+
+static int hd3ss3220_set_source_pref(struct hd3ss3220 *hd3ss3220, int src_pref)
+{
+       return regmap_update_bits(hd3ss3220->regmap, HD3SS3220_REG_GEN_CTRL,
+                                 HD3SS3220_REG_GEN_CTRL_SRC_PREF_MASK,
+                                 src_pref);
+}
+
+static enum usb_role hd3ss3220_get_attached_state(struct hd3ss3220 *hd3ss3220)
+{
+       unsigned int reg_val;
+       enum usb_role attached_state;
+       int ret;
+
+       ret = regmap_read(hd3ss3220->regmap, HD3SS3220_REG_CN_STAT_CTRL,
+                         &reg_val);
+       if (ret < 0)
+               return ret;
+
+       switch (reg_val & HD3SS3220_REG_CN_STAT_CTRL_ATTACHED_STATE_MASK) {
+       case HD3SS3220_REG_CN_STAT_CTRL_AS_DFP:
+               attached_state = USB_ROLE_HOST;
+               break;
+       case HD3SS3220_REG_CN_STAT_CTRL_AS_UFP:
+               attached_state = USB_ROLE_DEVICE;
+               break;
+       default:
+               attached_state = USB_ROLE_NONE;
+               break;
+       }
+
+       return attached_state;
+}
+
+static int hd3ss3220_dr_set(const struct typec_capability *cap,
+                           enum typec_data_role role)
+{
+       struct hd3ss3220 *hd3ss3220 = container_of(cap, struct hd3ss3220,
+                                                  typec_cap);
+       enum usb_role role_val;
+       int pref, ret = 0;
+
+       if (role == TYPEC_HOST) {
+               role_val = USB_ROLE_HOST;
+               pref = HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_TRY_SRC;
+       } else {
+               role_val = USB_ROLE_DEVICE;
+               pref = HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_TRY_SNK;
+       }
+
+       ret = hd3ss3220_set_source_pref(hd3ss3220, pref);
+       usleep_range(10, 100);
+
+       usb_role_switch_set_role(hd3ss3220->role_sw, role_val);
+       typec_set_data_role(hd3ss3220->port, role);
+
+       return ret;
+}
+
+static void hd3ss3220_set_role(struct hd3ss3220 *hd3ss3220)
+{
+       enum usb_role role_state = hd3ss3220_get_attached_state(hd3ss3220);
+
+       usb_role_switch_set_role(hd3ss3220->role_sw, role_state);
+       if (role_state == USB_ROLE_NONE)
+               hd3ss3220_set_source_pref(hd3ss3220,
+                               HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_DEFAULT);
+
+       switch (role_state) {
+       case USB_ROLE_HOST:
+               typec_set_data_role(hd3ss3220->port, TYPEC_HOST);
+               break;
+       case USB_ROLE_DEVICE:
+               typec_set_data_role(hd3ss3220->port, TYPEC_DEVICE);
+               break;
+       default:
+               break;
+       }
+}
+
+static irqreturn_t hd3ss3220_irq(struct hd3ss3220 *hd3ss3220)
+{
+       int err;
+
+       hd3ss3220_set_role(hd3ss3220);
+       err = regmap_update_bits_base(hd3ss3220->regmap,
+                                     HD3SS3220_REG_CN_STAT_CTRL,
+                                     HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS,
+                                     HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS,
+                                     NULL, false, true);
+       if (err < 0)
+               return IRQ_NONE;
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t hd3ss3220_irq_handler(int irq, void *data)
+{
+       struct i2c_client *client = to_i2c_client(data);
+       struct hd3ss3220 *hd3ss3220 = i2c_get_clientdata(client);
+
+       return hd3ss3220_irq(hd3ss3220);
+}
+
+static const struct regmap_config config = {
+       .reg_bits = 8,
+       .val_bits = 8,
+       .max_register = 0x0A,
+};
+
+static int hd3ss3220_probe(struct i2c_client *client,
+               const struct i2c_device_id *id)
+{
+       struct hd3ss3220 *hd3ss3220;
+       struct fwnode_handle *connector;
+       int ret;
+       unsigned int data;
+
+       hd3ss3220 = devm_kzalloc(&client->dev, sizeof(struct hd3ss3220),
+                                GFP_KERNEL);
+       if (!hd3ss3220)
+               return -ENOMEM;
+
+       i2c_set_clientdata(client, hd3ss3220);
+
+       hd3ss3220->dev = &client->dev;
+       hd3ss3220->regmap = devm_regmap_init_i2c(client, &config);
+       if (IS_ERR(hd3ss3220->regmap))
+               return PTR_ERR(hd3ss3220->regmap);
+
+       hd3ss3220_set_source_pref(hd3ss3220,
+                                 HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_DEFAULT);
+       connector = device_get_named_child_node(hd3ss3220->dev, "connector");
+       if (!connector)
+               return -ENODEV;
+
+       hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector);
+       fwnode_handle_put(connector);
+       if (IS_ERR(hd3ss3220->role_sw))
+               return PTR_ERR(hd3ss3220->role_sw);
+
+       hd3ss3220->typec_cap.prefer_role = TYPEC_NO_PREFERRED_ROLE;
+       hd3ss3220->typec_cap.dr_set = hd3ss3220_dr_set;
+       hd3ss3220->typec_cap.type = TYPEC_PORT_DRP;
+       hd3ss3220->typec_cap.data = TYPEC_PORT_DRD;
+
+       hd3ss3220->port = typec_register_port(&client->dev,
+                                             &hd3ss3220->typec_cap);
+       if (IS_ERR(hd3ss3220->port)) {
+               ret = PTR_ERR(hd3ss3220->port);
+               goto err_put_role;
+       }
+
+       hd3ss3220_set_role(hd3ss3220);
+       ret = regmap_read(hd3ss3220->regmap, HD3SS3220_REG_CN_STAT_CTRL, &data);
+       if (ret < 0)
+               goto err_unreg_port;
+
+       if (data & HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS) {
+               ret = regmap_write(hd3ss3220->regmap,
+                               HD3SS3220_REG_CN_STAT_CTRL,
+                               data | HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS);
+               if (ret < 0)
+                       goto err_unreg_port;
+       }
+
+       if (client->irq > 0) {
+               ret = devm_request_threaded_irq(&client->dev, client->irq, NULL,
+                                       hd3ss3220_irq_handler,
+                                       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+                                       "hd3ss3220", &client->dev);
+               if (ret)
+                       goto err_unreg_port;
+       }
+
+       ret = i2c_smbus_read_byte_data(client, HD3SS3220_REG_DEV_REV);
+       if (ret < 0)
+               goto err_unreg_port;
+
+       dev_info(&client->dev, "probed revision=0x%x\n", ret);
+
+       return 0;
+err_unreg_port:
+       typec_unregister_port(hd3ss3220->port);
+err_put_role:
+       usb_role_switch_put(hd3ss3220->role_sw);
+
+       return ret;
+}
+
+static int hd3ss3220_remove(struct i2c_client *client)
+{
+       struct hd3ss3220 *hd3ss3220 = i2c_get_clientdata(client);
+
+       typec_unregister_port(hd3ss3220->port);
+       usb_role_switch_put(hd3ss3220->role_sw);
+
+       return 0;
+}
+
+static const struct of_device_id dev_ids[] = {
+       { .compatible = "ti,hd3ss3220"},
+       {}
+};
+MODULE_DEVICE_TABLE(of, dev_ids);
+
+static struct i2c_driver hd3ss3220_driver = {
+       .driver = {
+               .name = "hd3ss3220",
+               .of_match_table = of_match_ptr(dev_ids),
+       },
+       .probe = hd3ss3220_probe,
+       .remove =  hd3ss3220_remove,
+};
+
+module_i2c_driver(hd3ss3220_driver);
+
+MODULE_AUTHOR("Biju Das <biju.das@bp.renesas.com>");
+MODULE_DESCRIPTION("TI HD3SS3220 DRP Port Controller Driver");
+MODULE_LICENSE("GPL");
index 36010a82b35930f1d3b154b5eebd1eac3e5b5857..b1c2f6781cb33046ae39a8692aee0f453d93fdb3 100644 (file)
@@ -291,7 +291,7 @@ static int stub_send_ret_submit(struct stub_device *sdev)
                                kfree(iov);
                                usbip_event_add(&sdev->ud,
                                                SDEV_EVENT_ERROR_TCP);
-                          return -1;
+                               return -1;
                        }
                }