mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/9] usb: Add usb phy to usb host
Date: Thu, 29 Sep 2016 14:38:53 +0200	[thread overview]
Message-ID: <20160929123900.24853-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

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>
---
 drivers/usb/core/hub.c | 8 ++++++++
 include/usb/usb.h      | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index dd3c10e..f44aea5 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 aedc527..93308ce 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 *);
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-09-29 12:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 12:38 [PATCH 1/9] usb: Use standard debug macro Sascha Hauer
2016-09-29 12:38 ` Sascha Hauer [this message]
2016-09-29 12:38 ` [PATCH 3/9] usb: ehci: forward phy given in registration data to host Sascha Hauer
2016-09-29 12:38 ` [PATCH 4/9] usb: imx-usb-phy: Drop unnecessary read/modify/write Sascha Hauer
2016-09-29 12:38 ` [PATCH 5/9] phy: Introduce of_phy_get_by_phandle Sascha Hauer
2016-09-29 12:38 ` [PATCH 6/9] phy: Introduce to_usbphy conversion function Sascha Hauer
2016-09-29 12:38 ` [PATCH 7/9] phy: Add usb-nop-xceiv support Sascha Hauer
2016-09-29 12:38 ` [PATCH 8/9] usb: imx-us-phy: Convert driver to generic phy support Sascha Hauer
2016-09-29 12:39 ` [PATCH 9/9] usb: imx-us-phy: implement notify_(dis)concect Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160929123900.24853-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox