1/*
2 * Copyright (c) 2023 Nuvoton Technology Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/* npcx4 series pinmux mapping table */
8#include "npcx4/npcx4-alts-map.dtsi"
9/* npcx4 series mapping table between MIWU wui bits and source device */
10#include "npcx4/npcx4-miwus-wui-map.dtsi"
11/* npcx4 series mapping table between MIWU groups and interrupts */
12#include "npcx4/npcx4-miwus-int-map.dtsi"
13/* npcx4 series eSPI VW mapping table */
14#include "npcx4/npcx4-espi-vws-map.dtsi"
15/* npcx4 series low-voltage io controls mapping table */
16#include "npcx4/npcx4-lvol-ctrl-map.dtsi"
17/* npcx4 series reset mapping table */
18#include "zephyr/dt-bindings/reset/npcx4_reset.h"
19
20/* Device tree declarations of npcx soc family */
21#include "npcx.dtsi"
22
23/ {
24	cpus {
25		cpu0: cpu@0 {
26			cpu-power-states = <&suspend_to_idle0>;
27		};
28
29		power-states {
30			suspend_to_idle0: suspend-to-idle0 {
31				compatible = "zephyr,power-state";
32				power-state-name = "suspend-to-idle";
33				substate-id = <0>;
34				min-residency-us = <1000>;
35			};
36		};
37	};
38
39	def-io-conf-list {
40		pinmux = <&alt0_gpio_no_spip
41			  &alt0_gpio_no_fpip
42			  &alt1_no_pwrgd
43			  &alt7_no_ksi0_sl
44			  &alt7_no_ksi1_sl
45			  &alt7_no_ksi2_sl
46			  &alt7_no_ksi3_sl
47			  &alt7_no_ksi4_sl
48			  &alt7_no_ksi5_sl
49			  &alt7_no_ksi6_sl
50			  &alt7_no_ksi7_sl
51			  &alt8_no_kso00_sl
52			  &alt8_no_kso01_sl
53			  &alt8_no_kso02_sl
54			  &alt8_no_kso03_sl
55			  &alt8_no_kso04_sl
56			  &alt8_no_kso05_sl
57			  &alt8_no_kso06_sl
58			  &alt8_no_kso07_sl
59			  &alt9_no_kso08_sl
60			  &alt9_no_kso09_sl
61			  &alt9_no_kso10_sl
62			  &alt9_no_kso11_sl
63			  &alt9_no_kso12_sl
64			  &alt9_no_kso13_sl
65			  &alt9_no_kso14_sl
66			  &alt9_no_kso15_sl
67			  &alta_no_kso16_sl
68			  &alta_no_kso17_sl
69			  &alta_no_peci_en
70			  &altc_gpio97_sl_inv
71			  &altd_npsl_in1_sl
72			  &altd_npsl_in2_sl
73			  &altd_psl_in3_sl
74			  &altd_psl_in4_sl
75			  &altg_psl_gpo_sl>;
76	};
77
78	soc {
79		compatible = "nuvoton,npcx4", "nuvoton,npcx", "simple-bus";
80
81		/*
82		 * Writing to BKUP_STS register might affect the value stored in
83		 * the first byte of the BBRAM.
84		 * Workaround it by not using the first byte of the BBRAM.
85		 * (See npcx4 Errata 2.27)
86		 */
87		bbram: bb-ram@400af001 {
88			compatible = "nuvoton,npcx-bbram";
89			reg = <0x400af001 0x7F
90			       0x400af100 0x1>;
91			reg-names = "memory", "status";
92		};
93
94		/* Specific soc devices in npcx4 series */
95		itims: timer@400b0000 {
96			compatible = "nuvoton,npcx-itim-timer";
97			reg = <0x400b0000 0x2000
98			       0x400be000 0x2000>;
99			reg-names = "evt_itim", "sys_itim";
100			clocks = <&pcc NPCX_CLOCK_BUS_LFCLK NPCX_PWDWN_CTL4 0
101				  &pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL7 5>;
102			interrupts = <28 1>; /* Event timer interrupt */
103		};
104
105		uart1: serial@400e0000 {
106			compatible = "nuvoton,npcx-uart";
107			/* Index 0: UART1 register, Index 1: MDMA1 register */
108			reg = <0x400E0000 0x2000 0x40011100 0x100>;
109			interrupts = <33 3>;
110			/* Index 0: UART1 clock, Index 1: MDMA1 clock */
111			clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL1 4
112				  &pcc NPCX_CLOCK_BUS_CORE NPCX_PWDWN_CTL9 0>;
113			uart-rx = <&wui_cr_sin1>;
114			status = "disabled";
115		};
116
117		uart2: serial@400e2000 {
118			compatible = "nuvoton,npcx-uart";
119			/* Index 0: UART2 register, Index 1: MDMA2 register */
120			reg = <0x400E2000 0x2000 0x40011200 0x100>;
121			interrupts = <32 3>;
122			clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL7 6>;
123			uart-rx = <&wui_cr_sin2>;
124			status = "disabled";
125		};
126
127		uart3: serial@400e4000 {
128			compatible = "nuvoton,npcx-uart";
129			/* Index 0: UART3 register, Index 1: MDMA3 register */
130			reg = <0x400E4000 0x2000 0x40011300 0x100>;
131			interrupts = <38 3>;
132			/* Index 0: UART3 clock, Index 1: MDMA3 clock */
133			clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL7 4
134				  &pcc NPCX_CLOCK_BUS_CORE NPCX_PWDWN_CTL9 2>;
135			uart-rx = <&wui_cr_sin3>;
136			status = "disabled";
137		};
138
139		uart4: serial@400e6000 {
140			compatible = "nuvoton,npcx-uart";
141			/* Index 0: UART4 register, Index 1: MDMA4 register */
142			reg = <0x400E6000 0x2000 0x40011400 0x100>;
143			interrupts = <39 3>;
144			/* Index 0: UART4 clock, Index 1: MDMA4 clock */
145			clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL7 3
146				  &pcc NPCX_CLOCK_BUS_CORE NPCX_PWDWN_CTL9 3>;
147			uart-rx = <&wui_cr_sin4>;
148			status = "disabled";
149		};
150
151		/* Default clock and power settings in npcx4 series */
152		pcc: clock-controller@4000d000 {
153			clock-frequency = <DT_FREQ_M(120)>; /* OFMCLK runs at 120MHz */
154			core-prescaler = <8>; /* CORE_CLK runs at 15MHz */
155			apb1-prescaler = <8>; /* APB1_CLK runs at 15MHz */
156			apb2-prescaler = <8>; /* APB2_CLK runs at 15MHz */
157			apb3-prescaler = <8>; /* APB3_CLK runs at 15MHz */
158			apb4-prescaler = <8>; /* APB4_CLK runs at 15MHz */
159			ram-pd-depth = <8>; /* Valid bit-depth of RAM_PDn reg */
160			pwdwn-ctl-val = <0xfb
161					 0xff
162					 0x1f /* No GDMA1_PD/GDMA2_PD */
163					 0xff
164					 0xfa
165					 0x7f /* No ESPI_PD */
166					 0xff
167					 0xcf>; /* No FIU_PD */
168		};
169
170		/* Wake-up input source mapping for GPIOs in npcx4 series */
171		gpio0: gpio@40081000 {
172			wui-maps = <&wui_io00 &wui_io01 &wui_io02 &wui_io03
173				    &wui_io04 &wui_io05 &wui_io06 &wui_io07>;
174
175			lvol-maps = <&lvol_io00 &lvol_io01 &lvol_io02 &lvol_io03
176				     &lvol_io04 &lvol_io05 &lvol_io06 &lvol_io07>;
177		};
178
179		gpio1: gpio@40083000 {
180			wui-maps = <&wui_io10 &wui_io11 &wui_io12 &wui_io13
181				    &wui_io14 &wui_io15 &wui_io16 &wui_io17>;
182
183			lvol-maps = <&lvol_io10 &lvol_io11 &lvol_none &lvol_io13
184				     &lvol_io14 &lvol_io15 &lvol_io16 &lvol_io17>;
185		};
186
187		gpio2: gpio@40085000 {
188			wui-maps = <&wui_io20 &wui_io21 &wui_io22 &wui_io23
189				    &wui_io24 &wui_io25 &wui_io26 &wui_io27>;
190
191			lvol-maps = <&lvol_io20 &lvol_io21 &lvol_io22 &lvol_io23
192				     &lvol_none &lvol_none &lvol_none &lvol_none>;
193		};
194
195		gpio3: gpio@40087000 {
196			wui-maps = <&wui_io30 &wui_io31 &wui_none &wui_io33
197				    &wui_io34 &wui_none &wui_io36 &wui_io37>;
198
199			lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_io33
200				     &lvol_io34 &lvol_none &lvol_io36 &lvol_io37>;
201		};
202
203		gpio4: gpio@40089000 {
204			wui-maps = <&wui_io40 &wui_io41 &wui_io42 &wui_io43
205				    &wui_io44 &wui_io45 &wui_io46 &wui_io47>;
206
207			lvol-maps = <&lvol_io40 &lvol_io41 &lvol_io42 &lvol_io43
208				     &lvol_io44 &lvol_io45 &lvol_none &lvol_none>;
209		};
210
211		gpio5: gpio@4008b000 {
212			wui-maps = <&wui_io50 &wui_io51 &wui_io52 &wui_io53
213				    &wui_io54 &wui_io55 &wui_io56 &wui_io57>;
214
215			lvol-maps = <&lvol_io50 &lvol_none &lvol_none &lvol_none
216				     &lvol_none &lvol_none &lvol_none &lvol_none>;
217		};
218
219		gpio6: gpio@4008d000 {
220			wui-maps = <&wui_io60 &wui_io61 &wui_io62 &wui_io63
221				    &wui_io64 &wui_none &wui_io66 &wui_io67>;
222
223			lvol-maps = <&lvol_io60 &lvol_io61 &lvol_io62 &lvol_io63
224				     &lvol_io64 &lvol_none &lvol_io66 &lvol_io67>;
225		};
226
227		gpio7: gpio@4008f000 {
228			wui-maps = <&wui_io70 &wui_none &wui_io72 &wui_io73
229				    &wui_io74 &wui_io75 &wui_io76 &wui_none>;
230
231			lvol-maps = <&lvol_io70 &lvol_none &lvol_io72 &lvol_io73
232				     &lvol_io74 &lvol_io75 &lvol_io76 &lvol_none>;
233		};
234
235		gpio8: gpio@40091000 {
236			wui-maps = <&wui_io80 &wui_io81 &wui_io82 &wui_io83
237				    &wui_none &wui_none &wui_none &wui_io87>;
238
239			lvol-maps = <&lvol_io80 &lvol_none &lvol_io82 &lvol_io83
240				     &lvol_none &lvol_none &lvol_none &lvol_io87>;
241		};
242
243		gpio9: gpio@40093000 {
244			wui-maps = <&wui_io90 &wui_io91 &wui_io92 &wui_io93
245				    &wui_io94 &wui_io95 &wui_io96 &wui_io97>;
246
247			lvol-maps = <&lvol_io90 &lvol_io91 &lvol_io92 &lvol_none
248				     &lvol_none &lvol_none &lvol_none &lvol_none>;
249		};
250
251		gpioa: gpio@40095000 {
252			wui-maps = <&wui_ioa0 &wui_ioa1 &wui_ioa2 &wui_ioa3
253				    &wui_ioa4 &wui_ioa5 &wui_ioa6 &wui_ioa7>;
254
255			lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none
256				     &lvol_none &lvol_none &lvol_none &lvol_none>;
257		};
258
259		gpiob: gpio@40097000 {
260			wui-maps = <&wui_iob0 &wui_iob1 &wui_iob2 &wui_iob3
261				    &wui_iob4 &wui_iob5 &wui_iob6 &wui_iob7>;
262
263			lvol-maps = <&lvol_none &lvol_iob1 &lvol_iob2 &lvol_iob3
264				     &lvol_iob4 &lvol_iob5 &lvol_iob6 &lvol_iob7>;
265		};
266
267		gpioc: gpio@40099000 {
268			wui-maps = <&wui_ioc0 &wui_ioc1 &wui_ioc2 &wui_ioc3
269				    &wui_ioc4 &wui_ioc5 &wui_ioc6 &wui_ioc7>;
270
271			lvol-maps = <&lvol_ioc0 &lvol_ioc1 &lvol_ioc2 &lvol_ioc3
272				     &lvol_ioc4 &lvol_ioc5 &lvol_ioc6 &lvol_ioc7>;
273		};
274
275		gpiod: gpio@4009b000 {
276			wui-maps = <&wui_iod0 &wui_iod1 &wui_iod2 &wui_iod3
277				    &wui_iod4 &wui_iod5 &wui_iod6 &wui_none>;
278
279			lvol-maps = <&lvol_iod0 &lvol_iod1 &lvol_iod2 &lvol_iod3
280				     &lvol_iod4 &lvol_iod5 &lvol_iod6 &lvol_none>;
281		};
282
283		gpioe: gpio@4009d000 {
284			wui-maps = <&wui_ioe0 &wui_ioe1 &wui_ioe2 &wui_ioe3
285				    &wui_ioe4 &wui_ioe5 &wui_none &wui_ioe7>;
286
287			lvol-maps = <&lvol_ioe0 &lvol_ioe1 &lvol_ioe2 &lvol_ioe3
288				     &lvol_ioe4 &lvol_ioe5 &lvol_none &lvol_ioe7>;
289		};
290
291		gpiof: gpio@4009f000 {
292			wui-maps = <&wui_iof0 &wui_iof1 &wui_iof2 &wui_iof3
293				    &wui_iof4 &wui_iof5 &wui_none &wui_none>;
294
295			lvol-maps = <&lvol_iof0 &lvol_iof1 &lvol_iof2 &lvol_iof3
296				     &lvol_iof4 &lvol_iof5 &lvol_none &lvol_none>;
297		};
298
299		/* I2c Controllers - Do not use them as i2c node directly */
300		i2c_ctrl0: i2c@40009000 {
301			compatible = "nuvoton,npcx-i2c-ctrl";
302			reg = <0x40009000 0x1000>;
303			interrupts = <13 3>;
304			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL3 0>;
305			smb-wui = <&wui_smb0>;
306			status = "disabled";
307		};
308
309		i2c_ctrl1: i2c@4000b000 {
310			compatible = "nuvoton,npcx-i2c-ctrl";
311			reg = <0x4000b000 0x1000>;
312			interrupts = <14 3>;
313			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL3 1>;
314			smb-wui = <&wui_smb1>;
315			status = "disabled";
316		};
317
318		i2c_ctrl2: i2c@400c0000 {
319			compatible = "nuvoton,npcx-i2c-ctrl";
320			reg = <0x400c0000 0x1000>;
321			interrupts = <36 3>;
322			clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL3 2>;
323			smb-wui = <&wui_smb2>;
324			status = "disabled";
325		};
326
327		i2c_ctrl3: i2c@400c2000 {
328			compatible = "nuvoton,npcx-i2c-ctrl";
329			reg = <0x400c2000 0x1000>;
330			interrupts = <37 3>;
331			clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL3 3>;
332			smb-wui = <&wui_smb3>;
333			status = "disabled";
334		};
335
336		i2c_ctrl4: i2c@40008000 {
337			compatible = "nuvoton,npcx-i2c-ctrl";
338			reg = <0x40008000 0x1000>;
339			interrupts = <19 3>;
340			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL3 4>;
341			smb-wui = <&wui_smb4>;
342			status = "disabled";
343		};
344
345		i2c_ctrl5: i2c@40017000 {
346			compatible = "nuvoton,npcx-i2c-ctrl";
347			reg = <0x40017000 0x1000>;
348			interrupts = <20 3>;
349			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL7 0>;
350			smb-wui = <&wui_smb5>;
351			status = "disabled";
352		};
353
354		i2c_ctrl6: i2c@40018000 {
355			compatible = "nuvoton,npcx-i2c-ctrl";
356			reg = <0x40018000 0x1000>;
357			interrupts = <16 3>;
358			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL7 1>;
359			smb-wui = <&wui_smb6>;
360			status = "disabled";
361		};
362
363		i2c_ctrl7: i2c@40019000 {
364			compatible = "nuvoton,npcx-i2c-ctrl";
365			reg = <0x40019000 0x1000>;
366			interrupts = <8 3>;
367			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL7 2>;
368			smb-wui = <&wui_smb7>;
369			status = "disabled";
370		};
371
372		/* ADC0 comparator configuration in npcx4 series */
373		adc0: adc@400d1000 {
374			channel-count = <26>;
375			threshold-count = <6>;
376		};
377
378		/* ADC1 which reference voltage is AVCC */
379		adc1: adc@400d5000 {
380			compatible = "nuvoton,npcx-adc";
381			#io-channel-cells = <1>;
382			reg = <0x400d5000 0x2000>;
383			interrupts = <22 3>;
384			clocks = <&pcc NPCX_CLOCK_BUS_APB1 NPCX_PWDWN_CTL4 3>;
385			vref-mv = <3300>;
386			channel-count = <26>;
387			threshold-count = <6>;
388			status = "disabled";
389		};
390
391		/* FIU0 configuration in npcx4 series */
392		qspi_fiu0: quadspi@40020000 {
393			clocks = <&pcc NPCX_CLOCK_BUS_FIU0 NPCX_PWDWN_CTL8 5>;
394		};
395
396		/* FIU1 configuration in npcx4 series */
397		qspi_fiu1: quadspi@40021000 {
398			compatible = "nuvoton,npcx-fiu-qspi";
399			#address-cells = <1>;
400			#size-cells = <0>;
401			reg = <0x40021000 0x1000>;
402			clocks = <&pcc NPCX_CLOCK_BUS_FIU0 NPCX_PWDWN_CTL8 6>;
403		};
404
405		sha0: sha@148 {
406			compatible = "nuvoton,npcx-sha";
407			reg = <0x148 0x4c>;
408			context-buffer-size = <240>;
409			status = "disabled";
410		};
411
412		shi0: shi@4000f000 {
413			compatible = "nuvoton,npcx-shi-enhanced";
414			reg = <0x4000f000 0x120>;
415			interrupts = <18 1>;
416			clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 1>;
417			status = "disabled";
418			buffer-rx-size = <128>;
419			buffer-tx-size = <128>;
420			shi-cs-wui =<&wui_io53>;
421		};
422
423		espi0: espi@4000a000 {
424			rx-plsize = <64>;
425			tx-plsize = <64>;
426
427			espi_taf: espitaf@4000a000 {
428				compatible = "nuvoton,npcx-espi-taf";
429				reg = <0x4000a000 0x2000>;
430				status = "disabled";
431			};
432		};
433
434		rctl: reset-controller@400c3100 {
435			compatible = "nuvoton,npcx-rst";
436			reg = <0x400c3100 0x14>;
437			#reset-cells = <1>;
438			status = "disabled";
439		};
440
441		i3c0: i3c@400f0000 {
442			compatible = "nuvoton,npcx-i3c";
443
444			/* reg[0]: I3C_1 register, reg[1]: MDMA5 register */
445			reg-names = "i3c1", "mdma5";
446			reg = <0x400f0000 0x2000>,
447			      <0x40011500 0x100>;
448
449			interrupts = <29 3>;
450
451			/* Reset controller */
452			resets = <&rctl NPCX_RESET_I3C_1>;
453
454			/* clk[0]: I3C source clock, clk[1]: timeout reference clock */
455			/* clk[2]: MDMA5 */
456			clock-names = "mclkd", "apb4", "mdma5";
457			clocks = <&pcc NPCX_CLOCK_BUS_MCLKD NPCX_PWDWN_CTL8 0>,
458				 <&pcc NPCX_CLOCK_BUS_APB4 0 0>,
459				 <&pcc NPCX_CLOCK_BUS_CORE NPCX_PWDWN_CTL9 4>;
460
461			status = "disabled";
462			#address-cells = <3>;
463			#size-cells = <0>;
464			instance-id = <0x00>;
465		};
466
467		i3c1: i3c@400f2000 {
468			compatible = "nuvoton,npcx-i3c";
469
470			/* reg[0]: I3C_2 register, reg[1]: MDMA6 register */
471			reg-names = "i3c2", "mdma6";
472			reg = <0x400f2000 0x2000>,
473			      <0x40011600 0x100>;
474
475			interrupts = <66 3>;
476
477			/* Reset controller */
478			resets = <&rctl NPCX_RESET_I3C_2>;
479
480			/* clk[0]: I3C source clock, clk[1]: timeout reference clock */
481			/* clk[2]: MDMA6 */
482			clock-names = "mclkd", "apb4", "mdma6";
483			clocks = <&pcc NPCX_CLOCK_BUS_MCLKD NPCX_PWDWN_CTL8 2>,
484				 <&pcc NPCX_CLOCK_BUS_APB4 0 0>,
485				 <&pcc NPCX_CLOCK_BUS_CORE NPCX_PWDWN_CTL9 5>;
486
487			status = "disabled";
488			#address-cells = <3>;
489			#size-cells = <0>;
490			instance-id = <0x10>;
491		};
492
493		i3c2: i3c@400f4000 {
494			compatible = "nuvoton,npcx-i3c";
495
496			/* reg[0]: I3C_3 register, reg[1]: MDMA7 register */
497			reg-names = "i3c1", "mdma7";
498			reg = <0x400f4000 0x2000>,
499			      <0x40011700 0x100>;
500
501			interrupts = <67 3>;
502
503			/* Reset controller */
504			resets = <&rctl NPCX_RESET_I3C_3>;
505
506			/* clk[0]: I3C source clock, clk[1]: timeout reference clock */
507			/* clk[2]: MDMA7 */
508			clock-names = "mclkd", "apb4", "mdma7";
509			clocks = <&pcc NPCX_CLOCK_BUS_MCLKD NPCX_PWDWN_CTL8 3>,
510				 <&pcc NPCX_CLOCK_BUS_APB4 0 0>,
511				 <&pcc NPCX_CLOCK_BUS_CORE NPCX_PWDWN_CTL9 6>;
512
513			status = "disabled";
514			#address-cells = <3>;
515			#size-cells = <0>;
516			instance-id = <0x20>;
517		};
518	};
519
520	soc-if {
521		i2c4_0: io_i2c_ctrl4_port0 {
522			compatible = "nuvoton,npcx-i2c-port";
523			#address-cells = <1>;
524			#size-cells = <0>;
525			port = <NPCX_I2C_CTRL_PORT(4, 0)>;
526			controller = <&i2c_ctrl4>;
527			status = "disabled";
528		};
529
530		i2c7_1: io_i2c_ctrl7_port1 {
531			compatible = "nuvoton,npcx-i2c-port";
532			#address-cells = <1>;
533			#size-cells = <0>;
534			port = <NPCX_I2C_CTRL_PORT(7, 1)>;
535			controller = <&i2c_ctrl7>;
536			status = "disabled";
537		};
538	};
539
540	soc-id {
541		family-id = <0x23>;
542		chip-id = <0x0a>;
543		revision-reg = <0x0000FFFC 4>;
544	};
545};
546