All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1 0/2] Fix USB port indexes for USB gadget commands
@ 2018-12-15 16:43 Jean-Jacques Hiblot
  2018-12-15 16:43 ` [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports Jean-Jacques Hiblot
  2018-12-15 16:43 ` [U-Boot] [PATCH v1 2/2] ARM: dts: define USB aliases for all omap5 platforms Jean-Jacques Hiblot
  0 siblings, 2 replies; 6+ messages in thread
From: Jean-Jacques Hiblot @ 2018-12-15 16:43 UTC (permalink / raw)
  To: u-boot


The USB gadget commands take the USB port index as a parameter.
This is not playing well with the current DM support for gadget when USB0
is dedicated to host and USB1 dedicated to gadget.
This problem has been reported by Sam Protsenko <semen.protsenko@linaro.org>

This patch fixes this by using the aliases provided by the DT to get the port
index right.

Tested on:
- dra76 evm
- am572 evm



Jean-Jacques Hiblot (2):
  dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports
  ARM: dts: define USB aliases for all omap5 platforms

 arch/arm/dts/omap5-u-boot.dtsi      | 5 +++++
 drivers/usb/gadget/udc/udc-uclass.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.7.4

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

* [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports
  2018-12-15 16:43 [U-Boot] [PATCH v1 0/2] Fix USB port indexes for USB gadget commands Jean-Jacques Hiblot
@ 2018-12-15 16:43 ` Jean-Jacques Hiblot
  2018-12-15 18:36   ` Marek Vasut
  2018-12-15 16:43 ` [U-Boot] [PATCH v1 2/2] ARM: dts: define USB aliases for all omap5 platforms Jean-Jacques Hiblot
  1 sibling, 1 reply; 6+ messages in thread
From: Jean-Jacques Hiblot @ 2018-12-15 16:43 UTC (permalink / raw)
  To: u-boot

dfu, fastbot and other usb gadget commands take the USB port index as a
parameter. Currently this index is assigned in the order of the driver
bindings.
Changing this behavior using the SEQ_ALIAS feature. This option assign to
the device a SEQ number based on its alias (if it exists)

To use it we must set the DM_UC_FLAG_SEQ_ALIAS flag and follow the existing
naming convention: use "usb" for the name of the gadget UCLASS_DRIVER
(same as for the UCLASS_USB).

If no alias is provided, then the index falls back to the order in which
the bindings took place.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reported-by: Sam Protsenko <semen.protsenko@linaro.org>
---

 drivers/usb/gadget/udc/udc-uclass.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c
index 0620518..e9f8f5f 100644
--- a/drivers/usb/gadget/udc/udc-uclass.c
+++ b/drivers/usb/gadget/udc/udc-uclass.c
@@ -20,7 +20,7 @@ int usb_gadget_initialize(int index)
 		return -EINVAL;
 	if (dev_array[index])
 		return 0;
-	ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev);
+	ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev);
 	if (!dev || ret) {
 		pr_err("No USB device found\n");
 		return -ENODEV;
@@ -54,5 +54,6 @@ int usb_gadget_handle_interrupts(int index)
 
 UCLASS_DRIVER(usb_gadget_generic) = {
 	.id		= UCLASS_USB_GADGET_GENERIC,
-	.name		= "usb_gadget_generic",
+	.name		= "usb",
+	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 };
-- 
2.7.4

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

* [U-Boot] [PATCH v1 2/2] ARM: dts: define USB aliases for all omap5 platforms
  2018-12-15 16:43 [U-Boot] [PATCH v1 0/2] Fix USB port indexes for USB gadget commands Jean-Jacques Hiblot
  2018-12-15 16:43 ` [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports Jean-Jacques Hiblot
@ 2018-12-15 16:43 ` Jean-Jacques Hiblot
  1 sibling, 0 replies; 6+ messages in thread
From: Jean-Jacques Hiblot @ 2018-12-15 16:43 UTC (permalink / raw)
  To: u-boot

This allows us to properly map the USB controller indexes

Tested on dra76 evm, am572 evm

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

---

 arch/arm/dts/omap5-u-boot.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/omap5-u-boot.dtsi b/arch/arm/dts/omap5-u-boot.dtsi
index 1eb50cd..54a7285 100644
--- a/arch/arm/dts/omap5-u-boot.dtsi
+++ b/arch/arm/dts/omap5-u-boot.dtsi
@@ -12,6 +12,11 @@
 		tick-timer = &timer2;
 	};
 
+	aliases {
+		usb0 = &usb1;
+		usb1 = &usb2;
+	};
+
 	ocp {
 		u-boot,dm-spl;
 
-- 
2.7.4

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

* [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports
  2018-12-15 16:43 ` [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports Jean-Jacques Hiblot
@ 2018-12-15 18:36   ` Marek Vasut
  2018-12-16 20:47     ` Lukasz Majewski
  0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2018-12-15 18:36 UTC (permalink / raw)
  To: u-boot

On 12/15/2018 05:43 PM, Jean-Jacques Hiblot wrote:
> dfu, fastbot and other usb gadget commands take the USB port index as a

fastboot.

Looks good to me, I expect Lukasz to pick it, test it and send me a PR.

> parameter. Currently this index is assigned in the order of the driver
> bindings.
> Changing this behavior using the SEQ_ALIAS feature. This option assign to
> the device a SEQ number based on its alias (if it exists)
> 
> To use it we must set the DM_UC_FLAG_SEQ_ALIAS flag and follow the existing
> naming convention: use "usb" for the name of the gadget UCLASS_DRIVER
> (same as for the UCLASS_USB).
> 
> If no alias is provided, then the index falls back to the order in which
> the bindings took place.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Reported-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
> 
>  drivers/usb/gadget/udc/udc-uclass.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c
> index 0620518..e9f8f5f 100644
> --- a/drivers/usb/gadget/udc/udc-uclass.c
> +++ b/drivers/usb/gadget/udc/udc-uclass.c
> @@ -20,7 +20,7 @@ int usb_gadget_initialize(int index)
>  		return -EINVAL;
>  	if (dev_array[index])
>  		return 0;
> -	ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev);
> +	ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev);
>  	if (!dev || ret) {
>  		pr_err("No USB device found\n");
>  		return -ENODEV;
> @@ -54,5 +54,6 @@ int usb_gadget_handle_interrupts(int index)
>  
>  UCLASS_DRIVER(usb_gadget_generic) = {
>  	.id		= UCLASS_USB_GADGET_GENERIC,
> -	.name		= "usb_gadget_generic",
> +	.name		= "usb",
> +	.flags		= DM_UC_FLAG_SEQ_ALIAS,
>  };
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports
  2018-12-15 18:36   ` Marek Vasut
@ 2018-12-16 20:47     ` Lukasz Majewski
  2019-01-03 15:47       ` Sam Protsenko
  0 siblings, 1 reply; 6+ messages in thread
From: Lukasz Majewski @ 2018-12-16 20:47 UTC (permalink / raw)
  To: u-boot

Hi Marek, Jean-Jacques,

> On 12/15/2018 05:43 PM, Jean-Jacques Hiblot wrote:
> > dfu, fastbot and other usb gadget commands take the USB port index
> > as a  
> 
> fastboot.
> 
> Looks good to me, I expect Lukasz to pick it, test it and send me a
> PR.
> 
> > parameter. Currently this index is assigned in the order of the
> > driver bindings.
> > Changing this behavior using the SEQ_ALIAS feature. This option
> > assign to the device a SEQ number based on its alias (if it exists)
> > 
> > To use it we must set the DM_UC_FLAG_SEQ_ALIAS flag and follow the
> > existing naming convention: use "usb" for the name of the gadget
> > UCLASS_DRIVER (same as for the UCLASS_USB).

I must admit that this change fixes a long standing problem with the
usb number assignment.

Great job. I will test and send it in a few days time.

> > 
> > If no alias is provided, then the index falls back to the order in
> > which the bindings took place.
> > 
> > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> > Reported-by: Sam Protsenko <semen.protsenko@linaro.org>
> > ---
> > 
> >  drivers/usb/gadget/udc/udc-uclass.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/udc/udc-uclass.c
> > b/drivers/usb/gadget/udc/udc-uclass.c index 0620518..e9f8f5f 100644
> > --- a/drivers/usb/gadget/udc/udc-uclass.c
> > +++ b/drivers/usb/gadget/udc/udc-uclass.c
> > @@ -20,7 +20,7 @@ int usb_gadget_initialize(int index)
> >  		return -EINVAL;
> >  	if (dev_array[index])
> >  		return 0;
> > -	ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index,
> > &dev);
> > +	ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC,
> > index, &dev); if (!dev || ret) {
> >  		pr_err("No USB device found\n");
> >  		return -ENODEV;
> > @@ -54,5 +54,6 @@ int usb_gadget_handle_interrupts(int index)
> >  
> >  UCLASS_DRIVER(usb_gadget_generic) = {
> >  	.id		= UCLASS_USB_GADGET_GENERIC,
> > -	.name		= "usb_gadget_generic",
> > +	.name		= "usb",
> > +	.flags		= DM_UC_FLAG_SEQ_ALIAS,
> >  };
> >   
> 
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181216/7635e6e2/attachment.sig>

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

* [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports
  2018-12-16 20:47     ` Lukasz Majewski
@ 2019-01-03 15:47       ` Sam Protsenko
  0 siblings, 0 replies; 6+ messages in thread
From: Sam Protsenko @ 2019-01-03 15:47 UTC (permalink / raw)
  To: u-boot

Tested on BeagleBoard X15, works fine. Thanks, Jean-Jacques!

Lukasz, is there any way this series can make it to v2019.01 release?
Like to see it there, for stability/consistence reasons.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Tested-by: Sam Protsenko <semen.protsenko@linaro.org>

Thanks!

On Sun, Dec 16, 2018 at 10:47 PM Lukasz Majewski <lukma@denx.de> wrote:
>
> Hi Marek, Jean-Jacques,
>
> > On 12/15/2018 05:43 PM, Jean-Jacques Hiblot wrote:
> > > dfu, fastbot and other usb gadget commands take the USB port index
> > > as a
> >
> > fastboot.
> >
> > Looks good to me, I expect Lukasz to pick it, test it and send me a
> > PR.
> >
> > > parameter. Currently this index is assigned in the order of the
> > > driver bindings.
> > > Changing this behavior using the SEQ_ALIAS feature. This option
> > > assign to the device a SEQ number based on its alias (if it exists)
> > >
> > > To use it we must set the DM_UC_FLAG_SEQ_ALIAS flag and follow the
> > > existing naming convention: use "usb" for the name of the gadget
> > > UCLASS_DRIVER (same as for the UCLASS_USB).
>
> I must admit that this change fixes a long standing problem with the
> usb number assignment.
>
> Great job. I will test and send it in a few days time.
>
> > >
> > > If no alias is provided, then the index falls back to the order in
> > > which the bindings took place.
> > >
> > > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> > > Reported-by: Sam Protsenko <semen.protsenko@linaro.org>
> > > ---
> > >
> > >  drivers/usb/gadget/udc/udc-uclass.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/usb/gadget/udc/udc-uclass.c
> > > b/drivers/usb/gadget/udc/udc-uclass.c index 0620518..e9f8f5f 100644
> > > --- a/drivers/usb/gadget/udc/udc-uclass.c
> > > +++ b/drivers/usb/gadget/udc/udc-uclass.c
> > > @@ -20,7 +20,7 @@ int usb_gadget_initialize(int index)
> > >             return -EINVAL;
> > >     if (dev_array[index])
> > >             return 0;
> > > -   ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index,
> > > &dev);
> > > +   ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC,
> > > index, &dev); if (!dev || ret) {
> > >             pr_err("No USB device found\n");
> > >             return -ENODEV;
> > > @@ -54,5 +54,6 @@ int usb_gadget_handle_interrupts(int index)
> > >
> > >  UCLASS_DRIVER(usb_gadget_generic) = {
> > >     .id             = UCLASS_USB_GADGET_GENERIC,
> > > -   .name           = "usb_gadget_generic",
> > > +   .name           = "usb",
> > > +   .flags          = DM_UC_FLAG_SEQ_ALIAS,
> > >  };
> > >
> >
> >
>
>
>
>
> Best regards,
>
> Lukasz Majewski
>
> --
>
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de

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

end of thread, other threads:[~2019-01-03 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-15 16:43 [U-Boot] [PATCH v1 0/2] Fix USB port indexes for USB gadget commands Jean-Jacques Hiblot
2018-12-15 16:43 ` [U-Boot] [PATCH v1 1/2] dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports Jean-Jacques Hiblot
2018-12-15 18:36   ` Marek Vasut
2018-12-16 20:47     ` Lukasz Majewski
2019-01-03 15:47       ` Sam Protsenko
2018-12-15 16:43 ` [U-Boot] [PATCH v1 2/2] ARM: dts: define USB aliases for all omap5 platforms Jean-Jacques Hiblot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.