1 /*
2  * Copyright 2020 Broadcom
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <device.h>
8 #include <init.h>
9 #include <soc.h>
10 #include <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(const struct device * arg)20 static int viper_init(const struct device *arg)
21 {
22 	uint32_t key;
23 	uint32_t data;
24 
25 	ARG_UNUSED(arg);
26 
27 	key = irq_lock();
28 
29 	/* pcie pmon lite init */
30 	data = sys_read32(LS_ICFG_PMON_LITE_CLK_CTRL);
31 	data |= PCIE_PMON_LITE_CLK_ENABLE;
32 	sys_write32(data, LS_ICFG_PMON_LITE_CLK_CTRL);
33 
34 	data = sys_read32(LS_ICFG_PMON_LITE_SW_RESETN);
35 	data |= PCIE_PMON_LITE_SW_RESETN;
36 	sys_write32(data, LS_ICFG_PMON_LITE_SW_RESETN);
37 
38 	irq_unlock(key);
39 
40 	return 0;
41 }
42 
43 SYS_INIT(viper_init, PRE_KERNEL_1, 0);
44