summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2014-07-23 15:51:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-24 08:57:57 +0200
commit6931e9007c7f189c0a66d4a66d2aa1a936a4d385 (patch)
treeaf4b458fe4bd86823e3e25deeede23f9fe69bba3
parentf261bce3a699fd11f7f2d0bbbde26ec26ed1d55f (diff)
downloadbarebox-6931e9007c7f189c0a66d4a66d2aa1a936a4d385.tar.gz
barebox-6931e9007c7f189c0a66d4a66d2aa1a936a4d385.tar.xz
USB: Use descriptors from ch11.h
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/core/hub.c10
-rw-r--r--drivers/usb/host/ehci-hcd.c4
-rw-r--r--include/usb/usb.h27
3 files changed, 8 insertions, 33 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 7553bcdd5e..c1f743cbed 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 ab1bc0331b..a76e06bd56 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 41f92c2df0..82acf20b12 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;