1 /*
2  * Copyright (c) 2023 Nuvoton Technology Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef _NUVOTON_NPCX_SOC_H_
8 #define _NUVOTON_NPCX_SOC_H_
9 
10 #include <cmsis_core_m_defaults.h>
11 
12 /* NPCX4 SCFG multi-registers */
13 #define NPCX_DEVALT_OFFSET(n)		(0x010 + n)
14 #define NPCX_PUPD_EN_OFFSET(n)		(0x02b + n)
15 #define NPCX_LV_GPIO_CTL_OFFSET(n)	(0x150 + n)
16 #define NPCX_DEVALT_LK_OFFSET(n)	(0x210 + n)
17 
18 /* NPCX4 MIWU multi-registers */
19 #define NPCX_WKEDG_OFFSET(n)		(0x000 + (n * 0x010))
20 #define NPCX_WKAEDG_OFFSET(n)		(0x001 + (n * 0x010))
21 #define NPCX_WKMOD_OFFSET(n)		(0x002 + (n * 0x010))
22 #define NPCX_WKPND_OFFSET(n)		(0x003 + (n * 0x010))
23 #define NPCX_WKPCL_OFFSET(n)		(0x004 + (n * 0x010))
24 #define NPCX_WKEN_OFFSET(n)		(0x005 + (n * 0x010))
25 #define NPCX_WKST_OFFSET(n)		(0x006 + (n * 0x010))
26 #define NPCX_WKINEN_OFFSET(n)		(0x007 + (n * 0x010))
27 
28 /* NPCX4 ADC multi-registers */
29 #define NPCX_CHNDAT_OFFSET(n)		(0x040 + n * 2)
30 #define NPCX_THRCTL_OFFSET(n)		(0x080 + n * 2)
31 #define NPCX_THEN_OFFSET		0x090
32 #define THEN(base)			(*(volatile uint16_t *)(base + NPCX_THEN_OFFSET))
33 
34 /* NPCX4 ADC register fields */
35 #define NPCX_THRCTL_L_H			15
36 #define NPCX_THRCTL_CHNSEL		FIELD(10, 5)
37 #define NPCX_THRCTL_THRVAL		FIELD(0, 10)
38 
39 /* NPCX4 FIU register fields */
40 #define NPCX_FIU_EXT_CFG_SPI1_2DEV	6
41 
42 /* NPCX4 supported group mask of DEVALT_LK */
43 #define NPCX_DEVALT_LK_GROUP_MASK \
44 	(BIT(0) | BIT(2) | BIT(3) | BIT(4) | \
45 	 BIT(5) | BIT(6) | BIT(11) | BIT(13) | \
46 	 BIT(15) | BIT(16) | BIT(17) | BIT(18) | \
47 	 BIT(19) | BIT(21))	/* DEVALT0_LK - DEVALTN_LK */
48 
49 /* NPCX4 Clock Configuration */
50 #define MAX_OFMCLK 120000000
51 
52 #include <reg/reg_access.h>
53 #include <reg/reg_def.h>
54 #include <soc_dt.h>
55 #include <soc_clock.h>
56 #include <soc_espi_taf.h>
57 #include <soc_pins.h>
58 #include <soc_power.h>
59 
60 #endif /* _NUVOTON_NPCX_SOC_H_ */
61