diff mbox series

[7/8] usb: cdns3: gadget: sg_support is only for DEV_VER_V2 or above

Message ID 20200901084454.28649-8-peter.chen@nxp.com (mailing list archive)
State Superseded
Headers show
Series usb: cdns3: improve the sg use case | expand

Commit Message

Peter Chen Sept. 1, 2020, 8:44 a.m. UTC
The scatter buffer list support earlier than DEV_VER_V2 is not
good enough, software can't know well about short transfer for it.

Cc: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/cdns3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Felipe Balbi Sept. 8, 2020, 6:30 a.m. UTC | #1
Peter Chen <peter.chen@nxp.com> writes:

> The scatter buffer list support earlier than DEV_VER_V2 is not
> good enough, software can't know well about short transfer for it.
>
> Cc: Pawel Laszczak <pawell@cadence.com>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>  drivers/usb/cdns3/gadget.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> index 1fd36bc5c6db..82dc362550bf 100644
> --- a/drivers/usb/cdns3/gadget.c
> +++ b/drivers/usb/cdns3/gadget.c
> @@ -3161,7 +3161,6 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
>  	priv_dev->gadget.speed = USB_SPEED_UNKNOWN;
>  	priv_dev->gadget.ops = &cdns3_gadget_ops;
>  	priv_dev->gadget.name = "usb-ss-gadget";
> -	priv_dev->gadget.sg_supported = 1;
>  	priv_dev->gadget.quirk_avoids_skb_reserve = 1;
>  	priv_dev->gadget.irq = cdns->dev_irq;
>  
> @@ -3200,6 +3199,8 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
>  		readl(&priv_dev->regs->usb_cap2));
>  
>  	priv_dev->dev_ver = GET_DEV_BASE_VERSION(priv_dev->dev_ver);
> +	if (priv_dev->dev_ver >= DEV_VER_V2)
> +		priv_dev->gadget.sg_supported = 1;

is this a bug fix?
Peter Chen Sept. 8, 2020, 9:08 a.m. UTC | #2
On 20-09-08 09:30:59, Felipe Balbi wrote:
> Peter Chen <peter.chen@nxp.com> writes:
> 
> > The scatter buffer list support earlier than DEV_VER_V2 is not
> > good enough, software can't know well about short transfer for it.
> >
> > Cc: Pawel Laszczak <pawell@cadence.com>
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> >  drivers/usb/cdns3/gadget.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> > index 1fd36bc5c6db..82dc362550bf 100644
> > --- a/drivers/usb/cdns3/gadget.c
> > +++ b/drivers/usb/cdns3/gadget.c
> > @@ -3161,7 +3161,6 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
> >  	priv_dev->gadget.speed = USB_SPEED_UNKNOWN;
> >  	priv_dev->gadget.ops = &cdns3_gadget_ops;
> >  	priv_dev->gadget.name = "usb-ss-gadget";
> > -	priv_dev->gadget.sg_supported = 1;
> >  	priv_dev->gadget.quirk_avoids_skb_reserve = 1;
> >  	priv_dev->gadget.irq = cdns->dev_irq;
> >  
> > @@ -3200,6 +3199,8 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
> >  		readl(&priv_dev->regs->usb_cap2));
> >  
> >  	priv_dev->dev_ver = GET_DEV_BASE_VERSION(priv_dev->dev_ver);
> > +	if (priv_dev->dev_ver >= DEV_VER_V2)
> > +		priv_dev->gadget.sg_supported = 1;
> 
> is this a bug fix?
> 

Like answered at Patch 4, it is better to keep the whole patch series as
the improvement for sg use case.
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 1fd36bc5c6db..82dc362550bf 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -3161,7 +3161,6 @@  static int cdns3_gadget_start(struct cdns3 *cdns)
 	priv_dev->gadget.speed = USB_SPEED_UNKNOWN;
 	priv_dev->gadget.ops = &cdns3_gadget_ops;
 	priv_dev->gadget.name = "usb-ss-gadget";
-	priv_dev->gadget.sg_supported = 1;
 	priv_dev->gadget.quirk_avoids_skb_reserve = 1;
 	priv_dev->gadget.irq = cdns->dev_irq;
 
@@ -3200,6 +3199,8 @@  static int cdns3_gadget_start(struct cdns3 *cdns)
 		readl(&priv_dev->regs->usb_cap2));
 
 	priv_dev->dev_ver = GET_DEV_BASE_VERSION(priv_dev->dev_ver);
+	if (priv_dev->dev_ver >= DEV_VER_V2)
+		priv_dev->gadget.sg_supported = 1;
 
 	priv_dev->zlp_buf = kzalloc(CDNS3_EP_ZLP_BUF_SIZE, GFP_KERNEL);
 	if (!priv_dev->zlp_buf) {