diff mbox series

[U-Boot,RFC,2/6] odroid: exynos: usb clean up for U3/X2

Message ID 20190401115232.453-3-linux.amoon@gmail.com
State RFC
Delegated to: Lukasz Majewski
Headers show
Series Odroid U3 usb initialization | expand

Commit Message

Anand Moon April 1, 2019, 11:52 a.m. UTC
Add board_usb_cleanup routine to cleanup after
de-registering it usb devices. Also fixed the
compilation error for other board.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
 board/samsung/common/board.c  | 4 ++--
 board/samsung/odroid/odroid.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Krzysztof Kozlowski April 1, 2019, 12:51 p.m. UTC | #1
On Mon, 1 Apr 2019 at 13:52, Anand Moon <linux.amoon@gmail.com> wrote:
>
> Add board_usb_cleanup routine to cleanup after
> de-registering it usb devices. Also fixed the
> compilation error for other board.

Fix for build error should be in separate commit. Please also quote
the error you are fixing... because the code compiles fine in my case.

> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
>  board/samsung/common/board.c  | 4 ++--
>  board/samsung/odroid/odroid.c | 5 +++++
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> index 9adbd1e2cf..c74aca9b0a 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -351,10 +351,10 @@ void reset_misc(void)
>         }
>  }
>
> +#ifdef CONFIG_USB_DWC3
>  int board_usb_cleanup(int index, enum usb_init_type init)
>  {
> -#ifdef CONFIG_USB_DWC3
>         dwc3_uboot_exit(index);
> -#endif
>         return 0;
>  }
> +#endif
> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> index 79d14ead01..547ae698cf 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
>         debug("USB_udc_probe\n");
>         return dwc2_udc_probe(&s5pc210_otg_data);
>  }
> +
> +int board_usb_cleanup(int index, enum usb_init_type init)
> +{
> +       return s5pc210_phy_control(index);

Why you pass index of USB controller as argument "int on"? Index != on...

Best regards,
Krzysztof
Anand Moon April 1, 2019, 3:57 p.m. UTC | #2
Hi Krzysztof,

On Mon, 1 Apr 2019 at 18:21, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Mon, 1 Apr 2019 at 13:52, Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Add board_usb_cleanup routine to cleanup after
> > de-registering it usb devices. Also fixed the
> > compilation error for other board.
>
> Fix for build error should be in separate commit. Please also quote
> the error you are fixing... because the code compiles fine in my case.
>

Compilation error happens on other target boards. like Odroid-XU3

> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> >  board/samsung/common/board.c  | 4 ++--
> >  board/samsung/odroid/odroid.c | 5 +++++
> >  2 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> > index 9adbd1e2cf..c74aca9b0a 100644
> > --- a/board/samsung/common/board.c
> > +++ b/board/samsung/common/board.c
> > @@ -351,10 +351,10 @@ void reset_misc(void)
> >         }
> >  }
> >
> > +#ifdef CONFIG_USB_DWC3
> >  int board_usb_cleanup(int index, enum usb_init_type init)
> >  {
> > -#ifdef CONFIG_USB_DWC3
> >         dwc3_uboot_exit(index);
> > -#endif
> >         return 0;
> >  }
> > +#endif
> > diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> > index 79d14ead01..547ae698cf 100644
> > --- a/board/samsung/odroid/odroid.c
> > +++ b/board/samsung/odroid/odroid.c
> > @@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
> >         debug("USB_udc_probe\n");
> >         return dwc2_udc_probe(&s5pc210_otg_data);
> >  }
> > +
> > +int board_usb_cleanup(int index, enum usb_init_type init)
> > +{
> > +       return s5pc210_phy_control(index);
>
> Why you pass index of USB controller as argument "int on"? Index != on...
>

Generally board_usb_cleanup do cleanup the index of the board_usb_init,
so I use this naturally. I will check and update this if needed.

> Best regards,
> Krzysztof

Best Regards
-Anand
Krzysztof Kozlowski April 1, 2019, 4:12 p.m. UTC | #3
On Mon, 1 Apr 2019 at 17:57, Anand Moon <linux.amoon@gmail.com> wrote:
>
> Hi Krzysztof,
>
> On Mon, 1 Apr 2019 at 18:21, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> > On Mon, 1 Apr 2019 at 13:52, Anand Moon <linux.amoon@gmail.com> wrote:
> > >
> > > Add board_usb_cleanup routine to cleanup after
> > > de-registering it usb devices. Also fixed the
> > > compilation error for other board.
> >
> > Fix for build error should be in separate commit. Please also quote
> > the error you are fixing... because the code compiles fine in my case.
> >
>
> Compilation error happens on other target boards. like Odroid-XU3

OK, please quote it and fix the error in separate commit.

>
> > > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > > ---
> > >  board/samsung/common/board.c  | 4 ++--
> > >  board/samsung/odroid/odroid.c | 5 +++++
> > >  2 files changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> > > index 9adbd1e2cf..c74aca9b0a 100644
> > > --- a/board/samsung/common/board.c
> > > +++ b/board/samsung/common/board.c
> > > @@ -351,10 +351,10 @@ void reset_misc(void)
> > >         }
> > >  }
> > >
> > > +#ifdef CONFIG_USB_DWC3
> > >  int board_usb_cleanup(int index, enum usb_init_type init)
> > >  {
> > > -#ifdef CONFIG_USB_DWC3
> > >         dwc3_uboot_exit(index);
> > > -#endif
> > >         return 0;
> > >  }
> > > +#endif
> > > diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> > > index 79d14ead01..547ae698cf 100644
> > > --- a/board/samsung/odroid/odroid.c
> > > +++ b/board/samsung/odroid/odroid.c
> > > @@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
> > >         debug("USB_udc_probe\n");
> > >         return dwc2_udc_probe(&s5pc210_otg_data);
> > >  }
> > > +
> > > +int board_usb_cleanup(int index, enum usb_init_type init)
> > > +{
> > > +       return s5pc210_phy_control(index);
> >
> > Why you pass index of USB controller as argument "int on"? Index != on...
> >
>
> Generally board_usb_cleanup do cleanup the index of the board_usb_init,
> so I use this naturally. I will check and update this if needed.

But s5pc210_phy_control not. Your comment does not really address my concerns...

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 9adbd1e2cf..c74aca9b0a 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -351,10 +351,10 @@  void reset_misc(void)
 	}
 }
 
+#ifdef CONFIG_USB_DWC3
 int board_usb_cleanup(int index, enum usb_init_type init)
 {
-#ifdef CONFIG_USB_DWC3
 	dwc3_uboot_exit(index);
-#endif
 	return 0;
 }
+#endif
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 79d14ead01..547ae698cf 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -538,4 +538,9 @@  int board_usb_init(int index, enum usb_init_type init)
 	debug("USB_udc_probe\n");
 	return dwc2_udc_probe(&s5pc210_otg_data);
 }
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	return s5pc210_phy_control(index);
+}
 #endif