Re: [PATCH 1/5] usb: dwc3: fix DEPSTARTCFG for non-EP0 EPs

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

 



Hi,

On Tue, Sep 27, 2011 at 10:49:39PM -0700, Paul Zimmerman wrote:
> DEPSTARTCFG for non-EP0 EPs must only be sent once per config
>
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index debff79..66703b8 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -577,6 +577,7 @@ struct dwc3 {
>  	unsigned		ep0_status_pending:1;
>  	unsigned		ep0_bounced:1;
>  	unsigned		ep0_expect_in:1;
> +	unsigned		config_start:1;

lacking kernel doc update. Also, let's give this flag a more
human-friendly name. How about:

unsigned	start_config_issued:1;

??

> diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
> index 2352efe..6703a7a 100644
> --- a/drivers/usb/dwc3/ep0.c
> +++ b/drivers/usb/dwc3/ep0.c
> @@ -481,6 +481,7 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
>  	u32 cfg;
>  	int ret;
>  
> +	dwc->config_start = false;
>  	cfg = le16_to_cpu(ctrl->wValue);
>  
>  	switch (dwc->dev_state) {
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index b7c30d7..fb3d018 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -237,8 +237,12 @@ static int dwc3_gadget_start_config(struct dwc3 *dwc, struct dwc3_ep *dep)
>  	if (dep->number != 1) {
>  		cmd = DWC3_DEPCMD_DEPSTARTCFG;
>  		/* XferRscIdx == 0 for ep0 and 2 for the remaining */
> -		if (dep->number > 1)
> +		if (dep->number > 1) {
> +			if (dwc->config_start)
> +				return 0;

add a blank line here for readability.

> @@ -1161,6 +1165,8 @@ static int dwc3_gadget_start(struct usb_gadget *g,
>  	reg |= DWC3_DCFG_SUPERSPEED;
>  	dwc3_writel(dwc->regs, DWC3_DCFG, reg);
>  
> +	dwc->config_start = false;

not needed.

> @@ -1592,6 +1598,7 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
>  
>  	dwc3_stop_active_transfers(dwc);
>  	dwc3_disconnect_gadget(dwc);
> +	dwc->config_start = false;

not needed.

> @@ -1644,6 +1651,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
>  
>  	dwc3_stop_active_transfers(dwc);
>  	dwc3_clear_stall_all_ep(dwc);
> +	dwc->config_start = false;

not needed.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux