RE: [PATCH v3] usb: dwc2: gadget reuse ahbcfg assigned from platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: John Youn [mailto:John.Youn@xxxxxxxxxxxx]
> Sent: Tuesday, February 24, 2015 3:27 AM
> To: zhangfei; John Youn; balbi@xxxxxx; Kaukab, Yousaf
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v3] usb: dwc2: gadget reuse ahbcfg assigned from platform
> 
> On 2/20/2015 7:26 PM, zhangfei wrote:
> > 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@xxxxxxxxxx>
> >>> ---
> >>>   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.
> 
> Yes you're right. However core_params is documented as both a device and
> host accessible member but it is only ever initialized and used in host mode. I
> think it should be fixed to always have valid and initialized values in device
> mode as well.

http://permalink.gmane.org/gmane.linux.usb.general/123272 should fix this.

> 
> John
> 
> 

BR,
Yousaf
��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux