summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-09-29 09:36:23 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-09-29 13:57:14 +0200
commit0408cb01fa4dbf80fbc1516af8cdc86e087c63ac (patch)
treecf1a1da7a980ac6f6555bc8b913418751b6f4e09
parent8ac094d3465fcd116cf175c711e27681c9c4a336 (diff)
downloadbarebox-0408cb01fa4dbf80fbc1516af8cdc86e087c63ac.tar.gz
barebox-0408cb01fa4dbf80fbc1516af8cdc86e087c63ac.tar.xz
usb: Add usb phy to usb host
Add a struct usb_phy * member to struct usb_host. Also, call usb_phy_notify_connect() / usb_phy_notify_disconnect() when there are connection changes on the root hub. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/core/hub.c8
-rw-r--r--include/usb/usb.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index dd3c10e825..f44aea55af 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -22,6 +22,7 @@
#include <malloc.h>
#include <errno.h>
#include <scsi.h>
+#include <usb/phy.h>
#include <usb/usb.h>
#include <usb/usb_defs.h>
@@ -189,6 +190,10 @@ static void usb_hub_port_connect_change(struct usb_device *dev, int port)
if (dev->children[port] && !(portstatus & USB_PORT_STAT_CONNECTION)) {
dev_dbg(&dev->dev, "disconnect detected on port %d\n", port + 1);
usb_remove_device(dev->children[port]);
+
+ if (!dev->parent && dev->host->usbphy)
+ usb_phy_notify_disconnect(dev->host->usbphy, dev->speed);
+
return;
}
@@ -231,6 +236,9 @@ static void usb_hub_port_connect_change(struct usb_device *dev, int port)
return;
}
+ if (!dev->parent && dev->host->usbphy)
+ usb_phy_notify_connect(dev->host->usbphy, usb->speed);
+
device_detect(&usb->dev);
}
diff --git a/include/usb/usb.h b/include/usb/usb.h
index aedc527f58..93308cec00 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -153,6 +153,7 @@ struct usb_host {
int busnum;
struct usb_device *root_dev;
int sem;
+ struct usb_phy *usbphy;
};
int usb_register_host(struct usb_host *);