Reuse ahbcfg if assigned from platform

Input from John:
AHB_SINGLE, NOTI_ALL_DMA_WRIT, REM_MEM_SUPP, HBSTLEN,
and INV_DESC_ENDIANNESS only apply in DMA mode and are
ignored in slave mode operation.

Signed-off-by: Zhangfei Gao <zhangfei....@linaro.org>
---
 drivers/usb/dwc2/gadget.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 15aa578..5726fbe 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2314,14 +2314,19 @@ 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 = 0;
+
        if (using_dma(hsotg))
                writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
-                      (GAHBCFG_HBSTLEN_INCR4 << GAHBCFG_HBSTLEN_SHIFT),
-                      hsotg->regs + GAHBCFG);
+                      (val ? val : GAHBCFG_HBSTLEN_INCR4 <<
+                      GAHBCFG_HBSTLEN_SHIFT), hsotg->regs + GAHBCFG);
        else
                writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
                                                    GAHBCFG_P_TXF_EMP_LVL) : 0) 
|
-                      GAHBCFG_GLBL_INTR_EN,
+                      GAHBCFG_GLBL_INTR_EN | val,
                       hsotg->regs + GAHBCFG);
 
        /*
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to