* [PATCH] usb: gadget: aspeed_udc: fix device address configuration
@ 2024-06-12 2:07 Jeremy Kerr
2024-06-12 4:06 ` Andrew Jeffery
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jeremy Kerr @ 2024-06-12 2:07 UTC (permalink / raw)
To: Neal Liu, Greg Kroah-Hartman, Joel Stanley, Andrew Jeffery
Cc: linux-aspeed, linux-usb
In the aspeed UDC setup, we configure the UDC hardware with the assigned
USB device address.
However, we have an off-by-one in the bitmask, so we're only setting the
lower 6 bits of the address (USB addresses being 7 bits, and the
hardware bitmask being bits 0:6).
This means that device enumeration fails if the assigned address is
greater than 64:
[ 344.607255] usb 1-1: new high-speed USB device number 63 using ehci-platform
[ 344.808459] usb 1-1: New USB device found, idVendor=cc00, idProduct=cc00, bcdDevice= 6.10
[ 344.817684] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 344.825671] usb 1-1: Product: Test device
[ 344.831075] usb 1-1: Manufacturer: Test vendor
[ 344.836335] usb 1-1: SerialNumber: 00
[ 349.917181] usb 1-1: USB disconnect, device number 63
[ 352.036775] usb 1-1: new high-speed USB device number 64 using ehci-platform
[ 352.249432] usb 1-1: device descriptor read/all, error -71
[ 352.696740] usb 1-1: new high-speed USB device number 65 using ehci-platform
[ 352.909431] usb 1-1: device descriptor read/all, error -71
Use the correct mask of 0x7f (rather than 0x3f), and generate this
through the GENMASK macro, so we have numbers that correspond exactly
to the hardware register definition.
Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
drivers/usb/gadget/udc/aspeed_udc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 3916c8e2ba01..821a6ab5da56 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -66,8 +66,8 @@
#define USB_UPSTREAM_EN BIT(0)
/* Main config reg */
-#define UDC_CFG_SET_ADDR(x) ((x) & 0x3f)
-#define UDC_CFG_ADDR_MASK (0x3f)
+#define UDC_CFG_SET_ADDR(x) ((x) & UDC_CFG_ADDR_MASK)
+#define UDC_CFG_ADDR_MASK GENMASK(6, 0)
/* Interrupt ctrl & status reg */
#define UDC_IRQ_EP_POOL_NAK BIT(17)
---
base-commit: 32f88d65f01bf6f45476d7edbe675e44fb9e1d58
change-id: 20240611-aspeed-udc-07dcde062ccf
Best regards,
--
Jeremy Kerr <jk@codeconstruct.com.au>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
2024-06-12 2:07 [PATCH] usb: gadget: aspeed_udc: fix device address configuration Jeremy Kerr
@ 2024-06-12 4:06 ` Andrew Jeffery
2024-06-12 5:35 ` Neal Liu
2024-06-12 5:48 ` Ryan Chen
2024-06-12 7:59 ` Greg Kroah-Hartman
2 siblings, 1 reply; 7+ messages in thread
From: Andrew Jeffery @ 2024-06-12 4:06 UTC (permalink / raw)
To: Jeremy Kerr, Neal Liu, Greg Kroah-Hartman, Joel Stanley
Cc: linux-aspeed, linux-usb
On Wed, 2024-06-12 at 10:07 +0800, Jeremy Kerr wrote:
> In the aspeed UDC setup, we configure the UDC hardware with the assigned
> USB device address.
>
> However, we have an off-by-one in the bitmask, so we're only setting the
> lower 6 bits of the address (USB addresses being 7 bits, and the
> hardware bitmask being bits 0:6).
>
> This means that device enumeration fails if the assigned address is
> greater than 64:
>
> [ 344.607255] usb 1-1: new high-speed USB device number 63 using ehci-platform
> [ 344.808459] usb 1-1: New USB device found, idVendor=cc00, idProduct=cc00, bcdDevice= 6.10
> [ 344.817684] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [ 344.825671] usb 1-1: Product: Test device
> [ 344.831075] usb 1-1: Manufacturer: Test vendor
> [ 344.836335] usb 1-1: SerialNumber: 00
> [ 349.917181] usb 1-1: USB disconnect, device number 63
> [ 352.036775] usb 1-1: new high-speed USB device number 64 using ehci-platform
> [ 352.249432] usb 1-1: device descriptor read/all, error -71
> [ 352.696740] usb 1-1: new high-speed USB device number 65 using ehci-platform
> [ 352.909431] usb 1-1: device descriptor read/all, error -71
>
> Use the correct mask of 0x7f (rather than 0x3f), and generate this
> through the GENMASK macro, so we have numbers that correspond exactly
> to the hardware register definition.
>
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
2024-06-12 4:06 ` Andrew Jeffery
@ 2024-06-12 5:35 ` Neal Liu
0 siblings, 0 replies; 7+ messages in thread
From: Neal Liu @ 2024-06-12 5:35 UTC (permalink / raw)
To: Andrew Jeffery, Jeremy Kerr, Greg Kroah-Hartman, Joel Stanley
Cc: linux-aspeed@lists.ozlabs.org, linux-usb@vger.kernel.org
> > In the aspeed UDC setup, we configure the UDC hardware with the
> > assigned USB device address.
> >
> > However, we have an off-by-one in the bitmask, so we're only setting
> > the lower 6 bits of the address (USB addresses being 7 bits, and the
> > hardware bitmask being bits 0:6).
> >
> > This means that device enumeration fails if the assigned address is
> > greater than 64:
> >
> > [ 344.607255] usb 1-1: new high-speed USB device number 63 using
> > ehci-platform [ 344.808459] usb 1-1: New USB device found,
> > idVendor=cc00, idProduct=cc00, bcdDevice= 6.10 [ 344.817684] usb 1-1:
> > New USB device strings: Mfr=1, Product=2, SerialNumber=3 [
> > 344.825671] usb 1-1: Product: Test device [ 344.831075] usb 1-1:
> > Manufacturer: Test vendor [ 344.836335] usb 1-1: SerialNumber: 00 [
> > 349.917181] usb 1-1: USB disconnect, device number 63 [ 352.036775]
> > usb 1-1: new high-speed USB device number 64 using ehci-platform [
> > 352.249432] usb 1-1: device descriptor read/all, error -71 [
> > 352.696740] usb 1-1: new high-speed USB device number 65 using
> > ehci-platform [ 352.909431] usb 1-1: device descriptor read/all,
> > error -71
> >
> > Use the correct mask of 0x7f (rather than 0x3f), and generate this
> > through the GENMASK macro, so we have numbers that correspond exactly
> > to the hardware register definition.
> >
> > Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> > Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
>
> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Reviewed-by: Neal Liu <neal_liu@aspeedtech.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
2024-06-12 2:07 [PATCH] usb: gadget: aspeed_udc: fix device address configuration Jeremy Kerr
2024-06-12 4:06 ` Andrew Jeffery
@ 2024-06-12 5:48 ` Ryan Chen
2024-06-12 6:23 ` Jeremy Kerr
2024-06-12 7:59 ` Greg Kroah-Hartman
2 siblings, 1 reply; 7+ messages in thread
From: Ryan Chen @ 2024-06-12 5:48 UTC (permalink / raw)
To: Jeremy Kerr, Neal Liu, Greg Kroah-Hartman, Joel Stanley,
Andrew Jeffery
Cc: linux-usb@vger.kernel.org, linux-aspeed@lists.ozlabs.org
> -----Original Message-----
> From: Linux-aspeed
> <linux-aspeed-bounces+ryan_chen=aspeedtech.com@lists.ozlabs.org> On
> Behalf Of Jeremy Kerr
> Sent: Wednesday, June 12, 2024 10:08 AM
> To: Neal Liu <neal_liu@aspeedtech.com>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Joel Stanley <joel@jms.id.au>; Andrew Jeffery
> <andrew@codeconstruct.com.au>
> Cc: linux-usb@vger.kernel.org; linux-aspeed@lists.ozlabs.org
> Subject: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
>
> In the aspeed UDC setup, we configure the UDC hardware with the assigned
> USB device address.
>
> However, we have an off-by-one in the bitmask, so we're only setting the
> lower 6 bits of the address (USB addresses being 7 bits, and the hardware
> bitmask being bits 0:6).
>
> This means that device enumeration fails if the assigned address is greater
> than 64:
>
> [ 344.607255] usb 1-1: new high-speed USB device number 63 using
> ehci-platform [ 344.808459] usb 1-1: New USB device found, idVendor=cc00,
> idProduct=cc00, bcdDevice= 6.10 [ 344.817684] usb 1-1: New USB device
> strings: Mfr=1, Product=2, SerialNumber=3 [ 344.825671] usb 1-1: Product:
> Test device [ 344.831075] usb 1-1: Manufacturer: Test vendor
> [ 344.836335] usb 1-1: SerialNumber: 00 [ 349.917181] usb 1-1: USB
> disconnect, device number 63 [ 352.036775] usb 1-1: new high-speed USB
> device number 64 using ehci-platform [ 352.249432] usb 1-1: device
> descriptor read/all, error -71 [ 352.696740] usb 1-1: new high-speed USB
> device number 65 using ehci-platform [ 352.909431] usb 1-1: device
> descriptor read/all, error -71
>
> Use the correct mask of 0x7f (rather than 0x3f), and generate this through the
> GENMASK macro, so we have numbers that correspond exactly to the
> hardware register definition.
>
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
> ---
> drivers/usb/gadget/udc/aspeed_udc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c
> b/drivers/usb/gadget/udc/aspeed_udc.c
> index 3916c8e2ba01..821a6ab5da56 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -66,8 +66,8 @@
> #define USB_UPSTREAM_EN BIT(0)
>
> /* Main config reg */
> -#define UDC_CFG_SET_ADDR(x) ((x) & 0x3f)
> -#define UDC_CFG_ADDR_MASK (0x3f)
> +#define UDC_CFG_SET_ADDR(x) ((x) & UDC_CFG_ADDR_MASK)
> +#define UDC_CFG_ADDR_MASK GENMASK(6, 0)
>
It should be GENMASK(5,0), not GENMASK(6, 0), am I right?
Ryan
> /* Interrupt ctrl & status reg */
> #define UDC_IRQ_EP_POOL_NAK BIT(17)
>
> ---
> base-commit: 32f88d65f01bf6f45476d7edbe675e44fb9e1d58
> change-id: 20240611-aspeed-udc-07dcde062ccf
>
> Best regards,
> --
> Jeremy Kerr <jk@codeconstruct.com.au>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
2024-06-12 5:48 ` Ryan Chen
@ 2024-06-12 6:23 ` Jeremy Kerr
2024-06-12 6:33 ` Ryan Chen
0 siblings, 1 reply; 7+ messages in thread
From: Jeremy Kerr @ 2024-06-12 6:23 UTC (permalink / raw)
To: Ryan Chen, Neal Liu, Greg Kroah-Hartman, Joel Stanley,
Andrew Jeffery
Cc: linux-usb@vger.kernel.org, linux-aspeed@lists.ozlabs.org
Hi Ryan,
> > /* Main config reg */
> > -#define UDC_CFG_SET_ADDR(x) ((x) & 0x3f)
> > -#define UDC_CFG_ADDR_MASK (0x3f)
> > +#define UDC_CFG_SET_ADDR(x) ((x) & UDC_CFG_ADDR_MASK)
> > +#define UDC_CFG_ADDR_MASK GENMASK(6, 0)
> >
>
> It should be GENMASK(5,0), not GENMASK(6, 0), am I right?
No, that was the bug: we need bits 0:6 (== 0x7f) here.
With the mask of 0:5 (== 0x3f), we don't get the full USB address set.
Cheers,
Jeremy
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
2024-06-12 6:23 ` Jeremy Kerr
@ 2024-06-12 6:33 ` Ryan Chen
0 siblings, 0 replies; 7+ messages in thread
From: Ryan Chen @ 2024-06-12 6:33 UTC (permalink / raw)
To: Jeremy Kerr, Neal Liu, Greg Kroah-Hartman, Joel Stanley,
Andrew Jeffery
Cc: linux-usb@vger.kernel.org, linux-aspeed@lists.ozlabs.org
> -----Original Message-----
> From: Jeremy Kerr <jk@codeconstruct.com.au>
> Sent: Wednesday, June 12, 2024 2:24 PM
> To: Ryan Chen <ryan_chen@aspeedtech.com>; Neal Liu
> <neal_liu@aspeedtech.com>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Joel Stanley <joel@jms.id.au>; Andrew Jeffery
> <andrew@codeconstruct.com.au>
> Cc: linux-usb@vger.kernel.org; linux-aspeed@lists.ozlabs.org
> Subject: Re: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
>
> Hi Ryan,
>
> > > /* Main config reg */
> > > -#define UDC_CFG_SET_ADDR(x) ((x) & 0x3f) -#define
> > > UDC_CFG_ADDR_MASK (0x3f)
> > > +#define UDC_CFG_SET_ADDR(x) ((x) &
> UDC_CFG_ADDR_MASK)
> > > +#define UDC_CFG_ADDR_MASK GENMASK(6, 0)
> > >
> >
> > It should be GENMASK(5,0), not GENMASK(6, 0), am I right?
>
> No, that was the bug: we need bits 0:6 (== 0x7f) here.
>
> With the mask of 0:5 (== 0x3f), we don't get the full USB address set.
>
> Cheers,
>
>
> Jeremy
Yes, thanks, after review the datasheet, it should be 0:6.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget: aspeed_udc: fix device address configuration
2024-06-12 2:07 [PATCH] usb: gadget: aspeed_udc: fix device address configuration Jeremy Kerr
2024-06-12 4:06 ` Andrew Jeffery
2024-06-12 5:48 ` Ryan Chen
@ 2024-06-12 7:59 ` Greg Kroah-Hartman
2 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2024-06-12 7:59 UTC (permalink / raw)
To: Jeremy Kerr
Cc: Neal Liu, Joel Stanley, Andrew Jeffery, linux-aspeed, linux-usb
On Wed, Jun 12, 2024 at 10:07:33AM +0800, Jeremy Kerr wrote:
> In the aspeed UDC setup, we configure the UDC hardware with the assigned
> USB device address.
>
> However, we have an off-by-one in the bitmask, so we're only setting the
> lower 6 bits of the address (USB addresses being 7 bits, and the
> hardware bitmask being bits 0:6).
>
> This means that device enumeration fails if the assigned address is
> greater than 64:
>
> [ 344.607255] usb 1-1: new high-speed USB device number 63 using ehci-platform
> [ 344.808459] usb 1-1: New USB device found, idVendor=cc00, idProduct=cc00, bcdDevice= 6.10
> [ 344.817684] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [ 344.825671] usb 1-1: Product: Test device
> [ 344.831075] usb 1-1: Manufacturer: Test vendor
> [ 344.836335] usb 1-1: SerialNumber: 00
> [ 349.917181] usb 1-1: USB disconnect, device number 63
> [ 352.036775] usb 1-1: new high-speed USB device number 64 using ehci-platform
> [ 352.249432] usb 1-1: device descriptor read/all, error -71
> [ 352.696740] usb 1-1: new high-speed USB device number 65 using ehci-platform
> [ 352.909431] usb 1-1: device descriptor read/all, error -71
>
> Use the correct mask of 0x7f (rather than 0x3f), and generate this
> through the GENMASK macro, so we have numbers that correspond exactly
> to the hardware register definition.
>
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
> ---
> drivers/usb/gadget/udc/aspeed_udc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
> index 3916c8e2ba01..821a6ab5da56 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -66,8 +66,8 @@
> #define USB_UPSTREAM_EN BIT(0)
>
> /* Main config reg */
> -#define UDC_CFG_SET_ADDR(x) ((x) & 0x3f)
> -#define UDC_CFG_ADDR_MASK (0x3f)
> +#define UDC_CFG_SET_ADDR(x) ((x) & UDC_CFG_ADDR_MASK)
> +#define UDC_CFG_ADDR_MASK GENMASK(6, 0)
>
> /* Interrupt ctrl & status reg */
> #define UDC_IRQ_EP_POOL_NAK BIT(17)
>
> ---
> base-commit: 32f88d65f01bf6f45476d7edbe675e44fb9e1d58
> change-id: 20240611-aspeed-udc-07dcde062ccf
>
> Best regards,
> --
> Jeremy Kerr <jk@codeconstruct.com.au>
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-06-12 7:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 2:07 [PATCH] usb: gadget: aspeed_udc: fix device address configuration Jeremy Kerr
2024-06-12 4:06 ` Andrew Jeffery
2024-06-12 5:35 ` Neal Liu
2024-06-12 5:48 ` Ryan Chen
2024-06-12 6:23 ` Jeremy Kerr
2024-06-12 6:33 ` Ryan Chen
2024-06-12 7:59 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox