|
26 | 26 | #include <linux/pm_runtime.h> |
27 | 27 | #include <linux/delay.h> |
28 | 28 | #include <linux/usb/omap_control_usb.h> |
| 29 | +#include <linux/of_platform.h> |
29 | 30 |
|
30 | 31 | #define PLL_STATUS 0x00000004 |
31 | 32 | #define PLL_GO 0x00000008 |
@@ -196,8 +197,14 @@ static int omap_usb3_init(struct usb_phy *x) |
196 | 197 |
|
197 | 198 | static int omap_usb3_probe(struct platform_device *pdev) |
198 | 199 | { |
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; |
201 | 208 |
|
202 | 209 | phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); |
203 | 210 | if (!phy) { |
@@ -239,11 +246,18 @@ static int omap_usb3_probe(struct platform_device *pdev) |
239 | 246 | return -EINVAL; |
240 | 247 | } |
241 | 248 |
|
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; |
246 | 253 | } |
| 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; |
247 | 261 |
|
248 | 262 | omap_control_usb_phy_power(phy->control_dev, 0); |
249 | 263 | usb_add_phy_dev(&phy->phy); |
|
0 commit comments