Do not try to use peci between VW_HOST_RST_WARN and VW_PLTRST_N

This commit is contained in:
Jeremy Soller
2023-03-07 09:18:54 -07:00
parent 584e397b07
commit 8228362c5d
3 changed files with 19 additions and 1 deletions

View File

@ -40,6 +40,8 @@
vw_set(&W, V); \ vw_set(&W, V); \
} }
bool espi_host_reset = false;
void espi_init(void) { void espi_init(void) {
if (PLLFREQ != 0b0111) { if (PLLFREQ != 0b0111) {
// Workarounds to allow changing PLL // Workarounds to allow changing PLL
@ -144,6 +146,9 @@ void espi_event(void) {
VW_SET_DEBUG(VW_RCIN_N, VWS_HIGH); VW_SET_DEBUG(VW_RCIN_N, VWS_HIGH);
power_cpu_reset(); power_cpu_reset();
// Host reset complete
espi_host_reset = false;
} }
last_pltrst_n = wire; last_pltrst_n = wire;
} }
@ -154,6 +159,11 @@ void espi_event(void) {
// Set HOST_RST_ACK to HOST_RST_WARN // Set HOST_RST_ACK to HOST_RST_WARN
wire = vw_get(&VW_HOST_RST_WARN); wire = vw_get(&VW_HOST_RST_WARN);
if (wire != vw_get(&VW_HOST_RST_ACK)) { if (wire != vw_get(&VW_HOST_RST_ACK)) {
if (wire == VWS_HIGH) {
// Host reset started
espi_host_reset = true;
}
VW_SET_DEBUG(VW_HOST_RST_ACK, wire); VW_SET_DEBUG(VW_HOST_RST_ACK, wire);
} }
} }

View File

@ -3,8 +3,12 @@
#ifndef _BOARD_ESPI_H #ifndef _BOARD_ESPI_H
#define _BOARD_ESPI_H #define _BOARD_ESPI_H
#include <stdbool.h>
#include <ec/espi.h> #include <ec/espi.h>
extern bool espi_host_reset;
void espi_init(void); void espi_init(void);
void espi_reset(void); void espi_reset(void);
void espi_event(void); void espi_event(void);

View File

@ -1,13 +1,13 @@
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
#include <arch/time.h> #include <arch/time.h>
#include <board/espi.h>
#include <board/fan.h> #include <board/fan.h>
#include <board/gpio.h> #include <board/gpio.h>
#include <board/peci.h> #include <board/peci.h>
#include <board/power.h> #include <board/power.h>
#include <common/debug.h> #include <common/debug.h>
#include <common/macro.h> #include <common/macro.h>
#include <ec/espi.h>
#include <ec/gpio.h> #include <ec/gpio.h>
#include <ec/pwm.h> #include <ec/pwm.h>
@ -76,6 +76,10 @@ bool peci_available(void) {
if (power_state != POWER_STATE_S0) if (power_state != POWER_STATE_S0)
return false; return false;
// Currently waiting for host reset, PECI is not available
if (espi_host_reset)
return false;
// If VW_PLTRST_N virtual wire is not VWS_HIGH, PECI is not available // If VW_PLTRST_N virtual wire is not VWS_HIGH, PECI is not available
// This is because the CPU has not yet exited reset // This is because the CPU has not yet exited reset
if (vw_get(&VW_PLTRST_N) != VWS_HIGH) if (vw_get(&VW_PLTRST_N) != VWS_HIGH)