mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: [PATCH 09/10] USB: Use descriptors from ch11.h
Date: Wed, 23 Jul 2014 15:51:50 +0200	[thread overview]
Message-ID: <1406123512-26489-10-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1406123512-26489-1-git-send-email-sebastian.hesselbarth@gmail.com>

Use the descriptors from ch11.h instead of duplicating them
in usb.h. usb_hub_descriptor now contains a union .u to differentiate
HS hub descriptor from SS hub descriptor.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
---
 drivers/usb/core/hub.c      | 10 +++++-----
 drivers/usb/host/ehci-hcd.c |  4 ++--
 include/usb/usb.h           | 27 +--------------------------
 3 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 7553bcdd5ef3..c1f743cbed12 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -332,17 +332,17 @@ static int usb_hub_configure(struct usb_device *dev)
 	hub->desc.wHubCharacteristics =
 				le16_to_cpu(descriptor->wHubCharacteristics);
 	/* set the bitmap */
-	bitmap = (unsigned char *)&hub->desc.DeviceRemovable[0];
+	bitmap = (unsigned char *)&hub->desc.u.hs.DeviceRemovable[0];
 	/* devices not removable by default */
 	memset(bitmap, 0xff, (USB_MAXCHILDREN+1+7)/8);
-	bitmap = (unsigned char *)&hub->desc.PortPowerCtrlMask[0];
+	bitmap = (unsigned char *)&hub->desc.u.hs.PortPwrCtrlMask[0];
 	memset(bitmap, 0xff, (USB_MAXCHILDREN+1+7)/8); /* PowerMask = 1B */
 
 	for (i = 0; i < ((hub->desc.bNbrPorts + 1 + 7)/8); i++)
-		hub->desc.DeviceRemovable[i] = descriptor->DeviceRemovable[i];
+		hub->desc.u.hs.DeviceRemovable[i] = descriptor->u.hs.DeviceRemovable[i];
 
 	for (i = 0; i < ((hub->desc.bNbrPorts + 1 + 7)/8); i++)
-		hub->desc.PortPowerCtrlMask[i] = descriptor->PortPowerCtrlMask[i];
+		hub->desc.u.hs.PortPwrCtrlMask[i] = descriptor->u.hs.PortPwrCtrlMask[i];
 
 	dev->maxchild = descriptor->bNbrPorts;
 	dev_dbg(&dev->dev, "%d ports detected\n", dev->maxchild);
@@ -385,7 +385,7 @@ static int usb_hub_configure(struct usb_device *dev)
 
 	for (i = 0; i < dev->maxchild; i++)
 		dev_dbg(&dev->dev, "port %d is%s removable\n", i + 1,
-			hub->desc.DeviceRemovable[(i + 1) / 8] & \
+			hub->desc.u.hs.DeviceRemovable[(i + 1) / 8] & \
 					   (1 << ((i + 1) % 8)) ? " not" : "");
 
 	if (sizeof(struct usb_hub_status) > USB_BUFSIZ) {
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index ab1bc0331ba1..a76e06bd565f 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -69,8 +69,8 @@ static struct descriptor {
 		.wHubCharacteristics	= 0,
 		.bPwrOn2PwrGood		= 10,
 		.bHubContrCurrent	= 0,
-		.DeviceRemovable	= {},
-		.PortPowerCtrlMask	= {}
+		.u.hs.DeviceRemovable	= {},
+		.u.hs.PortPwrCtrlMask	= {}
 	},
 	.device = {
 		.bLength		= USB_DT_DEVICE_SIZE,
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 41f92c2df0ce..82acf20b1298 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -24,6 +24,7 @@
 
 #include <driver.h>
 #include <usb/ch9.h>
+#include <usb/ch11.h>
 #include <usb/usb_defs.h>
 #include <asm/byteorder.h>
 
@@ -311,32 +312,6 @@ void usb_rescan(void);
 /*************************************************************************
  * Hub Stuff
  */
-struct usb_port_status {
-	unsigned short wPortStatus;
-	unsigned short wPortChange;
-} __attribute__ ((packed));
-
-struct usb_hub_status {
-	unsigned short wHubStatus;
-	unsigned short wHubChange;
-} __attribute__ ((packed));
-
-
-/* Hub descriptor */
-struct usb_hub_descriptor {
-	unsigned char  bLength;
-	unsigned char  bDescriptorType;
-	unsigned char  bNbrPorts;
-	unsigned short wHubCharacteristics;
-	unsigned char  bPwrOn2PwrGood;
-	unsigned char  bHubContrCurrent;
-	unsigned char  DeviceRemovable[(USB_MAXCHILDREN+1+7)/8];
-	unsigned char  PortPowerCtrlMask[(USB_MAXCHILDREN+1+7)/8];
-	/* DeviceRemovable and PortPwrCtrlMask want to be variable-length
-	   bitmaps that hold max 255 entries. (bit0 is ignored) */
-} __attribute__ ((packed));
-
-
 struct usb_hub_device {
 	struct usb_device *pusb_dev;
 	struct usb_hub_descriptor desc;
-- 
2.0.0


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

  parent reply	other threads:[~2014-07-23 13:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 13:51 [PATCH 00/10] More USB cleanup and fixes Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 01/10] USB: import ch11.h from Linux Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 02/10] USB: reduce USB_MAXCHILDREN on imported ch11.h Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 03/10] USB: fixup usb_hub_descriptor length name Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 04/10] USB: fix PowerPowerCtrlMask assignment Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 05/10] USB: Move FooRequest defines and add class requests Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 06/10] USB: EHCI: reuse ch9.h config and interface descriptors Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 07/10] USB: EHCI: make use of defines for descriptors Sebastian Hesselbarth
2014-07-23 13:51 ` [PATCH 08/10] USB: EHCI: use descriptor length fields Sebastian Hesselbarth
2014-07-23 13:51 ` Sebastian Hesselbarth [this message]
2014-07-23 13:51 ` [PATCH 10/10] USB: remove redundant defines from usb_defs.h Sebastian Hesselbarth
2014-07-24  7:05 ` [PATCH 00/10] More USB cleanup and fixes 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=1406123512-26489-10-git-send-email-sebastian.hesselbarth@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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