When the root hub device is added to the bus, it tries to get pins
information from pinctrl (see pinctrl_bind_pins, at really_probe), if
the pin information is described at DT, it will show below error since
the root hub's device node is the same with controller's, but controller's
pin has already been requested when it is added to platform bus.

        imx6q-pinctrl 20e0000.iomuxc: pin MX6Q_PAD_GPIO_1 already
        requested by 2184000.usb; cannot claim for usb1
        imx6q-pinctrl 20e0000.iomuxc: pin-137 (usb1) status -22
        imx6q-pinctrl 20e0000.iomuxc: could not request pin 137
        (MX6Q_PAD_GPIO_1) from group usbotggrp-3 on device 20e0000.iomuxc
        usb usb1: Error applying setting, reverse things back

To fix this issue, we move the root hub's device node assignment (equals
to contrller's) after device is added to bus, we only need to know root
hub's device node information after the device under root hub is created,
so this movement will not affect current function.

Signed-off-by: Peter Chen <[email protected]>
Reported-by: Lars Steubesand <[email protected]>
---
 drivers/usb/core/hcd.c | 1 +
 drivers/usb/core/usb.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 2ca2cef..563fcc5 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1118,6 +1118,7 @@ static int register_root_hub(struct usb_hcd *hcd)
                /* Did the HC die before the root hub was registered? */
                if (HCD_DEAD(hcd))
                        usb_hc_died (hcd);      /* This time clean up */
+               usb_dev->dev.of_node = parent_dev->of_node;
        }
        mutex_unlock(&usb_bus_idr_lock);
 
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index dcb85e3..9cea6b0 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -472,7 +472,6 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
                dev->route = 0;
 
                dev->dev.parent = bus->controller;
-               dev->dev.of_node = bus->controller->of_node;
                dev_set_name(&dev->dev, "usb%d", bus->busnum);
                root_hub = 1;
        } else {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to