1 /*
2  * Copyright 2020 Broadcom
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/device.h>
8 #include <zephyr/init.h>
9 #include <soc.h>
10 #include <zephyr/arch/cpu.h>
11 
12 /**
13  * @brief Perform basic hardware initialization at boot.
14  *
15  * This needs to be run from the very beginning.
16  * So the init priority has to be 0 (zero).
17  *
18  * @return 0
19  */
viper_init(void)20 static int viper_init(void)
21 {
22 	uint32_t key;
23 	uint32_t data;
24 
25 
26 	key = irq_lock();
27 
28 	/* pcie pmon lite init */
29 	data = sys_read32(LS_ICFG_PMON_LITE_CLK_CTRL);
30 	data |= PCIE_PMON_LITE_CLK_ENABLE;
31 	sys_write32(data, LS_ICFG_PMON_LITE_CLK_CTRL);
32 
33 	data = sys_read32(LS_ICFG_PMON_LITE_SW_RESETN);
34 	data |= PCIE_PMON_LITE_SW_RESETN;
35 	sys_write32(data, LS_ICFG_PMON_LITE_SW_RESETN);
36 
37 	irq_unlock(key);
38 
39 	return 0;
40 }
41 
42 SYS_INIT(viper_init, PRE_KERNEL_1, 0);
43