Browse Source

drivers: samples: espi: Adjust terms per eSPI specification 1.5

Replace CONFIG_ESPI_SLAVE by CONFIG_ESPI_TARGET
Replace CONFIG_ESPI_SAF by CONFIG_ESPI_TAF
Replace ESPI_BUS_SAF_NOTIFICATION with ESPI_TAF_BUS_NOTIFICATION in API

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
pull/74126/head
Jose Alberto Meza 1 year ago committed by Anas Nashif
parent
commit
f854b8b799
  1. 4
      drivers/espi/CMakeLists.txt
  2. 30
      drivers/espi/Kconfig
  3. 26
      drivers/espi/Kconfig.xec
  4. 14
      drivers/espi/espi_npcx.c
  5. 2
      drivers/espi/espi_saf_mchp_xec.c
  6. 4
      drivers/espi/espi_saf_mchp_xec_v2.c
  7. 4
      drivers/espi/espi_taf_npcx.c
  8. 2
      include/zephyr/drivers/espi.h
  9. 4
      samples/drivers/espi/boards/mec15xxevb_assy6853.conf
  10. 4
      samples/drivers/espi/boards/mec172xevb_assy6906.conf
  11. 12
      samples/drivers/espi/src/main.c
  12. 2
      soc/nuvoton/npcx/npcx4/Kconfig.defconfig

4
drivers/espi/CMakeLists.txt

@ -10,8 +10,8 @@ zephyr_library_sources_ifdef(CONFIG_ESPI_NPCX host_subs_npcx.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_TAF_NPCX espi_taf_npcx.c) zephyr_library_sources_ifdef(CONFIG_ESPI_TAF_NPCX espi_taf_npcx.c)
zephyr_library_sources_ifdef(CONFIG_USERSPACE espi_handlers.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE espi_handlers.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_EMUL espi_emul.c) zephyr_library_sources_ifdef(CONFIG_ESPI_EMUL espi_emul.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_SAF_XEC espi_saf_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_ESPI_TAF_XEC espi_saf_mchp_xec.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_XEC_V2 espi_mchp_xec_v2.c) zephyr_library_sources_ifdef(CONFIG_ESPI_XEC_V2 espi_mchp_xec_v2.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_XEC_V2 espi_mchp_xec_host_v2.c) zephyr_library_sources_ifdef(CONFIG_ESPI_XEC_V2 espi_mchp_xec_host_v2.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_IT8XXX2 espi_it8xxx2.c) zephyr_library_sources_ifdef(CONFIG_ESPI_IT8XXX2 espi_it8xxx2.c)
zephyr_library_sources_ifdef(CONFIG_ESPI_SAF_XEC_V2 espi_saf_mchp_xec_v2.c) zephyr_library_sources_ifdef(CONFIG_ESPI_TAF_XEC_V2 espi_saf_mchp_xec_v2.c)

30
drivers/espi/Kconfig

