Re: [U-Boot] [PATCH v3 4/9] pico-imx7d: Correct uart clock root

2019-04-25 Thread Jun Nie
Fabio Estevam  于2019年4月24日周三 下午6:32写道:
>
> On Wed, Apr 24, 2019 at 1:00 AM Jun Nie  wrote:
>
> > +config IMX_CONSOLE_UART_ID
> > +   int "UART ID for console"
> > +   default 1
> > +   depends on ARCH_MX7
> > +   help
> > + Specify the UART ID that's for serial console.
>
> We don't need this after DM conversion, right?

Supposed so.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/9] pico-imx7d: Correct uart clock root

2019-04-24 Thread Fabio Estevam
On Wed, Apr 24, 2019 at 1:00 AM Jun Nie  wrote:

> +config IMX_CONSOLE_UART_ID
> +   int "UART ID for console"
> +   default 1
> +   depends on ARCH_MX7
> +   help
> + Specify the UART ID that's for serial console.

We don't need this after DM conversion, right?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/9] pico-imx7d: Correct uart clock root

2019-04-24 Thread Jun Nie
Peng Fan  于2019年4月24日周三 下午1:15写道:
>
>
> > Subject: [PATCH v3 4/9] pico-imx7d: Correct uart clock root
> >
> > Correct uart clock root ID. Incorrect ID may result the clock is gated 
> > because
> > rate value 0 is returned in
> > imx_get_uartclk()
>
> Yes. hardcoding to UART1_ROOT_CLK in imx_get_uartclk is not good.
> But actually init_clk_uart configures all the uart with same root clk,
> so it should work as expected.

Right, but init_clk_uart is not called in SKIP_LOWLEVEL_INIT case.
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
cpu_init_crit() ->  lowlevel_init() -> s_init() -> clock_init() ->
init_clk_uart()
#endif

>
> Regards,
> Peng.
>
> >
> > Signed-off-by: Jun Nie 
> > ---
> >  arch/arm/include/asm/arch-mx7/clock.h | 18 ++
> >  arch/arm/mach-imx/Kconfig |  7 +++
> >  arch/arm/mach-imx/mx7/clock.c |  2 +-
> >  3 files changed, 26 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/include/asm/arch-mx7/clock.h
> > b/arch/arm/include/asm/arch-mx7/clock.h
> > index f56564e..dc9 100644
> > --- a/arch/arm/include/asm/arch-mx7/clock.h
> > +++ b/arch/arm/include/asm/arch-mx7/clock.h
> > @@ -175,6 +175,24 @@ enum clk_root_index {
> >   CLK_ROOT_MAX,
> >  };
> >
> > +#if (CONFIG_IMX_CONSOLE_UART_ID == 1)
> > +#define UART_CLK_ROOT UART1_CLK_ROOT
> > +#elif (CONFIG_IMX_CONSOLE_UART_ID == 2) #define UART_CLK_ROOT
> > +UART2_CLK_ROOT #elif (CONFIG_IMX_CONSOLE_UART_ID == 3) #define
> > +UART_CLK_ROOT UART3_CLK_ROOT #elif
> > (CONFIG_IMX_CONSOLE_UART_ID == 4)
> > +#define UART_CLK_ROOT UART4_CLK_ROOT #elif
> > (CONFIG_IMX_CONSOLE_UART_ID
> > +== 5) #define UART_CLK_ROOT UART5_CLK_ROOT #elif
> > +(CONFIG_IMX_CONSOLE_UART_ID == 6) #define UART_CLK_ROOT
> > UART6_CLK_ROOT
> > +#elif (CONFIG_IMX_CONSOLE_UART_ID == 7) #define UART_CLK_ROOT
> > +UART7_CLK_ROOT #else #error "Invalid IMX UART ID for serial console is
> > +defined"
> > +#endif
> > +
> >  struct clk_root_setting {
> >   enum clk_root_index root;
> >   u32 setting;
> > diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index
> > ec09ef2..7c5db30 100644
> > --- a/arch/arm/mach-imx/Kconfig
> > +++ b/arch/arm/mach-imx/Kconfig
> > @@ -27,6 +27,13 @@ config IMX_BOOTAUX
> >   help
> > bootaux [addr] to boot auxiliary core.
> >
> > +config IMX_CONSOLE_UART_ID
> > + int "UART ID for console"
> > + default 1
> > + depends on ARCH_MX7
> > + help
> > +   Specify the UART ID that's for serial console.
> > +
> >  config USE_IMXIMG_PLUGIN
> >   bool "Use imximage plugin code"
> >   depends on ARCH_MX7 || ARCH_MX6
> > diff --git a/arch/arm/mach-imx/mx7/clock.c
> > b/arch/arm/mach-imx/mx7/clock.c index 8cda71c..e364b16 100644
> > --- a/arch/arm/mach-imx/mx7/clock.c
> > +++ b/arch/arm/mach-imx/mx7/clock.c
> > @@ -53,7 +53,7 @@ static u32 get_ipg_clk(void)
> >
> >  u32 imx_get_uartclk(void)
> >  {
> > - return get_root_clk(UART1_CLK_ROOT);
> > + return get_root_clk(UART_CLK_ROOT);
> >  }
> >
> >  u32 imx_get_fecclk(void)
> > --
> > 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/9] pico-imx7d: Correct uart clock root

