Commit edd74be8 authored by Gregory Herrero's avatar Gregory Herrero Committed by Felipe Balbi

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: default avatarRobert Baldyga <r.baldyga@samsung.com>
Acked-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarGregory Herrero <gregory.herrero@intel.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent f5090044
...@@ -563,6 +563,7 @@ struct dwc2_hw_params { ...@@ -563,6 +563,7 @@ struct dwc2_hw_params {
* @setup: NAK management for EP0 SETUP * @setup: NAK management for EP0 SETUP
* @last_rst: Time of last reset * @last_rst: Time of last reset
* @eps: The endpoints being supplied to the gadget framework * @eps: The endpoints being supplied to the gadget framework
* @g_using_dma: Indicate if dma usage is enabled
*/ */
struct dwc2_hsotg { struct dwc2_hsotg {
struct device *dev; struct device *dev;
...@@ -696,6 +697,7 @@ struct dwc2_hsotg { ...@@ -696,6 +697,7 @@ struct dwc2_hsotg {
unsigned int setup:1; unsigned int setup:1;
unsigned long last_rst; unsigned long last_rst;
struct s3c_hsotg_ep *eps; struct s3c_hsotg_ep *eps;
u32 g_using_dma;
#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
}; };
......
...@@ -85,11 +85,11 @@ static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg); ...@@ -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 * a core reset. This means we either need to fix the gadgets to take
* account of DMA alignment, or add bounce buffers (yuerk). * 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) 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) ...@@ -3402,6 +3402,18 @@ static void s3c_hsotg_delete_debug(struct dwc2_hsotg *hsotg)
debugfs_remove(hsotg->debug_root); 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_gadget_init - init function for gadget
* @dwc2: The data structure for the DWC2 driver. * @dwc2: The data structure for the DWC2 driver.
...@@ -3419,6 +3431,8 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -3419,6 +3431,8 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
/* Set default UTMI width */ /* Set default UTMI width */
hsotg->phyif = GUSBCFG_PHYIF16; hsotg->phyif = GUSBCFG_PHYIF16;
s3c_hsotg_of_probe(hsotg);
/* /*
* If platform probe couldn't find a generic PHY or an old style * If platform probe couldn't find a generic PHY or an old style
* USB PHY, fall back to pdata * USB PHY, fall back to pdata
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment