summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/gadget.c
diff options
context:
space:
mode:
authorGregory Herrero <gregory.herrero@intel.com>2015-01-09 13:38:48 +0100
committerFelipe Balbi <balbi@ti.com>2015-01-12 15:33:04 -0600
commitedd74be83047f439e9507cedbbbef0891f3a9a48 (patch)
tree7a2dbe0342da88e7e7a42fc4a92c2cda0d109dea /drivers/usb/dwc2/gadget.c
parentf5090044763fd954a002a6ef466fcbc21033518f (diff)
downloadlinux-edd74be83047f439e9507cedbbbef0891f3a9a48.tar.bz2
usb: dwc2: gadget: add device tree property to enable dma
* Add an of specific function to parse device node properties. * Enable dma usage only if device tree property 'g_use_dma' is present. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2/gadget.c')
-rw-r--r--drivers/usb/dwc2/gadget.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index b98622f2092d..c24cb3bef06a 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -85,11 +85,11 @@ static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg);
* a core reset. This means we either need to fix the gadgets to take
* account of DMA alignment, or add bounce buffers (yuerk).
*
- * Until this issue is sorted out, we always return 'false'.
+ * g_using_dma is set depending on dts flag.
*/
static inline bool using_dma(struct dwc2_hsotg *hsotg)
{
- return false; /* support is not complete */
+ return hsotg->g_using_dma;
}
/**
@@ -3402,6 +3402,18 @@ static void s3c_hsotg_delete_debug(struct dwc2_hsotg *hsotg)
debugfs_remove(hsotg->debug_root);
}
+#ifdef CONFIG_OF
+static void s3c_hsotg_of_probe(struct dwc2_hsotg *hsotg)
+{
+ struct device_node *np = hsotg->dev->of_node;
+
+ /* Enable dma if requested in device tree */
+ hsotg->g_using_dma = of_property_read_bool(np, "g-use-dma");
+}
+#else
+static inline void s3c_hsotg_of_probe(struct dwc2_hsotg *hsotg) { }
+#endif
+
/**
* dwc2_gadget_init - init function for gadget
* @dwc2: The data structure for the DWC2 driver.
@@ -3419,6 +3431,8 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
/* Set default UTMI width */
hsotg->phyif = GUSBCFG_PHYIF16;
+ s3c_hsotg_of_probe(hsotg);
+
/*
* If platform probe couldn't find a generic PHY or an old style
* USB PHY, fall back to pdata