aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/usb.c
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2016-02-19 04:26:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-05 15:05:01 -0500
commit69bec725985324e79b1c47ea287815ac4ddb0521 (patch)
treef6fbc0e6440facdafada6f45af9ec5754190d730 /drivers/usb/core/usb.c
parentd883f52e1f6d2eca8378e3795f333c1396943873 (diff)
USB: core: let USB device know device node
Although most of USB devices are hot-plug's, there are still some devices are hard wired on the board, eg, for HSIC and SSIC interface USB devices. If these kinds of USB devices are multiple functions, and they can supply other interfaces like i2c, gpios for other devices, we may need to describe these at device tree. In this commit, it uses "reg" in dts as physical port number to match the phyiscal port number decided by USB core, if they are the same, then the device node is for the device we are creating for USB core. Signed-off-by: Peter Chen <peter.chen@freescale.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/usb.c')
-rw-r--r--drivers/usb/core/usb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 524c9822d2bb..ffa5cf13ffe1 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -36,6 +36,7 @@
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38#include <linux/debugfs.h> 38#include <linux/debugfs.h>
39#include <linux/usb/of.h>
39 40
40#include <asm/io.h> 41#include <asm/io.h>
41#include <linux/scatterlist.h> 42#include <linux/scatterlist.h>
@@ -470,6 +471,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
470 dev->route = 0; 471 dev->route = 0;
471 472
472 dev->dev.parent = bus->controller; 473 dev->dev.parent = bus->controller;
474 dev->dev.of_node = bus->controller->of_node;
473 dev_set_name(&dev->dev, "usb%d", bus->busnum); 475 dev_set_name(&dev->dev, "usb%d", bus->busnum);
474 root_hub = 1; 476 root_hub = 1;
475 } else { 477 } else {
@@ -494,6 +496,14 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
494 dev->dev.parent = &parent->dev; 496 dev->dev.parent = &parent->dev;
495 dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath); 497 dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath);
496 498
499 if (!parent->parent) {
500 /* device under root hub's port */
501 port1 = usb_hcd_find_raw_port_number(usb_hcd,
502 port1);
503 }
504 dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node,
505 port1);
506
497 /* hub driver sets up TT records */ 507 /* hub driver sets up TT records */
498 } 508 }
499 509