diff options
-rw-r--r-- | drivers/usb/dwc3/dwc3-st.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index de4d52f62517..02d47d50905b 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c | |||
@@ -195,6 +195,7 @@ static int st_dwc3_probe(struct platform_device *pdev) | |||
195 | struct resource *res; | 195 | struct resource *res; |
196 | struct device *dev = &pdev->dev; | 196 | struct device *dev = &pdev->dev; |
197 | struct device_node *node = dev->of_node, *child; | 197 | struct device_node *node = dev->of_node, *child; |
198 | struct platform_device *child_pdev; | ||
198 | struct regmap *regmap; | 199 | struct regmap *regmap; |
199 | int ret; | 200 | int ret; |
200 | 201 | ||
@@ -253,8 +254,6 @@ static int st_dwc3_probe(struct platform_device *pdev) | |||
253 | goto undo_softreset; | 254 | goto undo_softreset; |
254 | } | 255 | } |
255 | 256 | ||
256 | dwc3_data->dr_mode = of_usb_get_dr_mode(child); | ||
257 | |||
258 | /* Allocate and initialize the core */ | 257 | /* Allocate and initialize the core */ |
259 | ret = of_platform_populate(node, NULL, NULL, dev); | 258 | ret = of_platform_populate(node, NULL, NULL, dev); |
260 | if (ret) { | 259 | if (ret) { |
@@ -262,6 +261,15 @@ static int st_dwc3_probe(struct platform_device *pdev) | |||
262 | goto undo_softreset; | 261 | goto undo_softreset; |
263 | } | 262 | } |
264 | 263 | ||
264 | child_pdev = of_find_device_by_node(child); | ||
265 | if (!child_pdev) { | ||
266 | dev_err(dev, "failed to find dwc3 core device\n"); | ||
267 | ret = -ENODEV; | ||
268 | goto undo_softreset; | ||
269 | } | ||
270 | |||
271 | dwc3_data->dr_mode = of_usb_get_dr_mode(child_pdev->dev.of_node); | ||
272 | |||
265 | /* | 273 | /* |
266 | * Configure the USB port as device or host according to the static | 274 | * Configure the USB port as device or host according to the static |
267 | * configuration passed from DT. | 275 | * configuration passed from DT. |