diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-06-13 10:59:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 16:47:17 -0400 |
commit | 691962d1593a16d5c8c9a5bb60b586ac3e54acc8 (patch) | |
tree | c1883ccaa32b99032b62e856b9db46e36e9c7d74 /drivers/usb/chipidea/core.c | |
parent | 40dcd0e8067b35e247f74409d79443634daf35ac (diff) |
usb: chipidea: introduce dual role mode pdata flags
Even if a chipidea core is otg capable the board may not be. This allows
to explicitly set the core to host/peripheral mode. Without these flags
the driver falls back to the old behaviour.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r-- | drivers/usb/chipidea/core.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index a25f6b68550f..66c6c7157bb9 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -405,6 +405,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
405 | struct resource *res; | 405 | struct resource *res; |
406 | void __iomem *base; | 406 | void __iomem *base; |
407 | int ret; | 407 | int ret; |
408 | enum usb_dr_mode dr_mode; | ||
408 | 409 | ||
409 | if (!dev->platform_data) { | 410 | if (!dev->platform_data) { |
410 | dev_err(dev, "platform data missing\n"); | 411 | dev_err(dev, "platform data missing\n"); |
@@ -456,14 +457,25 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
456 | if (!ci->platdata->phy_mode) | 457 | if (!ci->platdata->phy_mode) |
457 | ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); | 458 | ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); |
458 | 459 | ||
460 | if (!ci->platdata->dr_mode) | ||
461 | ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node); | ||
462 | |||
463 | if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN) | ||
464 | ci->platdata->dr_mode = USB_DR_MODE_OTG; | ||
465 | |||
466 | dr_mode = ci->platdata->dr_mode; | ||
459 | /* initialize role(s) before the interrupt is requested */ | 467 | /* initialize role(s) before the interrupt is requested */ |
460 | ret = ci_hdrc_host_init(ci); | 468 | if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { |
461 | if (ret) | 469 | ret = ci_hdrc_host_init(ci); |
462 | dev_info(dev, "doesn't support host\n"); | 470 | if (ret) |
471 | dev_info(dev, "doesn't support host\n"); | ||
472 | } | ||
463 | 473 | ||
464 | ret = ci_hdrc_gadget_init(ci); | 474 | if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) { |
465 | if (ret) | 475 | ret = ci_hdrc_gadget_init(ci); |
466 | dev_info(dev, "doesn't support gadget\n"); | 476 | if (ret) |
477 | dev_info(dev, "doesn't support gadget\n"); | ||
478 | } | ||
467 | 479 | ||
468 | if (!ci->roles[CI_ROLE_HOST] && !ci->roles[CI_ROLE_GADGET]) { | 480 | if (!ci->roles[CI_ROLE_HOST] && !ci->roles[CI_ROLE_GADGET]) { |
469 | dev_err(dev, "no supported roles\n"); | 481 | dev_err(dev, "no supported roles\n"); |