Skip to content

Commit 918ee0d

Browse files
Roger Quadrosgregkh
authored andcommitted
usb: phy: omap-usb3: Don't use omap_get_control_dev()
omap_get_control_dev() is being deprecated as it doesn't support multiple instances. As control device is present only from OMAP4 onwards which supports DT only, we use phandles to get the reference to the control device. As we don't support non-DT boot, we just bail out on probe if device node is not present. Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 478b6c7 commit 918ee0d

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

drivers/usb/phy/phy-omap-usb3.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/pm_runtime.h>
2727
#include <linux/delay.h>
2828
#include <linux/usb/omap_control_usb.h>
29+
#include <linux/of_platform.h>
2930

3031
#define PLL_STATUS 0x00000004
3132
#define PLL_GO 0x00000008
@@ -196,8 +197,14 @@ static int omap_usb3_init(struct usb_phy *x)
196197

197198
static int omap_usb3_probe(struct platform_device *pdev)
198199
{
199-
struct omap_usb *phy;
200-
struct resource *res;
200+
struct omap_usb *phy;
201+
struct resource *res;
202+
struct device_node *node = pdev->dev.of_node;
203+
struct device_node *control_node;
204+
struct platform_device *control_pdev;
205+
206+
if (!node)
207+
return -EINVAL;
201208

202209
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
203210
if (!phy) {
@@ -239,11 +246,18 @@ static int omap_usb3_probe(struct platform_device *pdev)
239246
return -EINVAL;
240247
}
241248

242-
phy->control_dev = omap_get_control_dev();
243-
if (IS_ERR(phy->control_dev)) {
244-
dev_dbg(&pdev->dev, "Failed to get control device\n");
245-
return -ENODEV;
249+
control_node = of_parse_phandle(node, "ctrl-module", 0);
250+
if (!control_node) {
251+
dev_err(&pdev->dev, "Failed to get control device phandle\n");
252+
return -EINVAL;
246253
}
254+
control_pdev = of_find_device_by_node(control_node);
255+
if (!control_pdev) {
256+
dev_err(&pdev->dev, "Failed to get control device\n");
257+
return -EINVAL;
258+
}
259+
260+
phy->control_dev = &control_pdev->dev;
247261

248262
omap_control_usb_phy_power(phy->control_dev, 0);
249263
usb_add_phy_dev(&phy->phy);

0 commit comments

Comments
 (0)