drivers: espi: xec: support for eSPI slaves with long initializations

Add Kconfig switch to disable automatic eSPI slave boot acknowledge.
This allows to perform lenghty operations before continue any eSPI
handshake with eSPI master.

Required for eSPI SAF boot configuration.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
This commit is contained in:
Jose Alberto Meza 2020-08-27 14:29:31 -07:00 committed by Anas Nashif
commit 01ddb4787d
2 changed files with 20 additions and 6 deletions

View file

@ -44,12 +44,25 @@ config ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE
bool "Automatic acknowledge for eSPI HOST warnings"
default y
depends on ESPI_VWIRE_CHANNEL
depends on ESPI_SLAVE
help
Enable automatic acknowledge from eSPI slave towards eSPI host
whenever it receives suspend or reset warning.
If this is disabled, it means the app wants to be give the opportunity
to prepare for either HOST suspend or reset.
config ESPI_AUTOMATIC_BOOT_DONE_ACKNOWLEDGE
bool "Automatic acknowledge slave boot status"
default y
depends on ESPI_VWIRE_CHANNEL
depends on ESPI_SLAVE
help
Enable automatic acknowledge of slave basic configuration been
completed by sending a virtual wire message to the eSPI master.
This depends on SPI boot configuration. It could be either very
early in the flow after the VW channel is configured. Or it could be
until flash channel is configured.
config ESPI_OOB_CHANNEL
bool "eSPI Out-of-band channel"
help
@ -92,11 +105,6 @@ config ESPI_PERIPHERAL_HOST_IO_PVT_PORT_NUM
the same port. Also, ensure the port number selected doesn't clash
with the existing ports (like 80, 92, 62 etc).
config ESPI_PERIPHERAL_PORT_92
bool "Legacy Port 92 peripheral"
help
Enables legacy Port 92 over eSPI peripheral channel.
config ESPI_PERIPHERAL_DEBUG_PORT_80
bool "Debug Port 80 peripheral"
help

View file

@ -662,6 +662,7 @@ static int espi_xec_manage_callback(struct device *dev,
return espi_manage_callback(&data->callbacks, callback, set);
}
#ifdef CONFIG_ESPI_AUTOMATIC_BOOT_DONE_ACKNOWLEDGE
static void send_slave_bootdone(struct device *dev)
{
int ret;
@ -671,9 +672,12 @@ static void send_slave_bootdone(struct device *dev)
&boot_done);
if (!ret && !boot_done) {
/* SLAVE_BOOT_DONE & SLAVE_LOAD_STS have to be sent together */
ESPI_S2M_VW_REGS->SMVW01.SRC = 0x01000001;
espi_xec_send_vwire(dev, ESPI_VWIRE_SIGNAL_SLV_BOOT_STS, 1);
espi_xec_send_vwire(dev, ESPI_VWIRE_SIGNAL_SLV_BOOT_DONE, 1);
}
}
#endif
#ifdef CONFIG_ESPI_OOB_CHANNEL
static void espi_init_oob(struct device *dev)
{
@ -871,7 +875,9 @@ static void espi_vwire_chanel_isr(struct device *dev)
evt.evt_data = 1;
/* VW channel interrupt can disabled at this point */
MCHP_GIRQ_ENCLR(config->bus_girq_id) = MCHP_ESPI_VW_EN_GIRQ_VAL;
#ifdef CONFIG_ESPI_AUTOMATIC_BOOT_DONE_ACKNOWLEDGE
send_slave_bootdone(dev);
#endif
}
espi_send_callbacks(&data->callbacks, dev, evt);