diff mbox

[v2,2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

Message ID 1423142643-12280-3-git-send-email-zhangfei.gao@linaro.org
State New
Headers show

Commit Message

Zhangfei Gao Feb. 5, 2015, 1:24 p.m. UTC
Gadget directly set GAHBCFG_HBSTLEN_INCR4, reuse ahbcfg if assigned from platform

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
 drivers/usb/dwc2/core.c   | 2 +-
 drivers/usb/dwc2/gadget.c | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index d5197d4..8d388cc 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -2563,7 +2563,7 @@  void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val)
 
 void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)
 {
-	if (val != -1)
+	if (val)
 		hsotg->core_params->ahbcfg = val;
 	else
 		hsotg->core_params->ahbcfg = GAHBCFG_HBSTLEN_INCR4 <<
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 15aa578..82b520a 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2314,9 +2314,13 @@  void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
 		GINTSTS_USBSUSP | GINTSTS_WKUPINT,
 		hsotg->regs + GINTMSK);
 
+	if (hsotg->core_params && hsotg->core_params->ahbcfg != -1)
+		val = hsotg->core_params->ahbcfg & ~GAHBCFG_CTRL_MASK;
+	else
+		val = GAHBCFG_HBSTLEN_INCR4 << GAHBCFG_HBSTLEN_SHIFT;
+
 	if (using_dma(hsotg))
-		writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
-		       (GAHBCFG_HBSTLEN_INCR4 << GAHBCFG_HBSTLEN_SHIFT),
+		writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN | val,
 		       hsotg->regs + GAHBCFG);
 	else
 		writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |