aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-06-13 17:59:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-17 13:47:17 -0700
commit691962d1593a16d5c8c9a5bb60b586ac3e54acc8 (patch)
treec1883ccaa32b99032b62e856b9db46e36e9c7d74 /drivers/usb/chipidea
parentusb: chipidea: add PTW, PTS and STS handling (diff)
downloadlinux-dev-691962d1593a16d5c8c9a5bb60b586ac3e54acc8.tar.xz
linux-dev-691962d1593a16d5c8c9a5bb60b586ac3e54acc8.zip
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')
-rw-r--r--drivers/usb/chipidea/core.c24
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)
struct resource *res;
void __iomem *base;
int ret;
+ enum usb_dr_mode dr_mode;
if (!dev->platform_data) {
dev_err(dev, "platform data missing\n");
@@ -456,14 +457,25 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ci->platdata->phy_mode)
ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
+ if (!ci->platdata->dr_mode)
+ ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
+
+ if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN)
+ ci->platdata->dr_mode = USB_DR_MODE_OTG;
+
+ dr_mode = ci->platdata->dr_mode;
/* initialize role(s) before the interrupt is requested */
- ret = ci_hdrc_host_init(ci);
- if (ret)
- dev_info(dev, "doesn't support host\n");
+ if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
+ ret = ci_hdrc_host_init(ci);
+ if (ret)
+ dev_info(dev, "doesn't support host\n");
+ }
- ret = ci_hdrc_gadget_init(ci);
- if (ret)
- dev_info(dev, "doesn't support gadget\n");
+ if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) {
+ ret = ci_hdrc_gadget_init(ci);
+ if (ret)
+ dev_info(dev, "doesn't support gadget\n");
+ }
if (!ci->roles[CI_ROLE_HOST] && !ci->roles[CI_ROLE_GADGET]) {
dev_err(dev, "no supported roles\n");