From ddfb482c0b2b75ac3ce797022f4a19d45d1892cc Mon Sep 17 00:00:00 2001 From: William Wu Date: Thu, 7 Dec 2017 19:22:39 +0800 Subject: [PATCH] usb: dwc2: gadget: config GAHBCFG from core parameter The ahbcfg of dwc2_core_params can be used to overwrite the default value of the GAHBCFG register. But the current code don't use this parameter for dwc2 gadget, and always set the burst length of GAHBCFG to INCR4. This patch sets the the burst length of GAHBCFG to INCR4 only if ahbcfg is -1, otherwise, overwrite the GAHBCFG with the ahbcfg value. Change-Id: I78ed8f797a4b94b34f610789ee3bd61bcc8ed985 Signed-off-by: William Wu --- drivers/usb/dwc2/gadget.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index f2493eccdbee..c1783bf145ba 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2563,15 +2563,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, dwc2_writel(intmsk, hsotg->regs + GINTMSK); - if (using_dma(hsotg)) - dwc2_writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN | - (GAHBCFG_HBSTLEN_INCR4 << GAHBCFG_HBSTLEN_SHIFT), + if (using_dma(hsotg)) { + val = hsotg->core_params->ahbcfg & ~GAHBCFG_CTRL_MASK; + dwc2_writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN | val, hsotg->regs + GAHBCFG); - else + } else { dwc2_writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL | GAHBCFG_P_TXF_EMP_LVL) : 0) | GAHBCFG_GLBL_INTR_EN, hsotg->regs + GAHBCFG); + } /* * If INTknTXFEmpMsk is enabled, it's important to disable ep interrupts