Marc Kleine-Budde <m...@pengutronix.de> writes:

> From: Michael Grzeschik <m.grzesc...@pengutronix.de>
>
> This patch changes the setup of the endpoint maxpacket size. All non control
> endpoints are initialized with an undefined ((unsigned short)~0) maxpacket
> size. The maxpacket size of Endpoint 0 will be kept at CTRL_PAYLOAD_MAX.
>
> Some gadget drivers check for the maxpacket size before they enable the
> endpoint, which leads to a wrong state in these drivers.
>
> Cc: <sta...@vger.kernel.org>
> Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
> Signed-off-by: Marc Kleine-Budde <m...@pengutronix.de>
> Acked-by: Felipe Balbi <ba...@ti.com>

Acked-by: Alexander Shishkin <alexander.shish...@linux.intel.com>

> ---
> changes since v1:
> - reworded patch description
> - Added Felipe's Ack
>
>  drivers/usb/chipidea/udc.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index c7a032a..7801a3f 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -1455,7 +1455,12 @@ static int init_eps(struct ci13xxx *ci)
>  
>                       mEp->ep.name      = mEp->name;
>                       mEp->ep.ops       = &usb_ep_ops;
> -                     mEp->ep.maxpacket = CTRL_PAYLOAD_MAX;
> +                     /*
> +                      * for ep0: maxP defined in desc, for other
> +                      * eps, maxP is set by epautoconfig() called
> +                      * by gadget layer
> +                      */
> +                     mEp->ep.maxpacket = (unsigned short)~0;
>  
>                       INIT_LIST_HEAD(&mEp->qh.queue);
>                       mEp->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL,
> @@ -1475,6 +1480,7 @@ static int init_eps(struct ci13xxx *ci)
>                               else
>                                       ci->ep0in = mEp;
>  
> +                             mEp->ep.maxpacket = CTRL_PAYLOAD_MAX;
>                               continue;
>                       }
>  
> -- 
> 1.7.10.4
--
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