From 64b5f469756f915cd223a0d8e807cb542a52666c Mon Sep 17 00:00:00 2001 From: Anatolij Gustschin Date: Wed, 12 Jun 2019 13:35:25 +0200 Subject: arm: imx8: factor out uart init code New imx8 boards started adding duplicated UART init code. Factor out this to common function sc_pm_setup_uart(). Signed-off-by: Anatolij Gustschin Cc: Peng Fan Cc: Marcel Ziswiler Reviewed-by: Peng Fan Reviewed-by: Peng Fan --- board/freescale/imx8qm_mek/imx8qm_mek.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'board/freescale/imx8qm_mek/imx8qm_mek.c') diff --git a/board/freescale/imx8qm_mek/imx8qm_mek.c b/board/freescale/imx8qm_mek/imx8qm_mek.c index e69efc4dd6..249c29e0f2 100644 --- a/board/freescale/imx8qm_mek/imx8qm_mek.c +++ b/board/freescale/imx8qm_mek/imx8qm_mek.c @@ -34,21 +34,11 @@ static void setup_iomux_uart(void) int board_early_init_f(void) { + sc_pm_clock_rate_t rate = SC_80MHZ; int ret; - /* Set UART0 clock root to 80 MHz */ - sc_pm_clock_rate_t rate = 80000000; - - /* Power up UART0 */ - ret = sc_pm_set_resource_power_mode(-1, SC_R_UART_0, SC_PM_PW_MODE_ON); - if (ret) - return ret; - ret = sc_pm_set_clock_rate(-1, SC_R_UART_0, 2, &rate); - if (ret) - return ret; - - /* Enable UART0 clock root */ - ret = sc_pm_clock_enable(-1, SC_R_UART_0, 2, true, false); + /* Set UART0 clock root to 80 MHz */ + ret = sc_pm_setup_uart(SC_R_UART_0, rate); if (ret) return ret; -- cgit