diff options
author | Jean-Jacques Hiblot | 2018-12-15 10:43:27 -0600 |
---|---|---|
committer | Marek Vasut | 2019-01-10 11:52:51 -0600 |
commit | 801f1fa44275e274e33bdfc7fb76535cc6118d61 (patch) | |
tree | 8666747b0b9676111c8eaae27b3e69b1c5b87139 | |
parent | 8c6cc71b40357dad4e3f21e9f1bd84db76a3d994 (diff) | |
download | u-boot-801f1fa44275e274e33bdfc7fb76535cc6118d61.tar.gz u-boot-801f1fa44275e274e33bdfc7fb76535cc6118d61.tar.xz u-boot-801f1fa44275e274e33bdfc7fb76535cc6118d61.zip |
dm: usb: udc: Use SEQ_ALIAS to index the USB gadget ports
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>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
-rw-r--r-- | drivers/usb/gadget/udc/udc-uclass.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c index 062051857a..e9f8f5f246 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) | |||
20 | return -EINVAL; | 20 | return -EINVAL; |
21 | if (dev_array[index]) | 21 | if (dev_array[index]) |
22 | return 0; | 22 | return 0; |
23 | ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev); | 23 | ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev); |
24 | if (!dev || ret) { | 24 | if (!dev || ret) { |
25 | pr_err("No USB device found\n"); | 25 | pr_err("No USB device found\n"); |
26 | return -ENODEV; | 26 | return -ENODEV; |
@@ -54,5 +54,6 @@ int usb_gadget_handle_interrupts(int index) | |||
54 | 54 | ||
55 | UCLASS_DRIVER(usb_gadget_generic) = { | 55 | UCLASS_DRIVER(usb_gadget_generic) = { |
56 | .id = UCLASS_USB_GADGET_GENERIC, | 56 | .id = UCLASS_USB_GADGET_GENERIC, |
57 | .name = "usb_gadget_generic", | 57 | .name = "usb", |
58 | .flags = DM_UC_FLAG_SEQ_ALIAS, | ||
58 | }; | 59 | }; |