diff mbox

[v2,2/4] fastboot: call board_usb_init() to enable usb

Message ID 1425381044-19460-2-git-send-email-dileep.katta@linaro.org
State New
Headers show

Commit Message

Dileep Katta March 3, 2015, 11:10 a.m. UTC
g_dnl_gadget_register() fails for dra7xx dwc3 gadget
when running cmd_fastboot.
Calling board_usb_init() fixes this.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
---
 common/cmd_fastboot.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Dileep Katta March 4, 2015, 7:06 p.m. UTC | #1
On 4 March 2015 at 23:59, Tom Rini <trini@konsulko.com> wrote:

> On Wed, Mar 04, 2015 at 05:05:11PM +0000, Stegmaier, Angela wrote:
> > Hi Dileep,
> >
> > > -----Original Message-----
> > > From: Dileep Katta [mailto:dileep.katta@linaro.org]
> > > Sent: Tuesday, March 03, 2015 5:11 AM
> > > To: u-boot@lists.denx.de; robherring2@gmail.com; Rini, Tom;
> > > rob.herring@linaro.org; srae@broadcom.com; l.majewski@samsung.com;
> > > Stegmaier, Angela
> > > Cc: Dileep Katta
> > > Subject: [U-Boot][PATCH v2 2/4] fastboot: call board_usb_init() to
> enable
> > > usb
> > >
> > > g_dnl_gadget_register() fails for dra7xx dwc3 gadget when running
> > > cmd_fastboot.
> > > Calling board_usb_init() fixes this.
> > >
> > > Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
> > > Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
> > > ---
> > >  common/cmd_fastboot.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index
> > > 346ab80..d7b8f6d 100644
> > > --- a/common/cmd_fastboot.c
> > > +++ b/common/cmd_fastboot.c
> > > @@ -10,11 +10,13 @@
> > >  #include <common.h>
> > >  #include <command.h>
> > >  #include <g_dnl.h>
> > > +#include <usb.h>
> > >
> > >  static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char
> *const
> > > argv[])  {
> > >     int ret;
> > >
> > > +   board_usb_init(0, USB_INIT_DEVICE);
> >
> > The controller index should be configurable. Also, should
> board_usb_cleanup be called at the end?
>
> I _really_ _really_ want to see if we can modify things so that we don't
> have to sprinkle ever gadget driver with a cleanup() and every gadget
> too if we don't have to.  Thanks!
>
Most of the boards have board_usb_cleanup() as just a stub. For some, the
function is not present, and adding board_usb_cleanup() here breaks the
build for others with fastboot enabled.

>
> --
> Tom
>
Regards, Dileep
Dileep Katta March 12, 2015, 6:36 a.m. UTC | #2
On 5 March 2015 at 20:07, Tom Rini <trini@konsulko.com> wrote:

> On Thu, Mar 05, 2015 at 12:36:57AM +0530, Dileep Katta wrote:
> > On 4 March 2015 at 23:59, Tom Rini <trini@konsulko.com> wrote:
> >
> > > On Wed, Mar 04, 2015 at 05:05:11PM +0000, Stegmaier, Angela wrote:
> > > > Hi Dileep,
> > > >
> > > > > -----Original Message-----
> > > > > From: Dileep Katta [mailto:dileep.katta@linaro.org]
> > > > > Sent: Tuesday, March 03, 2015 5:11 AM
> > > > > To: u-boot@lists.denx.de; robherring2@gmail.com; Rini, Tom;
> > > > > rob.herring@linaro.org; srae@broadcom.com; l.majewski@samsung.com;
> > > > > Stegmaier, Angela
> > > > > Cc: Dileep Katta
> > > > > Subject: [U-Boot][PATCH v2 2/4] fastboot: call board_usb_init() to
> > > enable
> > > > > usb
> > > > >
> > > > > g_dnl_gadget_register() fails for dra7xx dwc3 gadget when running
> > > > > cmd_fastboot.
> > > > > Calling board_usb_init() fixes this.
> > > > >
> > > > > Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
> > > > > Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
> > > > > ---
> > > > >  common/cmd_fastboot.c | 2 ++
> > > > >  1 file changed, 2 insertions(+)
> > > > >
> > > > > diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index
> > > > > 346ab80..d7b8f6d 100644
> > > > > --- a/common/cmd_fastboot.c
> > > > > +++ b/common/cmd_fastboot.c
> > > > > @@ -10,11 +10,13 @@
> > > > >  #include <common.h>
> > > > >  #include <command.h>
> > > > >  #include <g_dnl.h>
> > > > > +#include <usb.h>
> > > > >
> > > > >  static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char
> > > *const
> > > > > argv[])  {
> > > > >     int ret;
> > > > >
> > > > > +   board_usb_init(0, USB_INIT_DEVICE);
> > > >
> > > > The controller index should be configurable.
>
We are not getting controller Index as an argument for fastboot function.
Might have to add extra logic to get the same.
But do we need configurable index here for fastboot?
Experts, please advise.

> Also, should
> > > board_usb_cleanup be called at the end?
> > >
> > > I _really_ _really_ want to see if we can modify things so that we
> don't
> > > have to sprinkle ever gadget driver with a cleanup() and every gadget
> > > too if we don't have to.  Thanks!
> >
> > Most of the boards have board_usb_cleanup() as just a stub. For some, the
> > function is not present, and adding board_usb_cleanup() here breaks the
> > build for others with fastboot enabled.
>
> That's a problem that needs fixing since those boards without a
> functional board_usb_cleanup() are likely causing breakage in Linux.
>
Will add the board_usb_cleanup() function at the end.

>
> --
> Tom
>
diff mbox

Patch

diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index 346ab80..d7b8f6d 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -10,11 +10,13 @@ 
 #include <common.h>
 #include <command.h>
 #include <g_dnl.h>
+#include <usb.h>
 
 static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
+	board_usb_init(0, USB_INIT_DEVICE);
 	g_dnl_clear_detach();
 	ret = g_dnl_register("usb_dnl_fastboot");
 	if (ret)