dm: usb: Allow usb host drivers to implement usb_reset_root_port
authorHans de Goede <hdegoede@redhat.com>
Wed, 17 Jun 2015 19:33:52 +0000 (21:33 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 21 Jul 2015 23:39:36 +0000 (17:39 -0600)
Allow usb uclass host drivers to implement usb_reset_root_port, this is
used by single port usb hosts which do not emulate a hub, such as otg
controllers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/usb/host/usb-uclass.c
include/usb.h

index fd11cc6f6cfb287a2b8e9c3d4b08d805b231bd63..b0e6e71a8fb0f6017d41177d6d5703fe8b3c1e7e 100644 (file)
@@ -128,6 +128,17 @@ int usb_alloc_device(struct usb_device *udev)
        return ops->alloc_device(bus, udev);
 }
 
+int usb_reset_root_port(struct usb_device *udev)
+{
+       struct udevice *bus = udev->controller_dev;
+       struct dm_usb_ops *ops = usb_get_ops(bus);
+
+       if (!ops->reset_root_port)
+               return -ENOSYS;
+
+       return ops->reset_root_port(bus, udev);
+}
+
 int usb_stop(void)
 {
        struct udevice *bus;
@@ -268,11 +279,6 @@ int usb_init(void)
        return usb_started ? 0 : -1;
 }
 
-int usb_reset_root_port(struct usb_device *udev)
-{
-       return -ENOSYS;
-}
-
 static struct usb_device *find_child_devnum(struct udevice *parent, int devnum)
 {
        struct usb_device *udev;
index 2bb6a063c6b82d2e90023da151cf8a72963bfc47..25f8543f8deee122d5a42116a609d27de5862c8d 100644 (file)
@@ -705,6 +705,11 @@ struct dm_usb_ops {
         * is read). This should be NULL for EHCI, which does not need this.
         */
        int (*alloc_device)(struct udevice *bus, struct usb_device *udev);
+
+       /**
+        * reset_root_port() - Reset usb root port
+        */
+       int (*reset_root_port)(struct udevice *bus, struct usb_device *udev);
 };
 
 #define usb_get_ops(dev)       ((struct dm_usb_ops *)(dev)->driver->ops)