aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2009-04-27 22:54:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:48 -0400
commit7206b00164a1c3ca533e01db285955617e1019f8 (patch)
treed11f6a5a63238110d4b763661a76ca87761a2d02 /drivers
parente7b7717247f61e2cf18ec47f91999065c59d1607 (diff)
USB: Add route string to struct usb_device.
This patch adds a hex route string to each USB device. The route string is used by the USB 3.0 host controller to send packets through the device tree. USB 3.0 hubs use this string to route packets to the correct port. This is fundamental bus change from USB 2.0, where all packets were broadcast across the bus. Devices (including hubs) under a root port receive the route string 0x0. Every four bits in the route string represent a port on a hub. This length works because USB 3.0 hubs are limited to 15 ports, and USB 2.0 hubs (with potentially more ports) will never see packets with a route string. A port number of 0 means the packet is destined for that hub. For example, a peripheral device might have a route string of 0x00097. This means the device is connected to port 9 of the hub at depth 1. The hub at depth 1 is connected to port 7 of a hub at depth 0. The hub at depth 0 is connected to a root port. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/usb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 020b58528d90..f026991d0bdf 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -375,18 +375,24 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
375 */ 375 */
376 if (unlikely(!parent)) { 376 if (unlikely(!parent)) {
377 dev->devpath[0] = '0'; 377 dev->devpath[0] = '0';
378 dev->route = 0;
378 379
379 dev->dev.parent = bus->controller; 380 dev->dev.parent = bus->controller;
380 dev_set_name(&dev->dev, "usb%d", bus->busnum); 381 dev_set_name(&dev->dev, "usb%d", bus->busnum);
381 root_hub = 1; 382 root_hub = 1;
382 } else { 383 } else {
383 /* match any labeling on the hubs; it's one-based */ 384 /* match any labeling on the hubs; it's one-based */
384 if (parent->devpath[0] == '0') 385 if (parent->devpath[0] == '0') {
385 snprintf(dev->devpath, sizeof dev->devpath, 386 snprintf(dev->devpath, sizeof dev->devpath,
386 "%d", port1); 387 "%d", port1);
387 else 388 /* Root ports are not counted in route string */
389 dev->route = 0;
390 } else {
388 snprintf(dev->devpath, sizeof dev->devpath, 391 snprintf(dev->devpath, sizeof dev->devpath,
389 "%s.%d", parent->devpath, port1); 392 "%s.%d", parent->devpath, port1);
393 dev->route = parent->route +
394 (port1 << ((parent->level - 1)*4));
395 }
390 396
391 dev->dev.parent = &parent->dev; 397 dev->dev.parent = &parent->dev;
392 dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath); 398 dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath);