diff mbox

[U-Boot,09/22] dm: usb: Allow usb host drivers to implement usb_reset_root_port

Message ID 1434569645-30322-10-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Hans de Goede June 17, 2015, 7:33 p.m. UTC
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>
---
 drivers/usb/host/usb-uclass.c | 16 +++++++++++-----
 include/usb.h                 |  5 +++++
 2 files changed, 16 insertions(+), 5 deletions(-)

Comments

Simon Glass June 29, 2015, 3:45 a.m. UTC | #1
On 17 June 2015 at 13:33, Hans de Goede <hdegoede@redhat.com> wrote:
> 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>
> ---
>  drivers/usb/host/usb-uclass.c | 16 +++++++++++-----
>  include/usb.h                 |  5 +++++
>  2 files changed, 16 insertions(+), 5 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass July 7, 2015, 6:35 p.m. UTC | #2
On 28 June 2015 at 21:45, Simon Glass <sjg@chromium.org> wrote:
> On 17 June 2015 at 13:33, Hans de Goede <hdegoede@redhat.com> wrote:
>> 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>
>> ---
>>  drivers/usb/host/usb-uclass.c | 16 +++++++++++-----
>>  include/usb.h                 |  5 +++++
>>  2 files changed, 16 insertions(+), 5 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!
diff mbox

Patch

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 8f26e35..afa8655 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -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);
+}
+
 #ifdef CONFIG_DM_DEVICE_REMOVE
 int usb_stop(void)
 {
@@ -273,11 +284,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;
diff --git a/include/usb.h b/include/usb.h
index 2bb6a06..25f8543 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -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)