linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep
@ 2021-05-17 15:05 Sanket Parmar
  2021-05-22 10:09 ` Peter Chen
  2021-05-26 15:00 ` Aswath Govindraju
  0 siblings, 2 replies; 5+ messages in thread
From: Sanket Parmar @ 2021-05-17 15:05 UTC (permalink / raw)
  To: peter.chen
  Cc: pawell, a-govindraju, linux-usb, linux-kernel, kurahul, gregkh,
	kishon, Sanket Parmar

ZLP gets stuck if TDL_CHK bit is set and TDL_FROM_TRB is used
as TDL source for IN endpoints. To fix it, TDL_CHK is only
enabled for OUT endpoints.

Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Reported-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Sanket Parmar <sparmar@cadence.com>
---
 drivers/usb/cdns3/cdns3-gadget.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 105855a..f3c0276 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
 		else
 			mask = BIT(priv_ep->num);
 
-		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) {
+		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
 			cdns3_set_register_bit(&regs->tdl_from_trb, mask);
 			cdns3_set_register_bit(&regs->tdl_beh, mask);
 			cdns3_set_register_bit(&regs->tdl_beh2, mask);
@@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable)
 	case USB_ENDPOINT_XFER_INT:
 		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT);
 
-		if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
-		    priv_dev->dev_ver > DEV_VER_V2)
+		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
 			ep_cfg |= EP_CFG_TDL_CHK;
 		break;
 	case USB_ENDPOINT_XFER_BULK:
 		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK);
 
