struct resource *res;
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node, *child;
+ struct platform_device *child_pdev;
struct regmap *regmap;
int ret;
goto undo_softreset;
}
- dwc3_data->dr_mode = of_usb_get_dr_mode(child);
-
/* Allocate and initialize the core */
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
goto undo_softreset;
}
+ child_pdev = of_find_device_by_node(child);
+ if (!child_pdev) {
+ dev_err(dev, "failed to find dwc3 core device\n");
+ ret = -ENODEV;
+ goto undo_softreset;
+ }
+
+ dwc3_data->dr_mode = of_usb_get_dr_mode(child_pdev->dev.of_node);
+
/*
* Configure the USB port as device or host according to the static
* configuration passed from DT.