1 /*
2  * Copyright (c) 2022-2023 Synopsys
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/arch/arc/cluster.h>
8 #include <zephyr/devicetree.h>
9 #include <zephyr/init.h>
10 
11 #define DT_SRAM_NODE_ADDR		(DT_REG_ADDR(DT_CHOSEN(zephyr_sram)) / (1024 * 1024))
12 #define DT_SRAM_NODE_SIZE		(DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) / (1024 * 1024))
13 
haps_arcv3_init(void)14 static int haps_arcv3_init(void)
15 {
16 	arc_cln_write_reg_nolock(ARC_CLN_PER0_BASE, 0xF00);
17 	arc_cln_write_reg_nolock(ARC_CLN_PER0_SIZE, 1);
18 
19 	arc_cln_write_reg_nolock(ARC_CLN_MST_NOC_0_0_ADDR, DT_SRAM_NODE_ADDR);
20 	arc_cln_write_reg_nolock(ARC_CLN_MST_NOC_0_0_SIZE, DT_SRAM_NODE_SIZE);
21 
22 	return 0;
23 }
24 
25 
26 SYS_INIT(haps_arcv3_init, PRE_KERNEL_1, 0);
27