Skip to contentSkip to conversation

usb: gadget: udc: Fix duplicate uclass name

PATCH In review Zixun LI 4 participants 15 messages Aug 2, 2024 – Aug 27, 2024 USB

lore
Share & tools
lore

Zixun LI

author
#0 lore raw

PATCH 1/1 usb: gadget: udc: Fix duplicate uclass name

Currently both USB host uclass and USB gadget uclass are using the same name "usb" which break uclass functions like uclass_get_by_name().

Rename the uclass to "usb_gadget" to fix, also makes bind/unbind by class index (or sequence) working.

This breaks the capacity of using "usb" as DT alias sequence numbering which needs a fix afterwards.

---
 drivers/usb/gadget/udc/udc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/udc-uclass.c +1 -1
index fbe62bbce4..723d1cdfd7 100644
@@ -83,7 +83,7 @@ __weak int dm_usb_gadget_handle_interrupts(struct udevice *dev)
 #if CONFIG_IS_ENABLED(DM)
 UCLASS_DRIVER(usb_gadget_generic) = {
 	.id		= UCLASS_USB_GADGET_GENERIC,
-	.name		= "usb",
+	.name		= "usb_gadget",
 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 };
 #endif

--
2.45.2

author
#1 lore raw

PATCH 1/1 dm: core: Show device sequence instead in dm_dump_tree()

Currently uclass index is shown in DM tree dump which ignores alias sequence numbering. The result could be confusing since these 2 numbers could be different. Show device sequence number instead as it's more meaningful.

Also update documentation to use sequence number.

---
 doc/usage/cmd/dm.rst | 7 +++----
 drivers/core/dump.c  | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
doc/usage/cmd/dm.rst +3 -4
index 7651507937..196b22d137 100644
@@ -112,9 +112,8 @@ This shows the full tree of devices including the following fields:
 uclass
     Shows the name of the uclass for the device
 
-Index
-    Shows the index number of the device, within the uclass. This shows the
-    ordering within the uclass, but not the sequence number.
+Seq
+    Shows the sequence number of the device, within the uclass.
 
 Probed
     Shows `+` if the device is active
@@ -366,7 +365,7 @@ dm tree
 This example shows the abridged sandbox output::
 
     => dm tree
-    Class     Index  Probed  Driver                Name
+    Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
     root          0  [ + ]   root_driver           root_driver
     demo          0  [   ]   demo_shape_drv        |-- demo_shape_drv