2019-04-23 Thread Peng Fan

> Subject: [PATCH v3 4/9] pico-imx7d: Correct uart clock root
> 
> Correct uart clock root ID. Incorrect ID may result the clock is gated because
> rate value 0 is returned in
> imx_get_uartclk()

Yes. hardcoding to UART1_ROOT_CLK in imx_get_uartclk is not good.
But actually init_clk_uart configures all the uart with same root clk,
so it should work as expected.

Regards,
Peng.

> 
> Signed-off-by: Jun Nie 
> ---
>  arch/arm/include/asm/arch-mx7/clock.h | 18 ++
>  arch/arm/mach-imx/Kconfig |  7 +++
>  arch/arm/mach-imx/mx7/clock.c |  2 +-
>  3 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/arch-mx7/clock.h
> b/arch/arm/include/asm/arch-mx7/clock.h
> index f56564e..dc9 100644
> --- a/arch/arm/include/asm/arch-mx7/clock.h
> +++ b/arch/arm/include/asm/arch-mx7/clock.h
> @@ -175,6 +175,24 @@ enum clk_root_index {
>   CLK_ROOT_MAX,
>  };
> 
> +#if (CONFIG_IMX_CONSOLE_UART_ID == 1)
> +#define UART_CLK_ROOT UART1_CLK_ROOT
> +#elif (CONFIG_IMX_CONSOLE_UART_ID == 2) #define UART_CLK_ROOT
> +UART2_CLK_ROOT #elif (CONFIG_IMX_CONSOLE_UART_ID == 3) #define
> +UART_CLK_ROOT UART3_CLK_ROOT #elif
> (CONFIG_IMX_CONSOLE_UART_ID == 4)
> +#define UART_CLK_ROOT UART4_CLK_ROOT #elif
> (CONFIG_IMX_CONSOLE_UART_ID
> +== 5) #define UART_CLK_ROOT UART5_CLK_ROOT #elif
> +(CONFIG_IMX_CONSOLE_UART_ID == 6) #define UART_CLK_ROOT
> UART6_CLK_ROOT
> +#elif (CONFIG_IMX_CONSOLE_UART_ID == 7) #define UART_CLK_ROOT
> +UART7_CLK_ROOT #else #error "Invalid IMX UART ID for serial console is
> +defined"
> +#endif
> +
>  struct clk_root_setting {
>   enum clk_root_index root;
>   u32 setting;
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index
> ec09ef2..7c5db30 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -27,6 +27,13 @@ config IMX_BOOTAUX
>   help
> bootaux [addr] to boot auxiliary core.
> 
> +config IMX_CONSOLE_UART_ID
> + int "UART ID for console"
> + default 1
> + depends on ARCH_MX7
> + help
> +   Specify the UART ID that's for serial console.
> +
>  config USE_IMXIMG_PLUGIN
>   bool "Use imximage plugin code"
>   depends on ARCH_MX7 || ARCH_MX6
> diff --git a/arch/arm/mach-imx/mx7/clock.c
> b/arch/arm/mach-imx/mx7/clock.c index 8cda71c..e364b16 100644
> --- a/arch/arm/mach-imx/mx7/clock.c
> +++ b/arch/arm/mach-imx/mx7/clock.c
> @@ -53,7 +53,7 @@ static u32 get_ipg_clk(void)
> 
>  u32 imx_get_uartclk(void)
>  {
> - return get_root_clk(UART1_CLK_ROOT);
> + return get_root_clk(UART_CLK_ROOT);
>  }
> 
>  u32 imx_get_fecclk(void)
> --
> 2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 4/9] pico-imx7d: Correct uart clock root

