diff options
| -rw-r--r-- | drivers/usb/chipidea/core.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c5b763..1cd5d0ba587c 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
| @@ -277,6 +277,39 @@ static void hw_phymode_configure(struct ci_hdrc *ci) | |||
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | /** | 279 | /** |
| 280 | * ci_usb_phy_init: initialize phy according to different phy type | ||
| 281 | * @ci: the controller | ||
| 282 | * | ||
| 283 | * This function returns an error code if usb_phy_init has failed | ||
| 284 | */ | ||
| 285 | static int ci_usb_phy_init(struct ci_hdrc *ci) | ||
| 286 | { | ||
| 287 | int ret; | ||
| 288 | |||
| 289 | switch (ci->platdata->phy_mode) { | ||
| 290 | case USBPHY_INTERFACE_MODE_UTMI: | ||
| 291 | case USBPHY_INTERFACE_MODE_UTMIW: | ||
| 292 | case USBPHY_INTERFACE_MODE_HSIC: | ||
| 293 | ret = usb_phy_init(ci->transceiver); | ||
| 294 | if (ret) | ||
| 295 | return ret; | ||
| 296 | hw_phymode_configure(ci); | ||
| 297 | break; | ||
| 298 | case USBPHY_INTERFACE_MODE_ULPI: | ||
| 299 | case USBPHY_INTERFACE_MODE_SERIAL: | ||
| 300 | hw_phymode_configure(ci); | ||
| 301 | ret = usb_phy_init(ci->transceiver); | ||
| 302 | if (ret) | ||
| 303 | return ret; | ||
| 304 | break; | ||
| 305 | default: | ||
| 306 | ret = usb_phy_init(ci->transceiver); | ||
| 307 | } | ||
| 308 | |||
| 309 | return ret; | ||
| 310 | } | ||
| 311 | |||
| 312 | /** | ||
| 280 | * hw_device_reset: resets chip (execute without interruption) | 313 | * hw_device_reset: resets chip (execute without interruption) |
| 281 | * @ci: the controller | 314 | * @ci: the controller |
| 282 | * | 315 | * |
| @@ -543,8 +576,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
| 543 | return -ENODEV; | 576 | return -ENODEV; |
| 544 | } | 577 | } |
| 545 | 578 | ||
| 546 | hw_phymode_configure(ci); | ||
| 547 | |||
| 548 | if (ci->platdata->phy) | 579 | if (ci->platdata->phy) |
| 549 | ci->transceiver = ci->platdata->phy; | 580 | ci->transceiver = ci->platdata->phy; |
| 550 | else | 581 | else |
| @@ -564,7 +595,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
| 564 | return -EPROBE_DEFER; | 595 | return -EPROBE_DEFER; |
| 565 | } | 596 | } |
| 566 | 597 | ||
| 567 | ret = usb_phy_init(ci->transceiver); | 598 | ret = ci_usb_phy_init(ci); |
| 568 | if (ret) { | 599 | if (ret) { |
| 569 | dev_err(dev, "unable to init phy: %d\n", ret); | 600 | dev_err(dev, "unable to init phy: %d\n", ret); |
| 570 | return ret; | 601 | return ret; |
