xref: /rk3399_ARM-atf/plat/imx/common/imx7_clock.c (revision 5ff1751d07f971e9362cf8d252cd68f24ab4f35f)
1 /*
2  * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #include <imx_regs.h>
7 #include <imx_clock.h>
8 
9 static void imx7_clock_uart_init(void)
10 {
11 	unsigned int i;
12 
13 	for (i = 0; i < MXC_MAX_UART_NUM; i++)
14 		imx_clock_disable_uart(i);
15 }
16 
17 static void imx7_clock_wdog_init(void)
18 {
19 	unsigned int i;
20 
21 	for (i = 0; i < MXC_MAX_WDOG_NUM; i++)
22 		imx_clock_disable_wdog(i);
23 }
24 
25 void imx_clock_init(void)
26 {
27 	/*
28 	 * The BootROM hands off to the next stage with the internal 24 MHz XTAL
29 	 * crystal already clocking the main PLL, which is very handy.
30 	 * Here we should enable whichever peripherals are required for ATF and
31 	 * OPTEE.
32 	 *
33 	 * Subsequent stages in the boot process such as u-boot and Linux
34 	 * already have a significant and mature code-base around clocks, so our
35 	 * objective should be to enable what we need for ATF/OPTEE without
36 	 * breaking any existing upstream code in Linux and u-boot.
37 	 */
38 
39 	/* Initialize UART clocks */
40 	imx7_clock_uart_init();
41 
42 	/* Watchdog clocks */
43 	imx7_clock_wdog_init();
44 }
45