RE: [PATCH 07/10] usb: gadget: net2280: fix use of GPEP in both directions

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

 



> -----Original Message-----
> From: Kaukab, Yousaf
> Sent: Monday, May 4, 2015 11:46 AM
> To: linux-usb@xxxxxxxxxxxxxxx; balbi@xxxxxx; ricardo.ribalda@xxxxxxxxx
> Cc: Kaukab, Yousaf
> Subject: [PATCH 07/10] usb: gadget: net2280: fix use of GPEP in both directions
> 
> USB3380 enhanced mode allows GPEP to be used in both IN and OUT
> directions. However, IN and OUT endpoints must use same USB endpoint
> address (bEndpointAddress). Fix this by setting the ep_cfg.ep_number during
> initialization and keep it in net2280_enable()
> 
> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@xxxxxxxxx>
> ---
>  drivers/usb/gadget/udc/net2280.c | 40 +++++++++++++++++++++++++++++++-
> --------
>  include/linux/usb/usb338x.h      |  4 ++++
>  2 files changed, 35 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/net2280.c
> b/drivers/usb/gadget/udc/net2280.c
> index 7e6e4a3..298ce25 100644
> --- a/drivers/usb/gadget/udc/net2280.c
> +++ b/drivers/usb/gadget/udc/net2280.c
> @@ -144,7 +144,9 @@ net2280_enable(struct usb_ep *_ep, const struct
> usb_endpoint_descriptor *desc)  {
>  	struct net2280		*dev;
>  	struct net2280_ep	*ep;
> -	u32			max, tmp;
> +	u32			max;
> +	u32 tmp = 0;
> +	u32 type;
>  	unsigned long		flags;
>  	static const u32 ep_key[9] = { 1, 0, 1, 0, 1, 1, 0, 1, 0 };
>  	int ret = 0;
> @@ -200,15 +202,28 @@ net2280_enable(struct usb_ep *_ep, const struct
> usb_endpoint_descriptor *desc)
> 
>  	/* set type, direction, address; reset fifo counters */
>  	writel(BIT(FIFO_FLUSH), &ep->regs->ep_stat);
> -	tmp = (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
> -	if (tmp == USB_ENDPOINT_XFER_INT) {
> +
> +	if ((dev->quirks & PLX_SUPERSPEED) && dev->enhanced_mode)
> {
> +		tmp = readl(&ep->cfg->ep_cfg);
> +		/* If USB ep number doesn't match hardware ep
> number */
> +		if ((tmp & 0xf) != usb_endpoint_num(desc)) {
> +			ret = -EINVAL;

dev->lock should be released here.

I will provide the updated patch.

BR,
Yousaf
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux