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....@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.

Until this is fixed properly we shouldn't access this here.

John






--
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