From: Sergey Nazaryev <sergey@coolautomation.com>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: u-boot@lists.denx.de
Subject: Re: USB init before using usb_serial_acm gadget?
Date: Sun, 17 Apr 2022 11:45:10 +0300 [thread overview]
Message-ID: <20220417084510.mdofaf22xf2zxyyu@cool> (raw)
In-Reply-To: <CAMZdPi-xvw44ym_WkaSWVXoq_2fSHqAZx_58EHCcm-eoTFW46w@mail.gmail.com>
> So I think the right place to call usb_gadget_initialize is probably
> before registering the acm gadget function into acm_stdio_start(). Can
> you try this? and submit a follow_up fix patch if working?
It's required for `usb_gadget_initialize` to provide a "USB
controller index" as an argument. It's pretty obvious how to do it in
"interactive world" (e.g. to ask user for this number via CLI, like
it was in commands mentioned in my previous message) but in our case
we need to provide this number in non-interactive manner.
There is not an elegant solution with hardcoding '0' as a controller
index like it was done in `ether` gadget [1], but it seems that it
was a temporary fix ("This is a preparatory work for DM support for
UDC drivers") that occasionaly became a permament solution.
So, that's why I suggested to add a new subcommand to `usb` for OTG
initialization: in my opinion, it's better to require an explicit
call of something like `usb otgstart 0` than hardcoding a '0' into
the code. One more option is to add a new environment variable to
explictly specify a controller index, and read this variable from all
places when it requires.
P.S. I already put `usb_gadget_intiialize(0)` to my board code, and
ACM gadget started working; so the remaining problem is only to
decide where is the best place for this call.
[1]: https://source.denx.de/u-boot/u-boot/-/blob/master/drivers/usb/gadget/ether.c#L2355
next prev parent reply other threads:[~2022-04-17 8:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220414183117.wguqf5ggey7yxkhl@cool>
2022-04-14 20:15 ` USB init before using usb_serial_acm gadget? Loic Poulain
2022-04-17 8:45 ` Sergey Nazaryev [this message]
2022-04-21 12:53 ` Loic Poulain
2022-04-14 18:37 Sergey Nazaryev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220417084510.mdofaf22xf2zxyyu@cool \
--to=sergey@coolautomation.com \
--cc=loic.poulain@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox