[U-Boot] [PATCH v2 6/6] pico-imx7d: Correct uart clock root

Jun Nie jun.nie at linaro.org
Wed Apr 3 11:02:13 UTC 2019


Otavio Salvador <otavio.salvador at ossystems.com.br> 于2019年3月28日周四 下午8:58写道:
>
> On Thu, Mar 28, 2019 at 5:34 AM Jun Nie <jun.nie at linaro.org> wrote:
> >
> > 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 <jun.nie at linaro.org>
>
> How this could not be defined? couldn't this to be fixed on kconfig to
> use it as default?

Sure, it can be fixed to a default value or string. I had tried to add
an IMX_UART_PORT config
option in Kconfig to dynamic configure the CLK_ROOT ID as below, the
expansion result is
UARTCONFIG_IMX_UART_PORT_CLK_ROOT instead of  UART1_CLK_ROOT.
It seems macro expansion happens before the inclusion of defconfig.

#define IMX_UART_CLK_ROOT     UART##CONFIG_IMX_CONS_ID##_CLK_ROOT

Do you see any better idea other than many definition if #if #elif as
below? Below code
is not beautiful, only usable.

+++ b/arch/arm/include/asm/arch-mx7/clock.h
@@ -175,6 +175,24 @@ enum clk_root_index {
        CLK_ROOT_MAX,
 };

+#if (CONFIG_IMX_CONS_ID == 1)
+#define UART_CLK_ROOT UART1_CLK_ROOT
+#elif (CONFIG_IMX_CONS_ID == 2)
+#define UART_CLK_ROOT UART2_CLK_ROOT
+#elif (CONFIG_IMX_CONS_ID == 3)
+#define UART_CLK_ROOT UART3_CLK_ROOT
+#elif (CONFIG_IMX_CONS_ID == 4)
+#define UART_CLK_ROOT UART4_CLK_ROOT
+#elif (CONFIG_IMX_CONS_ID == 5)
+#define UART_CLK_ROOT UART5_CLK_ROOT
+#elif (CONFIG_IMX_CONS_ID == 6)
+#define UART_CLK_ROOT UART6_CLK_ROOT
+#elif (CONFIG_IMX_CONS_ID == 7)
+#define UART_CLK_ROOT UART7_CLK_ROOT
+#else
+#error "Invalid IMX console ID is defined"
+#endif

Best Regards.
Jun


>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750


More information about the U-Boot mailing list