Message ID | 1424008201-32416-1-git-send-email-zhangfei.gao@linaro.org |
---|---|
State | New |
Headers | show |
Hi, John On 02/21/2015 08:35 AM, John Youn wrote: > On 2/15/2015 5:50 AM, Zhangfei Gao wrote: >> 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.gao@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); >> >> /* >> > > Hi Zhangfei, > > It looks like currently that the hsotg->core_params structure is not designed to be accessed by the gadget part (or this structure was overlooked during the integration of these drivers). It is only initialized in the host mode and this should crash if host mode is not configured. > If dwc2_hcd_init only called in host mode, hsotg->core_params = NULL. So add judgement if (hsotg->core_params) here to prevent crash. > Until this is fixed properly we shouldn't access this here. > OK. This mismatch does not impact function after all. Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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); /*
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.gao@linaro.org> --- drivers/usb/dwc2/gadget.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)