Message ID | 1553761801-2489-7-git-send-email-jun.nie@linaro.org |
---|---|
State | Superseded |
Delegated to: | Stefano Babic |
Headers | show |
Series | pico-imx7d: Add support for BL33 case | expand |
On Thu, Mar 28, 2019 at 5:34 AM Jun Nie <jun.nie@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@linaro.org> How this could not be defined? couldn't this to be fixed on kconfig to use it as default?
Otavio Salvador <otavio.salvador@ossystems.com.br> 于2019年3月28日周四 下午8:58写道: > > On Thu, Mar 28, 2019 at 5:34 AM Jun Nie <jun.nie@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@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
diff --git a/arch/arm/include/asm/arch-mx7/clock.h b/arch/arm/include/asm/arch-mx7/clock.h index f56564e..b6a1768 100644 --- a/arch/arm/include/asm/arch-mx7/clock.h +++ b/arch/arm/include/asm/arch-mx7/clock.h @@ -175,6 +175,11 @@ enum clk_root_index { CLK_ROOT_MAX, }; +/* Use UART1_CLK_ROOT as default root clk if platform does define it */ +#ifndef UART_CLK_ROOT +#define UART_CLK_ROOT UART1_CLK_ROOT +#endif + struct clk_root_setting { enum clk_root_index root; u32 setting; 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) diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 8eb9064..9806348 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -28,6 +28,7 @@ #define CONFIG_SYS_MALLOC_LEN (32 * SZ_1M) #define CONFIG_MXC_UART_BASE UART5_IPS_BASE_ADDR +#define UART_CLK_ROOT UART5_CLK_ROOT /* Network */ #define CONFIG_FEC_MXC
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@linaro.org> --- arch/arm/include/asm/arch-mx7/clock.h | 5 +++++ arch/arm/mach-imx/mx7/clock.c | 2 +- include/configs/pico-imx7d.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-)