Skip to content

Commit

Permalink
usb: dwc3: st: prepare the driver for generic usb_get_dr_mode function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heikki Krogerus authored and Felipe Balbi committed Sep 27, 2015
1 parent 63863b9 commit 6664727
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/usb/dwc3/dwc3-st.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
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;

Expand Down Expand Up @@ -253,15 +254,22 @@ static int st_dwc3_probe(struct platform_device *pdev)
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) {
dev_err(dev, "failed to add dwc3 core\n");
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.
Expand Down

0 comments on commit 6664727

Please sign in to comment.