RE: [PATCH] USB: Gadget: fsl driver pullup fix

From: suresh.gupta@xxxxxxxxxxxxx
Date: Fri Mar 14 2014 - 17:09:04 EST


Hi,

-----Original Message-----
From: Felipe Balbi [mailto:balbi@xxxxxx]
Sent: Thursday, March 13, 2014 8:55 PM
To: Gupta Suresh-B42813
Cc: balbi@xxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Stefani Seibold
Subject: Re: [PATCH] USB: Gadget: fsl driver pullup fix

Hi,

On Thu, Mar 13, 2014 at 06:40:55PM +0530, Suresh Gupta wrote:
> Attached is a small fix for the fsl usb gadget driver. This fix the
> driver in a way that the usb device will be only "pulled up" on
> requests like other usb gadget drivers do.
> This is necessary, because the device information is not always
> available until an application is up and running which provides this
> datas.
>
> Signed-off-by: Stefani Seibold <stefani@xxxxxxxxxxx>
> Signed-off-by: Suresh Gupta <suresh.gupta@xxxxxxxxxxxxx>
> ---
> drivers/usb/gadget/fsl_udc_core.c | 38
> +++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/usb/gadget/fsl_udc_core.c
> b/drivers/usb/gadget/fsl_udc_core.c
> index 35cb972..9a93727 100644
> --- a/drivers/usb/gadget/fsl_udc_core.c
> +++ b/drivers/usb/gadget/fsl_udc_core.c
> @@ -153,6 +153,21 @@ static inline void fsl_set_accessors(struct
> fsl_usb2_platform_data *pdata) {}
> /********************************************************************
> * Internal Used Function
> ********************************************************************/
> +static int can_pullup(struct fsl_udc *udc) {
> + return udc->driver && udc->softconnect && udc->vbus_active; }
> +
> +static void set_pullup(struct fsl_udc *udc) {
> + if (can_pullup(udc))
> + fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP),
> + &dr_regs->usbcmd);
> + else
> + fsl_writel((fsl_readl(&dr_regs->usbcmd) & ~USB_CMD_RUN_STOP),
> + &dr_regs->usbcmd);
> +}

why is this a "fix", you just re-factored some code into set_pullup().
[SuresH] I set udc->vbus_active and udc->softconnect to default value
of 1 in struct_udc_setup. This was actual fix in this patch.
The can_pullup function return false when these values was not set
and intern the code return without enabling the pullup and gadget controller stops.

--
Thanks
SuresH
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/