@ -22,11 +22,11 @@ module = ESPI
module-str = espi module-str = espi
source "subsys/logging/Kconfig.template.log_config" source "subsys/logging/Kconfig.template.log_config"
config ESPI_SLAVE config ESPI_TARGET
bool "ESPI slave driver" bool "ESPI target driver"
default y default y
help help
Enables eSPI driver in slave mode. Enables eSPI driver in target mode.
config ESPI_INIT_PRIORITY config ESPI_INIT_PRIORITY
int "ESPI Controller driver initialization priority" int "ESPI Controller driver initialization priority"
@ -50,20 +50,20 @@ config ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE
bool "Automatic acknowledge for eSPI HOST warnings" bool "Automatic acknowledge for eSPI HOST warnings"
default y default y
depends on ESPI_VWIRE_CHANNEL depends on ESPI_VWIRE_CHANNEL
depends on ESPI_SLAVE depends on ESPI_TARGET
help help
Enable automatic acknowledgment from eSPI slave towards eSPI host Enable automatic acknowledgment from eSPI target towards eSPI controller
whenever it receives suspend or reset warning. whenever it receives suspend or reset warning.
If this is disabled, it means the app wants to be give the opportunity If this is disabled, it means the app wants to be give the opportunity
to prepare for either HOST suspend or reset. to prepare for either HOST suspend or reset.
config ESPI_AUTOMATIC_BOOT_DONE_ACKNOWLEDGE config ESPI_AUTOMATIC_BOOT_DONE_ACKNOWLEDGE
bool "Automatic acknowledge slave boot status" bool "Automatic acknowledge target boot status"
default y default y
depends on ESPI_VWIRE_CHANNEL depends on ESPI_VWIRE_CHANNEL
depends on ESPI_SLAVE depends on ESPI_TARGET
help help
Enable automatic acknowledgment from slave basic configuration been Enable automatic acknowledgment from target basic configuration been
completed by sending a virtual wire message to the eSPI master. completed by sending a virtual wire message to the eSPI master.
This depends on SPI boot configuration. It could be either very 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 early in the flow after the VW channel is configured. Or it could be
@ -176,19 +176,19 @@ config ESPI_OOB_CHANNEL_RX_ASYNC
Enables asynchronous handling for host-initiated OOB traffic. Enables asynchronous handling for host-initiated OOB traffic.
Otherwise OOB traffic is assumed to be always client-initiated. Otherwise OOB traffic is assumed to be always client-initiated.
config ESPI_SAF config ESPI_TAF
bool "ESPI SAF driver" bool "ESPI TAF driver"
depends on ESPI_FLASH_CHANNEL depends on ESPI_FLASH_CHANNEL
help help
Enable Slave Attached Flash eSPI driver. SAF depends upon ESPI driver Enable Target Attached Flash eSPI driver. TAF depends upon ESPI driver
and flash channel. and flash channel.
config ESPI_SAF_INIT_PRIORITY config ESPI_TAF_INIT_PRIORITY
int "ESPI SAF driver initialization priority" int "ESPI TAF driver initialization priority"
depends on ESPI_SAF depends on ESPI_TAF
default 4 default 4
help help
Driver initialization priority for eSPI SAF driver. SAF driver must Driver initialization priority for eSPI TAF driver. TAF driver must
initialize after the ESPI driver. initialize after the ESPI driver.
endif # ESPI endif # ESPI

26
drivers/espi/Kconfig.xec

@ -63,21 +63,21 @@ config ESPI_FLASH_BUFFER_SIZE
Use maximum RAM buffer size defined by spec but allow applications Use maximum RAM buffer size defined by spec but allow applications
to override if eSPI host doesn't support it. to override if eSPI host doesn't support it.
config ESPI_SAF_XEC config ESPI_TAF_XEC
bool "XEC Microchip ESPI SAF driver" bool "XEC Microchip ESPI TAF driver"
default y default y
depends on SOC_SERIES_MEC15XX depends on SOC_SERIES_MEC15XX
depends on DT_HAS_MICROCHIP_XEC_ESPI_SAF_ENABLED depends on DT_HAS_MICROCHIP_XEC_ESPI_SAF_ENABLED
help help
Enable the Microchip XEC SAF ESPI driver for MEC15xx family. Enable the Microchip XEC TAF ESPI driver for MEC15xx family.
config ESPI_SAF_XEC_V2 config ESPI_TAF_XEC_V2
bool "XEC Microchip ESPI SAF V2 driver" bool "XEC Microchip ESPI TAF V2 driver"
default y default y
depends on SOC_SERIES_MEC172X depends on SOC_SERIES_MEC172X
depends on DT_HAS_MICROCHIP_XEC_ESPI_SAF_V2_ENABLED depends on DT_HAS_MICROCHIP_XEC_ESPI_SAF_V2_ENABLED
help help
Enable the Microchip XEC SAF ESPI driver for MEC172x series. Enable the Microchip XEC TAF ESPI driver for MEC172x series.
endif #ESPI_XEC endif #ESPI_XEC
@ -154,19 +154,19 @@ config ESPI_PERIPHERAL_XEC_EMI2
endif #ESPI_PERIPHERAL_CHANNEL endif #ESPI_PERIPHERAL_CHANNEL
config ESPI_SAF config ESPI_TAF
bool "XEC Microchip ESPI SAF driver" bool "XEC Microchip ESPI TAF driver"
depends on ESPI_FLASH_CHANNEL depends on ESPI_FLASH_CHANNEL
help help
Enable Slave Attached Flash eSPI driver. SAF depends upon ESPI XEC driver Enable Target Attached Flash eSPI driver. TAF depends upon ESPI XEC driver
and flash channel. and flash channel.
config ESPI_SAF_INIT_PRIORITY config ESPI_TAF_INIT_PRIORITY
int "ESPI SAF driver initialization priority" int "ESPI TAF driver initialization priority"
depends on ESPI_SAF depends on ESPI_TAF
default 4 default 4
help help
Driver initialization priority for eSPI SAF driver. Driver initialization priority for ESPI TAF driver.
config ESPI_PERIPHERAL_ACPI_EC_IBF_EVT_DATA config ESPI_PERIPHERAL_ACPI_EC_IBF_EVT_DATA
bool "Read ACPI EC Event Data in IBF ISR" bool "Read ACPI EC Event Data in IBF ISR"

