samples: drivers: espi: update MEC172x espi sample

MEC172x espi sample to use eSPI virtual wire hardware routing
through device tree

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
This commit is contained in:
Jay Vasanth 2022-12-12 18:03:47 -05:00 committed by Anas Nashif
commit b2f3d35540
4 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
board_power: resources {
compatible = "microchip,mec172x-board-power";
/* MCHP_GPIO_012 */
pwrg-gpios = <&gpio_000_036 10 GPIO_ACTIVE_HIGH>;
/* MCHP_GPIO_0054 */
rsm-gpios = <&gpio_040_076 12 GPIO_ACTIVE_HIGH>;
};
};
&espi_saf0 {
status = "okay";
};
/* Enable Target to Controller Virtual Wires GPIO 0 - 3 */
&vw_t2c_gpio_0 {
status = "okay";
reset-state = "1";
reset-source = "ESPI_RESET";
};
&vw_t2c_gpio_1 {
status = "okay";
reset-state = "1";
reset-source = "ESPI_RESET";
};
&vw_t2c_gpio_2 {
status = "okay";
reset-state = "1";
reset-source = "ESPI_RESET";
};
&vw_t2c_gpio_3 {
status = "okay";
reset-state = "1";
reset-source = "ESPI_RESET";
};
&spi0 {
status = "okay";
clock-frequency = <24000000>;
port-sel = <0>;
chip-select = <0>;
lines = <4>;
};

View file

@ -0,0 +1,24 @@
# Copyright (c) 2020, Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0
compatible: "microchip,mec172x-board-power"
description: |
This binding provides MEC172x board gpio power rails resources to
build and run samples/drives/espi in Zephyr.
GPIOs required before performing a eSPI host-slave handshake
properties:
pwrg-gpios:
type: phandle-array
required: true
description: |
Board GPIO input used to detect that power rails are stable.
rsm-gpios:
type: phandle-array
required: true
description: |
Board GPIO output used to notify eSPI master to ackwnowledge
power has stabilized and bare minimum initialization in eSPI slave
is complete so eSPI master can proceed with eSPI handshake.

View file

@ -0,0 +1,13 @@
# eSPI + mec172xevb_assy6906
CONFIG_ESPI=y
CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100
# Disable only for this board to check notifications
CONFIG_ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE=n
# Sample code doesn't handle ACPI host communication
CONFIG_ESPI_PERIPHERAL_HOST_IO=n
# Test SAF flash portal read/erase/write on EVB
CONFIG_ESPI_SAF=y
CONFIG_SPI=y
CONFIG_SPI_XEC_QMSPI_LDMA=y

View file

@ -133,6 +133,25 @@ static const struct espi_saf_flash_cfg flash_w25q128 = {
* by QMSPI driver.
* Use SAF hardware default TAG map.
*/
#ifdef CONFIG_ESPI_SAF_XEC_V2
static const struct espi_saf_cfg saf_cfg1 = {
.nflash_devices = 1U,
.hwcfg = {
.version = 2U, /* TODO */
.flags = 0U, /* TODO */
.qmspi_cpha = 0U, /* TODO */
.qmspi_cs_timing = 0U, /* TODO */
.flash_pd_timeout = 0U, /* TODO */
.flash_pd_min_interval = 0U, /* TODO */
.generic_descr = {
MCHP_SAF_EXIT_CM_DESCR12, MCHP_SAF_EXIT_CM_DESCR13,
MCHP_SAF_POLL_DESCR14, MCHP_SAF_POLL_DESCR15
},
.tag_map = { 0U, 0U, 0U }
},
.flash_cfgs = (struct espi_saf_flash_cfg *)&flash_w25q128
};
#else
static const struct espi_saf_cfg saf_cfg1 = {
.nflash_devices = 1U,
.hwcfg = {
@ -148,6 +167,7 @@ static const struct espi_saf_cfg saf_cfg1 = {
},
.flash_cfgs = (struct espi_saf_flash_cfg *)&flash_w25q128
};
#endif
/*
* Example for SAF driver set protection regions API.