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

From: Felipe Balbi
Date: Thu Mar 13 2014 - 11:27:22 EST


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().

--
balbi

Attachment: signature.asc
Description: Digital signature