diff options
author | Peter Chen <peter.chen@freescale.com> | 2013-09-17 00:37:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-25 20:23:27 -0400 |
commit | c22600c3ea1d706cfb0fc4a540c4fb356f7ca814 (patch) | |
tree | 1b5cc22d0ea342f4af80354ecfd9d73108572be8 /drivers/usb/chipidea | |
parent | 92b336d7f665c39cc3be774b3d051fe40bf35e5c (diff) |
usb: chipidea: move platform related things to ci_get_platdata
Like vbus, the dr_mode and phy_mode are also got from glue layer's
platform data or device node.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r-- | drivers/usb/chipidea/core.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 94626409559a..d847e73bca18 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -381,6 +381,15 @@ static int ci_get_platdata(struct device *dev, | |||
381 | return PTR_ERR(platdata->reg_vbus); | 381 | return PTR_ERR(platdata->reg_vbus); |
382 | } | 382 | } |
383 | 383 | ||
384 | if (!platdata->phy_mode) | ||
385 | platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); | ||
386 | |||
387 | if (!platdata->dr_mode) | ||
388 | platdata->dr_mode = of_usb_get_dr_mode(dev->of_node); | ||
389 | |||
390 | if (platdata->dr_mode == USB_DR_MODE_UNKNOWN) | ||
391 | platdata->dr_mode = USB_DR_MODE_OTG; | ||
392 | |||
384 | return 0; | 393 | return 0; |
385 | } | 394 | } |
386 | 395 | ||
@@ -473,7 +482,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
473 | void __iomem *base; | 482 | void __iomem *base; |
474 | int ret; | 483 | int ret; |
475 | enum usb_dr_mode dr_mode; | 484 | enum usb_dr_mode dr_mode; |
476 | struct device_node *of_node = dev->of_node ?: dev->parent->of_node; | ||
477 | 485 | ||
478 | if (!dev->platform_data) { | 486 | if (!dev->platform_data) { |
479 | dev_err(dev, "platform data missing\n"); | 487 | dev_err(dev, "platform data missing\n"); |
@@ -514,17 +522,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
514 | 522 | ||
515 | ci_get_otg_capable(ci); | 523 | ci_get_otg_capable(ci); |
516 | 524 | ||
517 | if (!ci->platdata->phy_mode) | ||
518 | ci->platdata->phy_mode = of_usb_get_phy_mode(of_node); | ||
519 | |||
520 | hw_phymode_configure(ci); | 525 | hw_phymode_configure(ci); |
521 | 526 | ||
522 | if (!ci->platdata->dr_mode) | ||
523 | ci->platdata->dr_mode = of_usb_get_dr_mode(of_node); | ||
524 | |||
525 | if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN) | ||
526 | ci->platdata->dr_mode = USB_DR_MODE_OTG; | ||
527 | |||
528 | dr_mode = ci->platdata->dr_mode; | 527 | dr_mode = ci->platdata->dr_mode; |
529 | /* initialize role(s) before the interrupt is requested */ | 528 | /* initialize role(s) before the interrupt is requested */ |
530 | if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { | 529 | if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { |