diff mbox series

[3/6] usb: cdnsp: fix the wrong mult value for HS isoc or intr

Message ID 1628739182-30089-3-git-send-email-chunfeng.yun@mediatek.com
State Not Applicable
Headers show
Series [1/6] usb: mtu3: restore HS function when set SS/SSP | expand

Commit Message

Chunfeng Yun (云春峰) Aug. 12, 2021, 3:32 a.m. UTC
usb_endpoint_maxp() only returns the bit[10:0] of wMaxPacketSize
of endpoint descriptor, not include bit[12:11] anymore, so use
usb_endpoint_maxp_mult() instead.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/cdns3/cdnsp-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felipe Balbi Aug. 12, 2021, 6:51 a.m. UTC | #1
Chunfeng Yun <chunfeng.yun@mediatek.com> writes:

> usb_endpoint_maxp() only returns the bit[10:0] of wMaxPacketSize
> of endpoint descriptor, not include bit[12:11] anymore, so use
> usb_endpoint_maxp_mult() instead.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/cdns3/cdnsp-mem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
> index a47948a1623f..ad9aee3f1e39 100644
> --- a/drivers/usb/cdns3/cdnsp-mem.c
> +++ b/drivers/usb/cdns3/cdnsp-mem.c
> @@ -882,7 +882,7 @@ static u32 cdnsp_get_endpoint_max_burst(struct usb_gadget *g,
>  	if (g->speed == USB_SPEED_HIGH &&
>  	    (usb_endpoint_xfer_isoc(pep->endpoint.desc) ||
>  	     usb_endpoint_xfer_int(pep->endpoint.desc)))
> -		return (usb_endpoint_maxp(pep->endpoint.desc) & 0x1800) >> 11;
> +		return usb_endpoint_maxp_mult(pep->endpoint.desc) - 1;

this looks like a bugfix. Do we need to Cc stable here?

In any case:

Acked-by: Felipe Balbi <balbi@kernel.org>
Chunfeng Yun (云春峰) Aug. 12, 2021, 11:53 a.m. UTC | #2
On Thu, 2021-08-12 at 09:51 +0300, Felipe Balbi wrote:
> Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> 
> > usb_endpoint_maxp() only returns the bit[10:0] of wMaxPacketSize
> > of endpoint descriptor, not include bit[12:11] anymore, so use
> > usb_endpoint_maxp_mult() instead.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  drivers/usb/cdns3/cdnsp-mem.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/cdns3/cdnsp-mem.c
> > b/drivers/usb/cdns3/cdnsp-mem.c
> > index a47948a1623f..ad9aee3f1e39 100644
> > --- a/drivers/usb/cdns3/cdnsp-mem.c
> > +++ b/drivers/usb/cdns3/cdnsp-mem.c
> > @@ -882,7 +882,7 @@ static u32 cdnsp_get_endpoint_max_burst(struct
> > usb_gadget *g,
> >  	if (g->speed == USB_SPEED_HIGH &&
> >  	    (usb_endpoint_xfer_isoc(pep->endpoint.desc) ||
> >  	     usb_endpoint_xfer_int(pep->endpoint.desc)))
> > -		return (usb_endpoint_maxp(pep->endpoint.desc) & 0x1800)
> > >> 11;
> > +		return usb_endpoint_maxp_mult(pep->endpoint.desc) - 1;
> 
> this looks like a bugfix. Do we need to Cc stable here?
It's better to Cc stable, will do it, thanks

> 
> In any case:
> 
> Acked-by: Felipe Balbi <balbi@kernel.org>
>
Pawel Laszczak Aug. 17, 2021, 5:05 a.m. UTC | #3
>
>Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
>
>> usb_endpoint_maxp() only returns the bit[10:0] of wMaxPacketSize
>> of endpoint descriptor, not include bit[12:11] anymore, so use
>> usb_endpoint_maxp_mult() instead.
>>
>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>> ---
>>  drivers/usb/cdns3/cdnsp-mem.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
>> index a47948a1623f..ad9aee3f1e39 100644
>> --- a/drivers/usb/cdns3/cdnsp-mem.c
>> +++ b/drivers/usb/cdns3/cdnsp-mem.c
>> @@ -882,7 +882,7 @@ static u32 cdnsp_get_endpoint_max_burst(struct usb_gadget *g,
>>  	if (g->speed == USB_SPEED_HIGH &&
>>  	    (usb_endpoint_xfer_isoc(pep->endpoint.desc) ||
>>  	     usb_endpoint_xfer_int(pep->endpoint.desc)))
>> -		return (usb_endpoint_maxp(pep->endpoint.desc) & 0x1800) >> 11;
>> +		return usb_endpoint_maxp_mult(pep->endpoint.desc) - 1;
>
>this looks like a bugfix. Do we need to Cc stable here?
>
>In any case:
>
>Acked-by: Felipe Balbi <balbi@kernel.org>
>

It's not a bugfix. The result is the same.

Acked-by: Pawel Laszczak <pawell@cadence.com>

--

Thanks 
Pawel Laszczak
Chunfeng Yun (云春峰) Aug. 17, 2021, 7:10 a.m. UTC | #4
On Tue, 2021-08-17 at 05:05 +0000, Pawel Laszczak wrote:
> > 
> > Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> > 
> > > usb_endpoint_maxp() only returns the bit[10:0] of wMaxPacketSize
> > > of endpoint descriptor, not include bit[12:11] anymore, so use
> > > usb_endpoint_maxp_mult() instead.
> > > 
> > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > ---
> > >  drivers/usb/cdns3/cdnsp-mem.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/cdns3/cdnsp-mem.c
> > > b/drivers/usb/cdns3/cdnsp-mem.c
> > > index a47948a1623f..ad9aee3f1e39 100644
> > > --- a/drivers/usb/cdns3/cdnsp-mem.c
> > > +++ b/drivers/usb/cdns3/cdnsp-mem.c
> > > @@ -882,7 +882,7 @@ static u32
> > > cdnsp_get_endpoint_max_burst(struct usb_gadget *g,
> > >  	if (g->speed == USB_SPEED_HIGH &&
> > >  	    (usb_endpoint_xfer_isoc(pep->endpoint.desc) ||
> > >  	     usb_endpoint_xfer_int(pep->endpoint.desc)))
> > > -		return (usb_endpoint_maxp(pep->endpoint.desc) & 0x1800)
> > > >> 11;
> > > +		return usb_endpoint_maxp_mult(pep->endpoint.desc) - 1;
> > 
> > this looks like a bugfix. Do we need to Cc stable here?
> > 
> > In any case:
> > 
> > Acked-by: Felipe Balbi <balbi@kernel.org>
> > 
> 
> It's not a bugfix. The result is the same.

"(usb_endpoint_maxp(pep->endpoint.desc) & 0x1800) >> 11" is always zero
now!
but not for "usb_endpoint_maxp_mult(pep->endpoint.desc) - 1".

> 
> Acked-by: Pawel Laszczak <pawell@cadence.com>
> 
> --
> 
> Thanks 
> Pawel Laszczak
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index a47948a1623f..ad9aee3f1e39 100644
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -882,7 +882,7 @@  static u32 cdnsp_get_endpoint_max_burst(struct usb_gadget *g,
 	if (g->speed == USB_SPEED_HIGH &&
 	    (usb_endpoint_xfer_isoc(pep->endpoint.desc) ||
 	     usb_endpoint_xfer_int(pep->endpoint.desc)))
-		return (usb_endpoint_maxp(pep->endpoint.desc) & 0x1800) >> 11;
+		return usb_endpoint_maxp_mult(pep->endpoint.desc) - 1;
 
 	return 0;
 }