drivers/core/dump.c +2 -2
index 5ec30d5b3c..5cbaa97fa3 100644
@@ -40,7 +40,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag,
 	/* print the first 20 characters to not break the tree-format. */
 	printf(CONFIG_IS_ENABLED(USE_TINY_PRINTF) ? " %s  %d  [ %c ]   %s  " :
 	       " %-10.10s  %3d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
-	       dev_get_uclass_index(dev, NULL),
+	       dev->seq_,
 	       flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
 
 	for (i = depth; i >= 0; i--) {
@@ -129,7 +129,7 @@ void dm_dump_tree(char *dev_name, bool extended, bool sort)
 {
 	struct udevice *root;
 
-	printf(" Class     Index  Probed  Driver                Name\n");
+	printf(" Class     Seq    Probed  Driver                Name\n");
 	printf("-----------------------------------------------------------\n");
 
 	root = dm_root();

--
2.45.2

Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH] dm: core: Show device sequence instead in dm_dump_tree()

Quoted 6 lines · Zixun LI

Currently uclass index is shown in DM tree dump which ignores alias sequence numbering. The result could be confusing since these 2 numbers could be different. Show device sequence number instead as it's more meaningful.

Quoted 7 lines

Also update documentation to use sequence number.

---
 doc/usage/cmd/dm.rst | 7 +++----
 drivers/core/dump.c  | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
Quoted 51 lines
doc/usage/cmd/dm.rst +3 -4
index 7651507937..196b22d137 100644
@@ -112,9 +112,8 @@ This shows the full tree of devices including the following fields:
 uclass
     Shows the name of the uclass for the device
 
-Index
-    Shows the index number of the device, within the uclass. This shows the
-    ordering within the uclass, but not the sequence number.
+Seq
+    Shows the sequence number of the device, within the uclass.
 
 Probed
     Shows `+` if the device is active
@@ -366,7 +365,7 @@ dm tree
 This example shows the abridged sandbox output::
 
     => dm tree
-    Class     Index  Probed  Driver                Name
+    Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
     root          0  [ + ]   root_driver           root_driver
     demo          0  [   ]   demo_shape_drv        |-- demo_shape_drv
drivers/core/dump.c +2 -3
index 5ec30d5b3c..5cbaa97fa3 100644
@@ -40,7 +40,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag,
        /* print the first 20 characters to not break the tree-format. */
        printf(CONFIG_IS_ENABLED(USE_TINY_PRINTF) ? " %s  %d  [ %c ]   %s  " :
               " %-10.10s  %3d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
-              dev_get_uclass_index(dev, NULL),
+              dev->seq_,
               flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
 
        for (i = depth; i >= 0; i--) {
@@ -129,7 +129,7 @@ void dm_dump_tree(char *dev_name, bool extended, bool sort)
 {
        struct udevice *root;
 
-       printf(" Class     Index  Probed  Driver                Name\n");
+       printf(" Class     Seq    Probed  Driver                Name\n");
        printf("-----------------------------------------------------------\n");
 
        root = dm_root();
--

2.45.2

#3 lore raw

Re: [PATCH] dm: core: Show device sequence instead in dm_dump_tree()

In reply to Zixun LI
Quoted 8 lines · Zixun LI

Currently uclass index is shown in DM tree dump which ignores alias sequence numbering. The result could be confusing since these 2 numbers could be different. Show device sequence number instead as it's more meaningful.

Also update documentation to use sequence number.

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
author
#4 lore raw

PATCH 1/1 cmd: bind: Use device sequence instead for driver bind/unbind

In reply to Zixun LI

Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT.

Also update documentation to use sequence number.

---
 cmd/bind.c               | 46 ++++++++++++++++++++--------------------
 doc/usage/cmd/bind.rst   | 12 +++++------
 doc/usage/cmd/unbind.rst | 14 ++++++------
 3 files changed, 36 insertions(+), 36 deletions(-)
cmd/bind.c +23 -23
index 3a59eefd5c..c0d31f5eb1 100644
@@ -10,8 +10,8 @@
 #include <dm/root.h>
 #include <dm/uclass-internal.h>
 
-static int bind_by_class_index(const char *uclass, int index,
-			       const char *drv_name)
+static int bind_by_class_seq(const char *uclass, int seq,
+			     const char *drv_name)
 {
 	static enum uclass_id uclass_id;
 	struct udevice *dev;
@@ -31,9 +31,9 @@ static int bind_by_class_index(const char *uclass, int index,
 		return -EINVAL;
 	}
 
-	ret = uclass_find_device(uclass_id, index, &parent);
+	ret = uclass_find_device_by_seq(uclass_id, seq, &parent);
 	if (!parent || ret) {
-		printf("Cannot find device %d of class %s\n", index, uclass);
+		printf("Cannot find device %d of class %s\n", seq, uclass);
 		return ret;
 	}
 
@@ -47,7 +47,7 @@ static int bind_by_class_index(const char *uclass, int index,
 	return 0;
 }
 
-static int find_dev(const char *uclass, int index, struct udevice **devp)
+static int find_dev(const char *uclass, int seq, struct udevice **devp)
 {
 	static enum uclass_id uclass_id;
 	int rc;
@@ -58,21 +58,21 @@ static int find_dev(const char *uclass, int index, struct udevice **devp)
 		return -EINVAL;
 	}
 
-	rc = uclass_find_device(uclass_id, index, devp);
+	rc = uclass_find_device_by_seq(uclass_id, seq, devp);
 	if (!*devp || rc) {
-		printf("Cannot find device %d of class %s\n", index, uclass);
+		printf("Cannot find device %d of class %s\n", seq, uclass);
 		return rc;
 	}
 
 	return 0;
 }
 
-static int unbind_by_class_index(const char *uclass, int index)
+static int unbind_by_class_seq(const char *uclass, int seq)
 {
 	int ret;
 	struct udevice *dev;
 
-	ret = find_dev(uclass, index, &dev);
+	ret = find_dev(uclass, seq, &dev);
 	if (ret)
 		return ret;
 
@@ -91,8 +91,8 @@ static int unbind_by_class_index(const char *uclass, int index)
 	return 0;
 }
 
-static int unbind_child_by_class_index(const char *uclass, int index,
-				       const char *drv_name)
+static int unbind_child_by_class_seq(const char *uclass, int seq,
+				     const char *drv_name)
 {
 	struct udevice *parent;
 	int ret;
@@ -104,7 +104,7 @@ static int unbind_child_by_class_index(const char *uclass, int index,
 		return -ENOENT;
 	}
 
-	ret = find_dev(uclass, index, &parent);
+	ret = find_dev(uclass, seq, &parent);
 	if (ret)
 		return ret;
 
@@ -217,19 +217,19 @@ static int do_bind_unbind(struct cmd_tbl *cmdtp, int flag, int argc,
 			return CMD_RET_USAGE;
 		ret = unbind_by_node_path(argv[1]);
 	} else if (!by_node && bind) {
-		int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
+		int seq = (argc > 2) ? dectoul(argv[2], NULL) : 0;
 
 		if (argc != 4)
 			return CMD_RET_USAGE;
-		ret = bind_by_class_index(argv[1], index, argv[3]);
+		ret = bind_by_class_seq(argv[1], seq, argv[3]);
 	} else if (!by_node && !bind) {
-		int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
+		int seq = (argc > 2) ? dectoul(argv[2], NULL) : 0;
 
 		if (argc == 3)
-			ret = unbind_by_class_index(argv[1], index);
+			ret = unbind_by_class_seq(argv[1], seq);
 		else if (argc == 4)
-			ret = unbind_child_by_class_index(argv[1], index,
-							  argv[3]);
+			ret = unbind_child_by_class_seq(argv[1], seq,
+							argv[3]);
 		else
 			return CMD_RET_USAGE;
 	}
@@ -244,17 +244,17 @@ U_BOOT_CMD(
 	bind,	4,	0,	do_bind_unbind,
 	"Bind a device to a driver",
 	"<node path> <driver>\n"
-	"bind <class> <index> <driver>\n"
+	"bind <class> <seq> <driver>\n"
 	"Use 'dm tree' to list all devices registered in the driver model,\n"
-	"their path, class, index and current driver.\n"
+	"their path, class, sequence and current driver.\n"
 );
 
 U_BOOT_CMD(
 	unbind,	4,	0,	do_bind_unbind,
 	"Unbind a device from a driver",
 	"<node path>\n"
-	"unbind <class> <index>\n"
-	"unbind <class> <index> <driver>\n"
+	"unbind <class> <seq>\n"
+	"unbind <class> <seq> <driver>\n"
 	"Use 'dm tree' to list all devices registered in the driver model,\n"
-	"their path, class, index and current driver.\n"
+	"their path, class, sequence and current driver.\n"
 );
doc/usage/cmd/bind.rst +6 -6
index 2345778366..67a0405bab 100644
@@ -12,7 +12,7 @@ Synopsis
 ::
 
     bind <node path> <driver>
-    bind <class> <index> <driver>
+    bind <class> <seq> <driver>
 
 Description
 -----------
@@ -30,8 +30,8 @@ node path
 class
     device class name
 
-index
-    index of the parent device in the device class
+seq
+    sequence number of the parent device in the device class
 
 driver
     device driver name
@@ -46,7 +46,7 @@ using the two alternative bind syntaxes.
 .. code-block::
 
     => dm tree
-     Class     Index  Probed  Driver                Name
+     Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
      root          0  [ + ]   root_driver           root_driver
     ...
@@ -75,13 +75,13 @@ using the two alternative bind syntaxes.
     => date
     Cannot find RTC: err=-19
     => dm tree
-     Class     Index  Probed  Driver                Name
+     Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
      root          0  [ + ]   root_driver           root_driver
     ...
     => bind /pl031@9010000 rtc-pl031
     => dm tree
-     Class     Index  Probed  Driver                Name
+     Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
      root          0  [ + ]   root_driver           root_driver
     ...
doc/usage/cmd/unbind.rst +7 -7
index 0309e90f6e..1ae9c1b172 100644
@@ -12,8 +12,8 @@ Synopsis
 ::
 
     unbind <node path>
-    unbind <class> <index>
-    unbind <class> <index> <driver>
+    unbind <class> <seq>
+    unbind <class> <seq> <driver>
 
 Description
 -----------
@@ -27,8 +27,8 @@ node path
 class
     device class name
 
-index
-    index of the device in the device class
+seq
+    sequence number of the device in the device class
 
 driver
     device driver name
@@ -43,7 +43,7 @@ using the three alternative unbind syntaxes.
 .. code-block::
 
     => dm tree
-     Class     Index  Probed  Driver                Name
+     Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
      root          0  [ + ]   root_driver           root_driver
     ...
@@ -70,7 +70,7 @@ using the three alternative unbind syntaxes.
     }
     => unbind /pl031@9010000
     => dm tree
-     Class     Index  Probed  Driver                Name
+     Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
      root          0  [ + ]   root_driver           root_driver
     ...
@@ -78,7 +78,7 @@ using the three alternative unbind syntaxes.
     Cannot find a device with path /pl031@9010000
     => bind /pl031@9010000 rtc-pl031
     => dm tree
-     Class     Index  Probed  Driver                Name
+     Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
      root          0  [ + ]   root_driver           root_driver
     ...

--
2.45.2

Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] cmd: bind: Use device sequence instead for driver bind/unbind

Quoted 5 lines · Zixun LI

Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT.

Quoted 9 lines

Also update documentation to use sequence number.

---
 cmd/bind.c               | 46 ++++++++++++++++++++--------------------
 doc/usage/cmd/bind.rst   | 12 +++++------
 doc/usage/cmd/unbind.rst | 14 ++++++------
 3 files changed, 36 insertions(+), 36 deletions(-)
#6 lore raw

Re: [PATCH] cmd: bind: Use device sequence instead for driver bind/unbind

In reply to Zixun LI

Hi,

Quoted 8 lines · Zixun LI

Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT.

Also update documentation to use sequence number.

[...]

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu-next)

[1/1] cmd: bind: Use device sequence instead for driver bind/unbind

      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/0c48507eee08b5e7d4e8484727efe47cfabff0ee

--
Mattijs

#7 lore raw

Re: [PATCH] cmd: bind: Use device sequence instead for driver bind/unbind

Quoted 10 lines · Mattijs Korpershoek

Hi,

Quoted 7 lines · Zixun LI

Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT.

Also update documentation to use sequence number.

Quoted 6 lines
Quoted 1 line

[...]

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu-next)

[1/1] cmd: bind: Use device sequence instead for driver bind/unbind

      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/0c48507eee08b5e7d4e8484727efe47cfabff0ee

Somehow, b4 did the wrong thing here when running:

$ b4 shazam -s -l --check [email protected]

Grabbing thread from lore.kernel.org/all/[email protected]/t.mbox.gz Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 12 messages in the thread
Assuming new revision: v2 ([PATCH] dm: core: Show device sequence instead in dm_dump_tree()) Assuming new revision: v3 ([PATCH] cmd: bind: Use device sequence instead for driver bind/unbind) Analyzing 0 code-review messages
Will use the latest revision: v3
You can pick other revisions using the -vN flag
Checking attestation on all messages, may take a moment...
---
✗ [PATCH] cmd: bind: Use device sequence instead for driver bind/unbind
+ Reviewed-by: Simon Glass <[email protected]> (✗ DKIM/chromium.org)
+ Link: https://lore.kernel.org/r/[email protected]
+ Signed-off-by: Mattijs Korpershoek <[email protected]>
● checkpatch.pl: passed all checks
---
✗ BADSIG: DKIM/hifiphile-com.20230601.gappssmtp.com
---
Total patches: 1
---
Applying: cmd: bind: Use device sequence instead for driver bind/unbind

It applied:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Instead of:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I have fixed this up manually, see:
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/73f5b54a589cb6ff97aaca55e7c97d68b43997ee

Quoted 3 lines

--
Mattijs

#8 lore raw

Re: [PATCH] cmd: bind: Use device sequence instead for driver bind/unbind

In reply to Zixun LI
Quoted 8 lines · Zixun LI

Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT.

Also update documentation to use sequence number.

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
Reviewed-by on v1 1/1
#9 lore raw
In reply to Zixun LI
Quoted 7 lines · Zixun LI

Currently both USB host uclass and USB gadget uclass are using the same name "usb" which break uclass functions like uclass_get_by_name().

Rename the uclass to "usb_gadget" to fix, also makes bind/unbind by class index (or sequence) working.

Quoted 7 lines

This breaks the capacity of using "usb" as DT alias sequence numbering which needs a fix afterwards.

---
 drivers/usb/gadget/udc/udc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#10 lore raw
In reply to Zixun LI

Hi Zixun,

Thank you for the patch.

Quoted 8 lines · Zixun LI

Currently both USB host uclass and USB gadget uclass are using the same name "usb" which break uclass functions like uclass_get_by_name().

Rename the uclass to "usb_gadget" to fix, also makes bind/unbind by class index (or sequence) working.

This breaks the capacity of using "usb" as DT alias sequence numbering which needs a fix afterwards.

Have you identified boards which use the DT alias that will break with this patch?

Maybe we can detail the required fix in the commit message a bit as well? Or, if you know of a board that uses "usb" as DT alias sequence number, we can submit a fix alongside with this one to document the fix.

Quoted 21 lines
---
 drivers/usb/gadget/udc/udc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/udc-uclass.c +1 -2
index fbe62bbce4..723d1cdfd7 100644
@@ -83,7 +83,7 @@ __weak int dm_usb_gadget_handle_interrupts(struct udevice *dev)
 #if CONFIG_IS_ENABLED(DM)
 UCLASS_DRIVER(usb_gadget_generic) = {
 	.id		= UCLASS_USB_GADGET_GENERIC,
-	.name		= "usb",
+	.name		= "usb_gadget",
 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 };
 #endif
--

2.45.2

author
#11 lore raw

Hi Mattijs,

Quoted 8 lines · Mattijs Korpershoek

Have you identified boards which use the DT alias that will break with this patch?

Maybe we can detail the required fix in the commit message a bit as well? Or, if you know of a board that uses "usb" as DT alias sequence number, we can submit a fix alongside with this one to document the fix.

I did a search and it affects mostly i.MX devices and Nuvoton npcm845 where host and device controller use the same alias.

like imx6qdl.dtsi:
aliases {
...

    usb0 = &usbotg;
    usb1 = &usbh1;
    usb2 = &usbh2;
    usb3 = &usbh3;
};

nuvoton-npcm845-evb.dts:
aliases {
...

    usb0 = &udc0;
    usb1 = &ehci1;
    usb2 = &ehci2;
};

But I got lost in EHCI's code, like in ehci_register() when ctrl->init == USB_INIT_DEVICE the function returns without the actual device init ? I'm not sure how their gadget mode works and if it's really broken or not.

#12 lore raw

Hi Zixun,

Quoted 28 lines · Zixun LI

Hi Mattijs,

Quoted 8 lines · Mattijs Korpershoek

Have you identified boards which use the DT alias that will break with this patch?

Maybe we can detail the required fix in the commit message a bit as well? Or, if you know of a board that uses "usb" as DT alias sequence number, we can submit a fix alongside with this one to document the fix.

I did a search and it affects mostly i.MX devices and Nuvoton npcm845 where host and device controller use the same alias.

like imx6qdl.dtsi:
aliases {
...

    usb0 = &usbotg;
    usb1 = &usbh1;
    usb2 = &usbh2;
    usb3 = &usbh3;
};

nuvoton-npcm845-evb.dts:
aliases {
...

Quoted 8 lines
    usb0 = &udc0;
    usb1 = &ehci1;
    usb2 = &ehci2;
};

But I got lost in EHCI's code, like in ehci_register() when ctrl->init == USB_INIT_DEVICE the function returns without the actual device init ? I'm not sure how their gadget mode works and if it's really broken or not.

Thank you for giving some board examples. I am still a bit unclear on the meaning of:

"""
This breaks the capacity of using "usb" as DT alias sequence numbering which needs a fix afterwards.
"""

I have added Jagan, Stefano, Fabio and the NXP team in CC. Does anyone of you have any concerns with this patch ?

If someone could test it, that would be helpful.

author
#13 lore raw

Hi Mattijs,

Quoted 9 lines · Mattijs Korpershoek

Thank you for giving some board examples. I am still a bit unclear on the meaning of:

"""
This breaks the capacity of using "usb" as DT alias sequence numbering which needs a fix afterwards.
"""

Quoted 4 lines

I have added Jagan, Stefano, Fabio and the NXP team in CC. Does anyone of you have any concerns with this patch ?

If someone could test it, that would be helpful.

The device sequence number is affected by uclass_find_next_free_seq() in uclass.c, in this function uclass name is used to determine the number.

Since the gadget class's name changed to "usb_gadget" from "usb", alias binding "usb1 = &usbotg;" is not effective anymore. As now it searches for "usb_gadget1 = &usbotg;".

uclass_find_device_by_seq(UCLASS_USB_GADGET_GENERIC,) would fail as sequence number is changed.

I made a tentative fix in
https://lore.kernel.org/u-boot/[email protected]/
But Simon doesn't want to modify uclass_driver structure only for gadget class.

Regards,
Zixun

#14 lore raw

Hi Zixun,

Quoted 21 lines · Zixun LI

Hi Mattijs,

Quoted 9 lines · Mattijs Korpershoek

Thank you for giving some board examples. I am still a bit unclear on the meaning of:

"""
This breaks the capacity of using "usb" as DT alias sequence numbering which needs a fix afterwards.
"""

Quoted 4 lines

I have added Jagan, Stefano, Fabio and the NXP team in CC. Does anyone of you have any concerns with this patch ?

If someone could test it, that would be helpful.

The device sequence number is affected by uclass_find_next_free_seq() in uclass.c, in this function uclass name is used to determine the number.

Quoted 6 lines

Since the gadget class's name changed to "usb_gadget" from "usb", alias binding "usb1 = &usbotg;" is not effective anymore. As now it searches for "usb_gadget1 = &usbotg;".

uclass_find_device_by_seq(UCLASS_USB_GADGET_GENERIC,) would fail as sequence number is changed.

Thank you for the explanation.
Looking at the code, I don't see anyone calling:
- uclass_find_device_by_seq(UCLASS_USB_GADGET

And one occurrence of:
- uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev);

Quoted 8 lines

I made a tentative fix in
https://lore.kernel.org/u-boot/[email protected]/
But Simon doesn't want to modify uclass_driver structure only for gadget class.

Regards,
Zixun