2019-04-23 Thread Jun Nie
Correct uart clock root ID. Incorrect ID may result the
clock is gated because rate value 0 is returned in
imx_get_uartclk()

Signed-off-by: Jun Nie 
---
 arch/arm/include/asm/arch-mx7/clock.h | 18 ++
 arch/arm/mach-imx/Kconfig |  7 +++
 arch/arm/mach-imx/mx7/clock.c |  2 +-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-mx7/clock.h 
b/arch/arm/include/asm/arch-mx7/clock.h
index f56564e..dc9 100644
--- a/arch/arm/include/asm/arch-mx7/clock.h
+++ b/arch/arm/include/asm/arch-mx7/clock.h
@@ -175,6 +175,24 @@ enum clk_root_index {
CLK_ROOT_MAX,
 };
 
+#if (CONFIG_IMX_CONSOLE_UART_ID == 1)
+#define UART_CLK_ROOT UART1_CLK_ROOT
+#elif (CONFIG_IMX_CONSOLE_UART_ID == 2)
+#define UART_CLK_ROOT UART2_CLK_ROOT
+#elif (CONFIG_IMX_CONSOLE_UART_ID == 3)
+#define UART_CLK_ROOT UART3_CLK_ROOT
+#elif (CONFIG_IMX_CONSOLE_UART_ID == 4)
+#define UART_CLK_ROOT UART4_CLK_ROOT
+#elif (CONFIG_IMX_CONSOLE_UART_ID == 5)
+#define UART_CLK_ROOT UART5_CLK_ROOT
+#elif (CONFIG_IMX_CONSOLE_UART_ID == 6)
+#define UART_CLK_ROOT UART6_CLK_ROOT
+#elif (CONFIG_IMX_CONSOLE_UART_ID == 7)
+#define UART_CLK_ROOT UART7_CLK_ROOT
+#else
+#error "Invalid IMX UART ID for serial console is defined"
+#endif
+
 struct clk_root_setting {
enum clk_root_index root;
u32 setting;
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ec09ef2..7c5db30 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
help
  bootaux [addr] to boot auxiliary core.
 
+config IMX_CONSOLE_UART_ID
+   int "UART ID for console"
+   default 1
+   depends on ARCH_MX7
+   help
+ Specify the UART ID that's for serial console.
+
 config USE_IMXIMG_PLUGIN
bool "Use imximage plugin code"
depends on ARCH_MX7 || ARCH_MX6
diff --git a/arch/arm/mach-imx/mx7/clock.c b/arch/arm/mach-imx/mx7/clock.c
index 8cda71c..e364b16 100644
--- a/arch/arm/mach-imx/mx7/clock.c
+++ b/arch/arm/mach-imx/mx7/clock.c
@@ -53,7 +53,7 @@ static u32 get_ipg_clk(void)
 
 u32 imx_get_uartclk(void)
 {
-   return get_root_clk(UART1_CLK_ROOT);
+   return get_root_clk(UART_CLK_ROOT);
 }
 
 u32 imx_get_fecclk(void)
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot