aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorCaleb Connolly2024-03-20 14:30:49 +0000
committerMattijs Korpershoek2024-03-22 10:16:13 +0100
commit341a172ef7867e3bfa90d6951997e5e2f168e188 (patch)
treefe08a16263aae3240d5c8ad2a681976f361c6a5e /drivers/usb
parent850b307789dca8dfff6d7cad57ba2ffbfbb5f6ed (diff)
usb: gadget: CDC ACM: call usb_gadget_initialize
To actually use the gadget the peripheral driver must be probed and we must call g_dnl_clear_detach(). Otherwise acm_stdio_start() will always fail to find a UDC on DT platforms. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> Link: https://lore.kernel.org/r/20240320-b4-qcom-usb-v4-3-41be480172e1@linaro.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_acm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index de42e0189e8..ba216128ab2 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -623,12 +623,21 @@ static void acm_stdio_puts(struct stdio_dev *dev, const char *str)
static int acm_stdio_start(struct stdio_dev *dev)
{
+ struct udevice *udc;
int ret;
if (dev->priv) { /* function already exist */
return 0;
}
+ ret = udc_device_get_by_index(0, &udc);
+ if (ret) {
+ pr_err("USB init failed: %d\n", ret);
+ return ret;
+ }
+
+ g_dnl_clear_detach();
+
ret = g_dnl_register("usb_serial_acm");
if (ret)
return ret;