-		if ((priv_dev->dev_ver == DEV_VER_V2  && !priv_ep->dir) ||
-		    priv_dev->dev_ver > DEV_VER_V2)
+		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
 			ep_cfg |= EP_CFG_TDL_CHK;
 		break;
 	default:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep
  2021-05-17 15:05 [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep Sanket Parmar
@ 2021-05-22 10:09 ` Peter Chen
  2021-05-24  5:39   ` Sanket Parmar
  2021-05-26 15:00 ` Aswath Govindraju
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Chen @ 2021-05-22 10:09 UTC (permalink / raw)
  To: Sanket Parmar, pawell
  Cc: a-govindraju, linux-usb, linux-kernel, kurahul, gregkh, kishon

On 21-05-17 17:05:12, Sanket Parmar wrote:
> ZLP gets stuck if TDL_CHK bit is set and TDL_FROM_TRB is used
> as TDL source for IN endpoints. To fix it, TDL_CHK is only
> enabled for OUT endpoints.
> 
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Reported-by: Aswath Govindraju <a-govindraju@ti.com>
> Signed-off-by: Sanket Parmar <sparmar@cadence.com>
> ---
>  drivers/usb/cdns3/cdns3-gadget.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 105855a..f3c0276 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
>  		else
>  			mask = BIT(priv_ep->num);
>  
> -		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) {
> +		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
>  			cdns3_set_register_bit(&regs->tdl_from_trb, mask);
>  			cdns3_set_register_bit(&regs->tdl_beh, mask);
>  			cdns3_set_register_bit(&regs->tdl_beh2, mask);
> @@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable)
>  	case USB_ENDPOINT_XFER_INT:
>  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT);
>  
> -		if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
> -		    priv_dev->dev_ver > DEV_VER_V2)
> +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
>  			ep_cfg |= EP_CFG_TDL_CHK;
>  		break;
>  	case USB_ENDPOINT_XFER_BULK:
>  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK);
>  
> -		if ((priv_dev->dev_ver == DEV_VER_V2  && !priv_ep->dir) ||
> -		    priv_dev->dev_ver > DEV_VER_V2)
> +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
>  			ep_cfg |= EP_CFG_TDL_CHK;
>  		break;
>  	default:
> -- 

Sanket & Pawel, please confirm this behaviour could apply for DEV_VER_V3,
that is TDL_CHK can't be used for bulk in for DEV_VER_V3?

-- 

Thanks,
Peter Chen


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep
  2021-05-22 10:09 ` Peter Chen
@ 2021-05-24  5:39   ` Sanket Parmar
  0 siblings, 0 replies; 5+ messages in thread
From: Sanket Parmar @ 2021-05-24  5:39 UTC (permalink / raw)
  To: Peter Chen, Pawel Laszczak
  Cc: a-govindraju, linux-usb, linux-kernel, Rahul Kumar, gregkh, kishon

> On 21-05-17 17:05:12, Sanket Parmar wrote:
> > ZLP gets stuck if TDL_CHK bit is set and TDL_FROM_TRB is used
> > as TDL source for IN endpoints. To fix it, TDL_CHK is only
> > enabled for OUT endpoints.
> >
> > Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> > Reported-by: Aswath Govindraju <a-govindraju@ti.com>
> > Signed-off-by: Sanket Parmar <sparmar@cadence.com>
> > ---
> >  drivers/usb/cdns3/cdns3-gadget.c |    8 +++-----
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-
> gadget.c
> > index 105855a..f3c0276 100644
> > --- a/drivers/usb/cdns3/cdns3-gadget.c
> > +++ b/drivers/usb/cdns3/cdns3-gadget.c
> > @@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct
> cdns3_device *priv_dev,
> >  		else
> >  			mask = BIT(priv_ep->num);
> >
> > -		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) {
> > +		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC  && !priv_ep-
> >dir) {
> >  			cdns3_set_register_bit(&regs->tdl_from_trb, mask);
> >  			cdns3_set_register_bit(&regs->tdl_beh, mask);
> >  			cdns3_set_register_bit(&regs->tdl_beh2, mask);
> > @@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint
> *priv_ep, bool enable)
> >  	case USB_ENDPOINT_XFER_INT:
> >  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT);
> >
> > -		if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
> > -		    priv_dev->dev_ver > DEV_VER_V2)
> > +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
> >  			ep_cfg |= EP_CFG_TDL_CHK;
> >  		break;
> >  	case USB_ENDPOINT_XFER_BULK:
> >  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK);
> >
> > -		if ((priv_dev->dev_ver == DEV_VER_V2  && !priv_ep->dir) ||
> > -		    priv_dev->dev_ver > DEV_VER_V2)
> > +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
> >  			ep_cfg |= EP_CFG_TDL_CHK;
> >  		break;
> >  	default:
> > --
> 
> Sanket & Pawel, please confirm this behaviour could apply for DEV_VER_V3,
> that is TDL_CHK can't be used for bulk in for DEV_VER_V3?

Yes, TDL_CHK shouldn't be used for bulk in for DEV_VER_V3.

> 
> --
> 
> Thanks,
> Peter Chen


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep
  2021-05-17 15:05 [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep Sanket Parmar
  2021-05-22 10:09 ` Peter Chen
@ 2021-05-26 15:00 ` Aswath Govindraju
  2021-05-27  1:23   ` Peter Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Aswath Govindraju @ 2021-05-26 15:00 UTC (permalink / raw)
  To: Sanket Parmar, peter.chen
  Cc: pawell, linux-usb, linux-kernel, kurahul, gregkh, kishon

Hi Peter,

On 17/05/21 8:35 pm, Sanket Parmar wrote:
> ZLP gets stuck if TDL_CHK bit is set and TDL_FROM_TRB is used
> as TDL source for IN endpoints. To fix it, TDL_CHK is only
> enabled for OUT endpoints.
> 
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Reported-by: Aswath Govindraju <a-govindraju@ti.com>
> Signed-off-by: Sanket Parmar <sparmar@cadence.com>
> ---

May I know if this patch will be picked up as a bug fix for -rc.

Thanks,
Aswath

>  drivers/usb/cdns3/cdns3-gadget.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 105855a..f3c0276 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
>  		else
>  			mask = BIT(priv_ep->num);
>  
> -		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) {
> +		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
>  			cdns3_set_register_bit(&regs->tdl_from_trb, mask);
>  			cdns3_set_register_bit(&regs->tdl_beh, mask);
>  			cdns3_set_register_bit(&regs->tdl_beh2, mask);
> @@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable)
>  	case USB_ENDPOINT_XFER_INT:
>  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT);
>  
> -		if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
> -		    priv_dev->dev_ver > DEV_VER_V2)
> +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
>  			ep_cfg |= EP_CFG_TDL_CHK;
>  		break;
>  	case USB_ENDPOINT_XFER_BULK:
>  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK);
>  
> -		if ((priv_dev->dev_ver == DEV_VER_V2  && !priv_ep->dir) ||
> -		    priv_dev->dev_ver > DEV_VER_V2)
> +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
>  			ep_cfg |= EP_CFG_TDL_CHK;
>  		break;
>  	default:
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep
  2021-05-26 15:00 ` Aswath Govindraju
@ 2021-05-27  1:23   ` Peter Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Chen @ 2021-05-27  1:23 UTC (permalink / raw)
  To: Aswath Govindraju
  Cc: Sanket Parmar, pawell, linux-usb, linux-kernel, kurahul, gregkh, kishon

