1/*
2 * Copyright (c) 2021 Nuvoton Technology Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/dt-bindings/espi/npcx_espi.h>
8
9/*
10 *                Nuvoton NPCX eSPI Virtual Wires Mapping Table
11 * |--------------------------------------------------------------------------|
12 * | VW idx | SLV reg | Wire Bit 3   | Wire Bit 2   | Wire Bit 1| Wire Bit 0  |
13 * |--------------------------------------------------------------------------|
14 * |                 Input (Master-to-Slave) Virtual Wires                    |
15 * |--------------------------------------------------------------------------|
16 * | 02h[S] | VWEVMS0 | Reserved     | SLP_S5#      | SLP_S4#   | SLP_S3#     |
17 * | 03h[S] | VWEVMS1 | Reserved     | OOB_RST_WARN | PLTRST#   | SUS_STAT#   |
18 * | 07h[S] | VWEVMS2 | Reserved     | Reserved     | Reserved  | HOS_RST_WARN|
19 * | 41h[P] | VWEVMS3 | SLP_A#       | Reserved     | SUS_PDNACK| SUS_WARN#   |
20 * | 42h[P] | VWEVMS4 | Reserved     | Reserved     | SLP_WLAN# | SLP_LAN#    |
21 * |--------------------------------------------------------------------------|
22 * |                Output (Slave-to-Master) Virtual Wires                    |
23 * |--------------------------------------------------------------------------|
24 * | 04h[S] | VWEVSM0 | PME#         | WAKE#        | Reserved  | OOB_RST_ACK |
25 * | 05h[S] | VWEVSM1 | SLV_BOOT_STS | ERR_NONFATAL | ERR_FATAL | SLV_BT_DONE |
26 * | 06h[S] | VWEVSM2 | HOST_RST_ACK | Reserved     | SMI#      | SCI#        |
27 * | 40h[P] | VWEVSM3 | Reserved     | Reserved     | Reserved  | SUS_ACK#    |
28 * |--------------------------------------------------------------------------|
29 *  [S] System-/[P] Platform-Specific Virtual Wires
30 */
31
32/ {
33	npcx-espi-vws-map {
34		compatible = "nuvoton,npcx-espi-vw-conf";
35
36		/* eSPI Virtual Vire (VW) input configuration */
37		/* index 02h (In) */
38		vw-slp-s3 {
39			vw-reg = <NPCX_VWEVMS0 0x01>;
40			vw-wui = <&wui_vw_slp_s3>;
41		};
42		vw-slp-s4 {
43			vw-reg = <NPCX_VWEVMS0 0x02>;
44			vw-wui = <&wui_vw_slp_s4>;
45		};
46		vw-slp-s5 {
47			vw-reg = <NPCX_VWEVMS0 0x04>;
48			vw-wui = <&wui_vw_slp_s5>;
49		};
50
51		/* index 03h (In) */
52		vw-sus-stat {
53			vw-reg = <NPCX_VWEVMS1 0x01>;
54			vw-wui = <&wui_vw_sus_stat>;
55		};
56		vw-plt-rst {
57			vw-reg = <NPCX_VWEVMS1 0x02>;
58			vw-wui = <&wui_vw_plt_rst>;
59		};
60		vw-oob-rst-warn {
61			vw-reg = <NPCX_VWEVMS1 0x04>;
62			vw-wui = <&wui_vw_oob_rst_warn>;
63		};
64
65		/* index 07h (In) */
66		vw-host-rst-warn {
67			vw-reg = <NPCX_VWEVMS2 0x01>;
68			vw-wui = <&wui_vw_host_rst_warn>;
69		};
70
71		/* index 41h (In) */
72		vw-sus-warn {
73			vw-reg = <NPCX_VWEVMS3 0x01>;
74			vw-wui = <&wui_vw_sus_warn>;
75		};
76		vw-sus-pwrdn-ack {
77			vw-reg = <NPCX_VWEVMS3 0x02>;
78			vw-wui = <&wui_vw_sus_pwrdn_ack>;
79		};
80		vw-slp-a {
81			vw-reg = <NPCX_VWEVMS3 0x08>;
82			vw-wui = <&wui_vw_slp_a>;
83		};
84
85		/* index 42h (In) */
86		vw-slp-lan {
87			vw-reg = <NPCX_VWEVMS4 0x01>;
88			vw-wui = <&wui_vw_slp_lan>;
89		};
90		vw-slp-wlan {
91			vw-reg = <NPCX_VWEVMS4 0x02>;
92			vw-wui = <&wui_vw_slp_wlan>;
93		};
94
95		/* eSPI Virtual Vire (VW) output configuration */
96		/* index 04h (Out) */
97		vw-oob-rst-ack {
98			vw-reg = <NPCX_VWEVSM0 0x01>;
99		};
100		vw-wake {
101			vw-reg = <NPCX_VWEVSM0 0x04>;
102		};
103		vw-pme {
104			vw-reg = <NPCX_VWEVSM0 0x08>;
105		};
106
107		/* index 05h (Out) */
108		vw-slv-boot-done {
109			vw-reg = <NPCX_VWEVSM1 0x01>;
110		};
111		vw-err-fatal {
112			vw-reg = <NPCX_VWEVSM1 0x02>;
113		};
114		vw-err-non-fatal {
115			vw-reg = <NPCX_VWEVSM1 0x04>;
116		};
117		vw-slv-boot-sts-with-done {
118			/*
119			 * SLAVE_BOOT_DONE & SLAVE_LOAD_STS bits (bit 0 & bit 3)
120			 * have to be sent together. Hence its bitmask is 0x09.
121			 */
122			vw-reg = <NPCX_VWEVSM1 0x09>;
123		};
124
125		/* index 06h (Out) */
126		vw-sci {
127			vw-reg = <NPCX_VWEVSM2 0x01>;
128		};
129		vw-smi {
130			vw-reg = <NPCX_VWEVSM2 0x02>;
131		};
132		vw-host-rst-ack {
133			vw-reg = <NPCX_VWEVSM2 0x08>;
134		};
135
136		/* index 40h (Out) */
137		vw-sus-ack {
138			vw-reg = <NPCX_VWEVSM3 0x01>;
139		};
140	};
141};
142