14
drivers/espi/espi_npcx.c

@ -310,8 +310,8 @@ static void espi_bus_cfg_update_isr(const struct device *dev)
espi_vw_send_bootload_done(dev); espi_vw_send_bootload_done(dev);
} }
#if (defined(CONFIG_ESPI_FLASH_CHANNEL) && defined(CONFIG_ESPI_SAF)) #if (defined(CONFIG_ESPI_FLASH_CHANNEL) && defined(CONFIG_ESPI_TAF))
/* If CONFIG_ESPI_SAF is set, set to auto or manual mode accroding /* If CONFIG_ESPI_TAF is set, set to auto or manual mode accroding
* to configuration. * to configuration.
*/ */
if (IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_FLCHANMODE)) { if (IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_FLCHANMODE)) {
@ -348,7 +348,7 @@ static void espi_bus_oob_rx_isr(const struct device *dev)
#endif #endif
#if defined(CONFIG_ESPI_FLASH_CHANNEL) #if defined(CONFIG_ESPI_FLASH_CHANNEL)
#if defined(CONFIG_ESPI_SAF) #if defined(CONFIG_ESPI_TAF)
static struct espi_taf_pckt taf_pckt; static struct espi_taf_pckt taf_pckt;
static uint32_t espi_taf_parse(const struct device *dev) static uint32_t espi_taf_parse(const struct device *dev)
@ -382,7 +382,7 @@ static uint32_t espi_taf_parse(const struct device *dev)
return (uint32_t)&taf_pckt; return (uint32_t)&taf_pckt;
} }
#endif /* CONFIG_ESPI_SAF */ #endif /* CONFIG_ESPI_TAF */
static void espi_bus_flash_rx_isr(const struct device *dev) static void espi_bus_flash_rx_isr(const struct device *dev)
{ {
@ -404,9 +404,9 @@ static void espi_bus_flash_rx_isr(const struct device *dev)
#endif #endif
k_sem_give(&data->flash_rx_lock); k_sem_give(&data->flash_rx_lock);
} else { /* Target Attached Flash Access */ } else { /* Target Attached Flash Access */
#if defined(CONFIG_ESPI_SAF) #if defined(CONFIG_ESPI_TAF)
struct espi_event evt = { struct espi_event evt = {
.evt_type = ESPI_BUS_SAF_NOTIFICATION, .evt_type = ESPI_BUS_TAF_NOTIFICATION,
.evt_details = ESPI_CHANNEL_FLASH, .evt_details = ESPI_CHANNEL_FLASH,
.evt_data = espi_taf_parse(dev), .evt_data = espi_taf_parse(dev),
}; };
@ -1401,7 +1401,7 @@ static int espi_npcx_init(const struct device *dev)
/* Configure host sub-modules which HW blocks belong to core domain */ /* Configure host sub-modules which HW blocks belong to core domain */
npcx_host_init_subs_core_domain(dev, &data->callbacks); npcx_host_init_subs_core_domain(dev, &data->callbacks);
#if defined(CONFIG_ESPI_FLASH_CHANNEL) && defined(CONFIG_ESPI_SAF) #if defined(CONFIG_ESPI_FLASH_CHANNEL) && defined(CONFIG_ESPI_TAF)
npcx_init_taf(dev, &data->callbacks); npcx_init_taf(dev, &data->callbacks);
#endif #endif

2
drivers/espi/espi_saf_mchp_xec.c

@ -849,7 +849,7 @@ static const struct espi_saf_xec_config espi_saf_xec_config = {
DEVICE_DT_INST_DEFINE(0, &espi_saf_xec_init, NULL, DEVICE_DT_INST_DEFINE(0, &espi_saf_xec_init, NULL,
&espi_saf_xec_data, &espi_saf_xec_config, POST_KERNEL, &espi_saf_xec_data, &espi_saf_xec_config, POST_KERNEL,
CONFIG_ESPI_SAF_INIT_PRIORITY, &espi_saf_xec_driver_api); CONFIG_ESPI_TAF_INIT_PRIORITY, &espi_saf_xec_driver_api);
static int espi_saf_xec_init(const struct device *dev) static int espi_saf_xec_init(const struct device *dev)
{ {

4
drivers/espi/espi_saf_mchp_xec_v2.c

@ -1027,7 +1027,7 @@ static void espi_saf_done_isr(const struct device *dev)
struct mchp_espi_saf * const regs = xcfg->saf_base; struct mchp_espi_saf * const regs = xcfg->saf_base;
const struct espi_xec_irq_info *safirq = &xcfg->irq_info_list[0]; const struct espi_xec_irq_info *safirq = &xcfg->irq_info_list[0];
uint32_t ecp_status = regs->SAF_ECP_STATUS; uint32_t ecp_status = regs->SAF_ECP_STATUS;
struct espi_event evt = { .evt_type = ESPI_BUS_SAF_NOTIFICATION, struct espi_event evt = { .evt_type = ESPI_BUS_TAF_NOTIFICATION,
.evt_details = BIT(0), .evt_details = BIT(0),
.evt_data = ecp_status }; .evt_data = ecp_status };
@ -1142,7 +1142,7 @@ static int espi_saf_xec_init(const struct device *dev)
DEVICE_DT_INST_DEFINE(0, &espi_saf_xec_init, NULL, \ DEVICE_DT_INST_DEFINE(0, &espi_saf_xec_init, NULL, \
&espisaf_xec_data_##n, \ &espisaf_xec_data_##n, \
&espisaf_xec_config_##n, POST_KERNEL, \ &espisaf_xec_config_##n, POST_KERNEL, \
CONFIG_ESPI_SAF_INIT_PRIORITY, \ CONFIG_ESPI_TAF_INIT_PRIORITY, \
&espi_saf_xec_driver_api); \ &espi_saf_xec_driver_api); \
\ \
static void espi_saf_xec_connect_irqs_##n(void) \ static void espi_saf_xec_connect_irqs_##n(void) \

4
drivers/espi/espi_taf_npcx.c

@ -499,7 +499,7 @@ static void espi_taf_work(struct k_work *item)
static void espi_taf_event_handler(const struct device *dev, struct espi_callback *cb, static void espi_taf_event_handler(const struct device *dev, struct espi_callback *cb,
struct espi_event event) struct espi_event event)
{ {
if ((event.evt_type != ESPI_BUS_SAF_NOTIFICATION) || if ((event.evt_type != ESPI_BUS_TAF_NOTIFICATION) ||
(event.evt_details != ESPI_CHANNEL_FLASH)) { (event.evt_details != ESPI_CHANNEL_FLASH)) {
return; return;
} }
@ -510,7 +510,7 @@ static void espi_taf_event_handler(const struct device *dev, struct espi_callbac
int npcx_init_taf(const struct device *dev, sys_slist_t *callbacks) int npcx_init_taf(const struct device *dev, sys_slist_t *callbacks)
{ {
espi_init_callback(&espi_taf_cb, espi_taf_event_handler, ESPI_BUS_SAF_NOTIFICATION); espi_init_callback(&espi_taf_cb, espi_taf_event_handler, ESPI_BUS_TAF_NOTIFICATION);
espi_add_callback(dev, &espi_taf_cb); espi_add_callback(dev, &espi_taf_cb);
npcx_espi_taf_data.host_dev = dev; npcx_espi_taf_data.host_dev = dev;

2
include/zephyr/drivers/espi.h

@ -140,7 +140,7 @@ enum espi_bus_event {
* eSPI drivers should convey the peripheral type. * eSPI drivers should convey the peripheral type.
*/ */
ESPI_BUS_PERIPHERAL_NOTIFICATION = BIT(4), ESPI_BUS_PERIPHERAL_NOTIFICATION = BIT(4),
ESPI_BUS_SAF_NOTIFICATION = BIT(5), ESPI_BUS_TAF_NOTIFICATION = BIT(5),
}; };

4
samples/drivers/espi/boards/mec15xxevb_assy6853.conf

@ -5,7 +5,7 @@ CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100
CONFIG_ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE=n CONFIG_ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE=n
# Sample code doesn't handle ACPI host communication # Sample code doesn't handle ACPI host communication
CONFIG_ESPI_PERIPHERAL_HOST_IO=n CONFIG_ESPI_PERIPHERAL_HOST_IO=n
# Test SAF flash portal read/erase/write on EVB # Test TAF flash portal read/erase/write on EVB
CONFIG_ESPI_SAF=y CONFIG_ESPI_TAF=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_SPI_XEC_QMSPI=y CONFIG_SPI_XEC_QMSPI=y

4
samples/drivers/espi/boards/mec172xevb_assy6906.conf

@ -7,7 +7,7 @@ CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100
CONFIG_ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE=n CONFIG_ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE=n
# Sample code doesn't handle ACPI host communication # Sample code doesn't handle ACPI host communication
CONFIG_ESPI_PERIPHERAL_HOST_IO=n CONFIG_ESPI_PERIPHERAL_HOST_IO=n
# Test SAF flash portal read/erase/write on EVB # Test TAF flash portal read/erase/write on EVB
CONFIG_ESPI_SAF=y CONFIG_ESPI_TAF=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_SPI_XEC_QMSPI_LDMA=y CONFIG_SPI_XEC_QMSPI_LDMA=y

12
samples/drivers/espi/src/main.c

@ -16,7 +16,7 @@
/* OOB operations will be attempted regardless of channel enabled or not */ /* OOB operations will be attempted regardless of channel enabled or not */
#include "espi_oob_handler.h" #include "espi_oob_handler.h"
#ifdef CONFIG_ESPI_SAF #ifdef CONFIG_ESPI_TAF
#include <zephyr/drivers/espi_saf.h> #include <zephyr/drivers/espi_saf.h>
#endif #endif
@ -65,7 +65,7 @@ static uint8_t flash_write_buf[MAX_TEST_BUF_SIZE];
static uint8_t flash_read_buf[MAX_TEST_BUF_SIZE]; static uint8_t flash_read_buf[MAX_TEST_BUF_SIZE];
#endif #endif
#ifdef CONFIG_ESPI_SAF #ifdef CONFIG_ESPI_TAF
#define SAF_BASE_ADDR DT_REG_ADDR(DT_NODELABEL(espi_saf0)) #define SAF_BASE_ADDR DT_REG_ADDR(DT_NODELABEL(espi_saf0))
#define SAF_TEST_FREQ_HZ 24000000U #define SAF_TEST_FREQ_HZ 24000000U
@ -128,7 +128,7 @@ static const struct espi_saf_flash_cfg flash_w25q128 = {
* by QMSPI driver. * by QMSPI driver.
* Use SAF hardware default TAG map. * Use SAF hardware default TAG map.
*/ */
#ifdef CONFIG_ESPI_SAF_XEC_V2 #ifdef CONFIG_ESPI_TAF_XEC_V2
static const struct espi_saf_cfg saf_cfg1 = { static const struct espi_saf_cfg saf_cfg1 = {
.nflash_devices = 1U, .nflash_devices = 1U,
.hwcfg = {.version = 2U, /* TODO */ .hwcfg = {.version = 2U, /* TODO */
@ -757,7 +757,7 @@ int espi_saf_test1(uint32_t spi_addr)
return rc; return rc;
} }
#endif /* CONFIG_ESPI_SAF */ #endif /* CONFIG_ESPI_TAF */
static void host_warn_handler(uint32_t signal, uint32_t status) static void host_warn_handler(uint32_t signal, uint32_t status)
{ {
@ -1187,7 +1187,7 @@ int espi_test(void)
return -ENODEV; return -ENODEV;
} }
#ifdef CONFIG_ESPI_SAF #ifdef CONFIG_ESPI_TAF
if (!device_is_ready(qspi_dev)) { if (!device_is_ready(qspi_dev)) {
LOG_ERR("%s: device not ready.", qspi_dev->name); LOG_ERR("%s: device not ready.", qspi_dev->name);
return -ENODEV; return -ENODEV;
@ -1223,7 +1223,7 @@ int espi_test(void)
espi_init(); espi_init();
#ifdef CONFIG_ESPI_SAF #ifdef CONFIG_ESPI_TAF
/* /*
* eSPI SAF configuration must be after eSPI configuration. * eSPI SAF configuration must be after eSPI configuration.
* eSPI SAF EC portal flash tests before EC releases RSMRST# and * eSPI SAF EC portal flash tests before EC releases RSMRST# and

2
soc/nuvoton/npcx/npcx4/Kconfig.defconfig

@ -13,6 +13,6 @@ config CORTEX_M_SYSTICK
config ESPI_TAF_NPCX config ESPI_TAF_NPCX
default y default y
depends on ESPI_SAF depends on ESPI_TAF
endif # SOC_SERIES_NPCX4 endif # SOC_SERIES_NPCX4

Loading…
Cancel
Save