diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2015-09-21 04:14:33 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-09-27 11:54:31 -0400 |
commit | 666472733b8ce20716037c0d866395db54aa8c1d (patch) | |
tree | 68266c3614f578dbab1a2a345e13bcba199216d6 /drivers/usb/dwc3/dwc3-st.c | |
parent | 63863b988eeca2823ce76b28b104e0b8366cafec (diff) |
usb: dwc3: st: prepare the driver for generic usb_get_dr_mode function
of_usb_get_dr_mode will be converted into more generic
usb_get_dr_mode function that will take struct device
instead of struct device_node as its parameter.
To make the conversion possible later, waiting for the
platform device for dwc3 to be populated before calling
of_usb_get_dr_mode.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
CC: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-st.c')
-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. |