File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
soc/nuvoton/npcx/common/npcxn/include Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,19 @@ config ESPI_NPCX_PERIPHERAL_DEBUG_PORT_80_RING_BUF_SIZE
60
60
The size of the ring buffer in byte used by the Port80 ISR to store
61
61
Postcodes from Host.
62
62
63
+ config ESPI_NPCX_VWIRE_ENABLE_SEND_CHECK
64
+ bool "Check the value was read by host after wire bits changed"
65
+ help
66
+ This option enables the function to check whether the host has read the value
67
+ after the wire data changes.
68
+
69
+ config ESPI_NPCX_WIRE_SEND_TIMEOUT_US
70
+ int "eSPI virtual wire send timeout count"
71
+ default 1000
72
+ help
73
+ The times to check status after sending the eSPI virtual wire signal. The unit
74
+ is microseconds (µs).
75
+
63
76
config ESPI_TAF_NPCX
64
77
bool "Nuvoton NPCX embedded controller (EC) ESPI TAF driver"
65
78
depends on SOC_SERIES_NPCX4
Original file line number Diff line number Diff line change @@ -859,9 +859,25 @@ static int espi_npcx_send_vwire(const struct device *dev,
859
859
if (signal >= ESPI_VWIRE_SIGNAL_TARGET_GPIO_0 ) {
860
860
SET_FIELD (inst -> VWGPSM [reg_idx ], NPCX_VWEVSM_WIRE , val );
861
861
reg_val = inst -> VWGPSM [reg_idx ];
862
+
863
+ if (IS_ENABLED (CONFIG_ESPI_NPCX_VWIRE_ENABLE_SEND_CHECK )) {
864
+ if (!WAIT_FOR (!IS_BIT_SET (inst -> VWGPSM [reg_idx ], NPCX_VWEVSM_DIRTY ),
865
+ CONFIG_ESPI_NPCX_WIRE_SEND_TIMEOUT_US , NULL )) {
866
+ LOG_ERR ("%s signal %d timeout" , __func__ , signal );
867
+ return - ETIMEDOUT ;
868
+ }
869
+ }
862
870
} else {
863
871
SET_FIELD (inst -> VWEVSM [reg_idx ], NPCX_VWEVSM_WIRE , val );
864
872
reg_val = inst -> VWEVSM [reg_idx ];
873
+
874
+ if (IS_ENABLED (CONFIG_ESPI_NPCX_VWIRE_ENABLE_SEND_CHECK )) {
875
+ if (!WAIT_FOR (!IS_BIT_SET (inst -> VWEVSM [reg_idx ], NPCX_VWEVSM_DIRTY ),
876
+ CONFIG_ESPI_NPCX_WIRE_SEND_TIMEOUT_US , NULL )) {
877
+ LOG_ERR ("%s signal %d timeout" , __func__ , signal );
878
+ return - ETIMEDOUT ;
879
+ }
880
+ }
865
881
}
866
882
867
883
LOG_DBG ("Send VW: %s%d 0x%08X" , reg_name , reg_idx , reg_val );
Original file line number Diff line number Diff line change @@ -727,6 +727,7 @@ struct espi_reg {
727
727
#define NPCX_VWEVSM_INDEX FIELD(8, 7)
728
728
#define NPCX_VWEVSM_INDEX_EN 15
729
729
#define NPCX_VWEVSM_BIT_VALID (n ) (4+n)
730
+ #define NPCX_VWEVSM_DIRTY 16
730
731
#define NPCX_VWEVSM_HW_WIRE FIELD(24, 4)
731
732
#define NPCX_VWGPSM_INDEX_EN 15
732
733
#define NPCX_OOBCTL_OOB_FREE 0
You can’t perform that action at this time.
0 commit comments