Skip to content

Commit

Permalink
FROMPULL: eSPI: NPCX/ITE: Enable conditional virtual wire valid bit c…
Browse files Browse the repository at this point in the history
…heck

On the new Intel SoC, the "Valid" bit of the Virtual Wire is set only for
Virtual Wires that undergo changes. This behavior differs from previous
generations. Therefore, to maintain backward compatibility, a conditional
check for the virtual wire valid bit is added for processing the virtual
wire level.

(cherry picked from commit 23e628c4fa9ea1b4bb6108311dacdf38f8955201)

zephyrproject-rtos/zephyr#81096

BUG=b:376348475, b:378527833


Change-Id: I9db7f4d9af189d97a951eb711f2eec990e3641a6
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6012659
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: caveh jalali <caveh@chromium.org>
Auto-Submit: Fabio Baltieri <fabiobaltieri@google.com>
  • Loading branch information
vphirema authored and Chromeos LUCI committed Nov 11, 2024
1 parent 2f0eeea commit 76dbcff
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
9 changes: 9 additions & 0 deletions drivers/espi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ config ESPI_VWIRE_CHANNEL
help
eSPI Controller supports virtual wires channel.

config ESPI_VWIRE_VALID_BIT_CHECK
bool "eSPI virtual wire valid bit check"
default y
depends on ESPI_VWIRE_CHANNEL
help
Enable the checking of the eSPI virtual wire valid bit. If this
configuration is not set, treat the new values as the previously
retained valid values and return the received virtual wire level.

config ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE
bool "Automatic acknowledge for eSPI HOST warnings"
default y
Expand Down
12 changes: 8 additions & 4 deletions drivers/espi/espi_it8xxx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,15 @@ static int espi_it8xxx2_receive_vwire(const struct device *dev,
return -EIO;
}

if (vw_reg->VW_INDEX[vw_index] & valid_mask) {
*level = !!(vw_reg->VW_INDEX[vw_index] & level_mask);
if (IS_ENABLED(CONFIG_ESPI_VWIRE_VALID_BIT_CHECK)) {
if (vw_reg->VW_INDEX[vw_index] & valid_mask) {
*level = !!(vw_reg->VW_INDEX[vw_index] & level_mask);
} else {
/* Not valid */
*level = 0;
}
} else {
/* Not valid */
*level = 0;
*level = !!(vw_reg->VW_INDEX[vw_index] & level_mask);
}

return 0;
Expand Down
11 changes: 9 additions & 2 deletions drivers/espi/espi_npcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,11 @@ static int espi_npcx_receive_vwire(const struct device *dev,

val = GET_FIELD(inst->VWEVMS[reg_idx],
NPCX_VWEVMS_WIRE);
val &= GET_FIELD(inst->VWEVMS[reg_idx],

if (IS_ENABLED(CONFIG_ESPI_VWIRE_VALID_BIT_CHECK)) {
val &= GET_FIELD(inst->VWEVMS[reg_idx],
NPCX_VWEVMS_VALID);
}

*level = !!(val & bitmask);
return 0;
Expand All @@ -888,8 +891,12 @@ static int espi_npcx_receive_vwire(const struct device *dev,

val = GET_FIELD(inst->VWEVSM[reg_idx],
NPCX_VWEVSM_WIRE);
val &= GET_FIELD(inst->VWEVSM[reg_idx],

if (IS_ENABLED(CONFIG_ESPI_VWIRE_VALID_BIT_CHECK)) {
val &= GET_FIELD(inst->VWEVSM[reg_idx],
NPCX_VWEVSM_VALID);
}

*level = !!(val & bitmask);
return 0;
}
Expand Down

0 comments on commit 76dbcff

Please sign in to comment.