On 21-05-26 20:30:37, Aswath Govindraju wrote:
> Hi Peter,
> 
> On 17/05/21 8:35 pm, Sanket Parmar wrote:
> > ZLP gets stuck if TDL_CHK bit is set and TDL_FROM_TRB is used
> > as TDL source for IN endpoints. To fix it, TDL_CHK is only
> > enabled for OUT endpoints.
> > 
> > Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> > Reported-by: Aswath Govindraju <a-govindraju@ti.com>
> > Signed-off-by: Sanket Parmar <sparmar@cadence.com>
> > ---
> 
> May I know if this patch will be picked up as a bug fix for -rc.

Yes, it has already at my fixes tree, to make sure no one report issues,
I will send to Greg after several days later.

Peter
> 
> Thanks,
> Aswath
> 
> >  drivers/usb/cdns3/cdns3-gadget.c |    8 +++-----
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> > index 105855a..f3c0276 100644
> > --- a/drivers/usb/cdns3/cdns3-gadget.c
> > +++ b/drivers/usb/cdns3/cdns3-gadget.c
> > @@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
> >  		else
> >  			mask = BIT(priv_ep->num);
> >  
> > -		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) {
> > +		if (priv_ep->type != USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
> >  			cdns3_set_register_bit(&regs->tdl_from_trb, mask);
> >  			cdns3_set_register_bit(&regs->tdl_beh, mask);
> >  			cdns3_set_register_bit(&regs->tdl_beh2, mask);
> > @@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable)
> >  	case USB_ENDPOINT_XFER_INT:
> >  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT);
> >  
> > -		if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
> > -		    priv_dev->dev_ver > DEV_VER_V2)
> > +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
> >  			ep_cfg |= EP_CFG_TDL_CHK;
> >  		break;
> >  	case USB_ENDPOINT_XFER_BULK:
> >  		ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK);
> >  
> > -		if ((priv_dev->dev_ver == DEV_VER_V2  && !priv_ep->dir) ||
> > -		    priv_dev->dev_ver > DEV_VER_V2)
> > +		if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
> >  			ep_cfg |= EP_CFG_TDL_CHK;
> >  		break;
> >  	default:
> > 
> 

-- 

Thanks,
Peter Chen


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-27  1:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 15:05 [PATCH] usb: cdns3: Enable TDL_CHK only for OUT ep Sanket Parmar
2021-05-22 10:09 ` Peter Chen
2021-05-24  5:39   ` Sanket Parmar
2021-05-26 15:00 ` Aswath Govindraju
2021-05-27  1:23   ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).