summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/platform.c
diff options
context:
space:
mode:
authorKever Yang <kever.yang@rock-chips.com>2014-08-06 09:01:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-08 15:43:28 -0700
commitc0155b9d5ef29092d39502ec57b0454b2b3c7cc9 (patch)
tree6c7ada1655a4c741ca043b94a3afc4022598b53a /drivers/usb/dwc2/platform.c
parentfc1b0e2aa3251c5f90bb6c70358832e4dab9abfd (diff)
downloadblackbird-obmc-linux-c0155b9d5ef29092d39502ec57b0454b2b3c7cc9.tar.gz
blackbird-obmc-linux-c0155b9d5ef29092d39502ec57b0454b2b3c7cc9.zip
usb: dwc2: add 'mode' which based on Kconfig select or dts setting
According to the "dr_mode", the otg controller can work as device role and host role. Some boards always want to use host mode and some other boards want to use gadget mode. We use the dts setting to set dwc2's mode, rather than fixing it to whatever hardware says. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Tested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc2/platform.c')
-rw-r--r--drivers/usb/dwc2/platform.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 2f859bdd1fc4..121dbdafc06b 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -42,6 +42,8 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/usb/of.h>
+
#include "core.h"
#include "hcd.h"
@@ -200,6 +202,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n",
(unsigned long)res->start, hsotg->regs);
+ hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node);
+
retval = dwc2_hcd_init(hsotg, irq, params);
if (retval)
return retval;
OpenPOWER on IntegriCloud