diff mbox

[U-Boot,2/2] usb: invoke board specific USB cleanup interface

Message ID 1421651236-9760-3-git-send-email-ideal.song@samsung.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Inha Song Jan. 19, 2015, 7:07 a.m. UTC
This patch invoke board-specific USB cleanup (board_usb_cleanup)
interface.

Signed-off-by: Inha Song <ideal.song@samsung.com>
---
 common/cmd_dfu.c              | 1 +
 common/cmd_thordown.c         | 1 +
 common/cmd_usb_mass_storage.c | 1 +
 3 files changed, 3 insertions(+)

Comments

Ɓukasz Majewski Feb. 24, 2015, 11:56 a.m. UTC | #1
Hi Inha,

> This patch invoke board-specific USB cleanup (board_usb_cleanup)
> interface.
> 
> Signed-off-by: Inha Song <ideal.song@samsung.com>
> ---
>  common/cmd_dfu.c              | 1 +
>  common/cmd_thordown.c         | 1 +
>  common/cmd_usb_mass_storage.c | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index e975abe..161d38b 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -68,6 +68,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) }
>  exit:
>  	g_dnl_unregister();
> +	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
>  done:
>  	dfu_free_entities();
>  
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index 8ed1dc6..436b7f5 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -56,6 +56,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) 
>  exit:
>  	g_dnl_unregister();
> +	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
>  done:
>  	dfu_free_entities();
>  
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 2c879ea..53a765e 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -154,6 +154,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int
> flag, }
>  exit:
>  	g_dnl_unregister();
> +	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
>  	return CMD_RET_SUCCESS;
>  }Lukasz Majewski <l.majewski@samsung.com>
>  

Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Rob Herring Feb. 24, 2015, 4:20 p.m. UTC | #2
On Mon, Jan 19, 2015 at 1:07 AM, Inha Song <ideal.song@samsung.com> wrote:
> This patch invoke board-specific USB cleanup (board_usb_cleanup)
> interface.
>
> Signed-off-by: Inha Song <ideal.song@samsung.com>
> ---
>  common/cmd_dfu.c              | 1 +
>  common/cmd_thordown.c         | 1 +
>  common/cmd_usb_mass_storage.c | 1 +

You missed fastboot at a minimum.

What about other gadget functions such as rndis/cdc_etherent?

>  3 files changed, 3 insertions(+)
>
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index e975abe..161d38b 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -68,6 +68,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>         }
>  exit:
>         g_dnl_unregister();
> +       board_usb_cleanup(controller_index, USB_INIT_DEVICE);

Perhaps this should be part of g_dnl_unregister since it is always
called immediately after.

>  done:
>         dfu_free_entities();
>
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index 8ed1dc6..436b7f5 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -56,6 +56,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
>  exit:
>         g_dnl_unregister();
> +       board_usb_cleanup(controller_index, USB_INIT_DEVICE);
>  done:
>         dfu_free_entities();
>
> diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
> index 2c879ea..53a765e 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -154,6 +154,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>         }
>  exit:
>         g_dnl_unregister();
> +       board_usb_cleanup(controller_index, USB_INIT_DEVICE);
>         return CMD_RET_SUCCESS;
>  }
>
> --
> 2.0.0.390.gcb682f8
>
Inha Song Feb. 25, 2015, 9:58 a.m. UTC | #3
Hi, Rob,


On Tue, 24 Feb 2015 10:20:13 -0600
Rob Herring <robh@kernel.org> wrote:

> On Mon, Jan 19, 2015 at 1:07 AM, Inha Song <ideal.song@samsung.com> wrote:
> > This patch invoke board-specific USB cleanup (board_usb_cleanup)
> > interface.
> >
> > Signed-off-by: Inha Song <ideal.song@samsung.com>
> > ---
> >  common/cmd_dfu.c              | 1 +
> >  common/cmd_thordown.c         | 1 +
> >  common/cmd_usb_mass_storage.c | 1 +
> 
> You missed fastboot at a minimum.

Ok, I will add board_usb_cleanup fuction also in fastboot.

> 
> What about other gadget functions such as rndis/cdc_etherent?

I doesn't have any knowledge about rndis/cdc_etherent
So, Afraid that to fix these code.

> 
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> > index e975abe..161d38b 100644
> > --- a/common/cmd_dfu.c
> > +++ b/common/cmd_dfu.c
> > @@ -68,6 +68,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >         }
> >  exit:
> >         g_dnl_unregister();
> > +       board_usb_cleanup(controller_index, USB_INIT_DEVICE);
> 
> Perhaps this should be part of g_dnl_unregister since it is always
> called immediately after.

Hm, I am not sure we need to add board_usb_cleanup funtion to the gadget.

Best Regards,
Inha Song.

> 
> >  done:
> >         dfu_free_entities();
> >
> > diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> > index 8ed1dc6..436b7f5 100644
> > --- a/common/cmd_thordown.c
> > +++ b/common/cmd_thordown.c
> > @@ -56,6 +56,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >
> >  exit:
> >         g_dnl_unregister();
> > +       board_usb_cleanup(controller_index, USB_INIT_DEVICE);
> >  done:
> >         dfu_free_entities();
> >
> > diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
> > index 2c879ea..53a765e 100644
> > --- a/common/cmd_usb_mass_storage.c
> > +++ b/common/cmd_usb_mass_storage.c
> > @@ -154,6 +154,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
> >         }
> >  exit:
> >         g_dnl_unregister();
> > +       board_usb_cleanup(controller_index, USB_INIT_DEVICE);
> >         return CMD_RET_SUCCESS;
> >  }
> >
> > --
> > 2.0.0.390.gcb682f8
> >
Tom Rini Feb. 25, 2015, 1:10 p.m. UTC | #4
On Wed, Feb 25, 2015 at 06:58:03PM +0900, Inha Song wrote:
> Hi, Rob,
> 
> 
> On Tue, 24 Feb 2015 10:20:13 -0600
> Rob Herring <robh@kernel.org> wrote:
> 
> > On Mon, Jan 19, 2015 at 1:07 AM, Inha Song <ideal.song@samsung.com> wrote:
> > > This patch invoke board-specific USB cleanup (board_usb_cleanup)
> > > interface.
> > >
> > > Signed-off-by: Inha Song <ideal.song@samsung.com>
> > > ---
> > >  common/cmd_dfu.c              | 1 +
> > >  common/cmd_thordown.c         | 1 +
> > >  common/cmd_usb_mass_storage.c | 1 +
> > 
> > You missed fastboot at a minimum.
> 
> Ok, I will add board_usb_cleanup fuction also in fastboot.
> 
> > 
> > What about other gadget functions such as rndis/cdc_etherent?
> 
> I doesn't have any knowledge about rndis/cdc_etherent
> So, Afraid that to fix these code.

So that's the problem with this approach.  Kishon reminded me that on TI
parts we see some PM problems because we don't always do a cleanup on
the USB side for gadgets.  I think the right answer here is to mirror
the usb_stop() function in bootm_disable_interrupts() in common/bootm.c
for the gadget code as well.
diff mbox

Patch

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index e975abe..161d38b 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -68,6 +68,7 @@  static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 exit:
 	g_dnl_unregister();
+	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
 done:
 	dfu_free_entities();
 
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index 8ed1dc6..436b7f5 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -56,6 +56,7 @@  int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 exit:
 	g_dnl_unregister();
+	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
 done:
 	dfu_free_entities();
 
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 2c879ea..53a765e 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -154,6 +154,7 @@  int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 	}
 exit:
 	g_dnl_unregister();
+	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
 	return CMD_RET_SUCCESS;
 }