
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 11/29/12 18:14, Lukasz Majewski wrote:
Hi Tom,
On 11/28/12 11:08, Lukasz Majewski wrote:
Hi Tom,
On 11/28/12 09:47, Lukasz Majewski wrote:
> Hi Pantelis, > >> USB initialization shouldn't happen for all the >> boards. >> > > The board_usb_init() follows u-boot policy, that SoC > IPs (USB) are enabled and configured just before their > usage. > > >> Signed-off-by: Pantelis Antoniou >> panto@antoniou-consulting.com --- common/cmd_dfu.c >> | 3 +++ 1 file changed, 3 insertions(+) >> >> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c >> index 01d6b3a..327c738 100644 --- a/common/cmd_dfu.c >> +++ b/common/cmd_dfu.c @@ -55,7 +55,10 @@ static >> int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char >> * const argv[]) goto done; } >> >> +#ifdef CONFIG_TRATS board_usb_init(); +#endif + > In mine opinion this #ifdef shall be removed and each > target board using the DFU shall define > board_usb_init() at board file. >
But this isn't a called-only-once place. What are you really doing here and are you sure it's needed every time DFU is called?
Hmm, you are correct here.
But I don't have a good alternative for this.
One solution would be to define a static flag for it at do_dfu function to indicate if this was executed once (however I'm reluctant do this).
Any ideas?
I think the answer, and it's what we do on am335x is that arch_misc_init() is what calls the equiv of s3c_udc_probe(...) under the logic of "if we are built with usb gadget support, we want to use it, so init it".
I've understood the policy differently:
"We are build with gadget support and we _might_ use it, so enable low level code only when (or just before) we use it".
What's about the power consumption? Why IP block which will be used from time to time shall be enabled and operational?
Frankly, I think this shows we don't have a good setup right now, in general. Saying the gadget needs to whack and re-whack the device into on state (but isn't really turning it off once done) isn't ideal. There are also indeed drawbacks to saying "gadget support enabled at boot-time, let me set it up". Right now, I don't really have a good answer. It also needs to cover things like gadget ethernet where we don't really want to disappear immediately after each command.
- -- Tom