Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
eSPI Driver APIs More...
Data Structures | |
struct | espi_evt_data_kbc |
Bit field definition of evt_data in struct espi_event for KBC. More... | |
struct | espi_evt_data_acpi |
Bit field definition of evt_data in struct espi_event for ACPI. More... | |
struct | espi_event |
eSPI event More... | |
struct | espi_cfg |
eSPI bus configuration parameters More... | |
struct | espi_request_packet |
eSPI peripheral request packet format More... | |
struct | espi_oob_packet |
eSPI out-of-band transaction packet format More... | |
struct | espi_flash_packet |
eSPI flash transactions packet format More... | |
struct | espi_saf_cfg |
eSPI SAF configuration parameters More... | |
struct | espi_saf_packet |
eSPI SAF transaction packet format More... | |
Macros | |
#define | ESPI_VWIRE_SIGNAL_OCB_0 ESPI_VWIRE_SIGNAL_TARGET_GPIO_0 |
#define | ESPI_VWIRE_SIGNAL_OCB_1 ESPI_VWIRE_SIGNAL_TARGET_GPIO_1 |
#define | ESPI_VWIRE_SIGNAL_OCB_2 ESPI_VWIRE_SIGNAL_TARGET_GPIO_2 |
#define | ESPI_VWIRE_SIGNAL_OCB_3 ESPI_VWIRE_SIGNAL_TARGET_GPIO_3 |
#define | HOST_KBC_EVT_IBF BIT(0) |
#define | HOST_KBC_EVT_OBE BIT(1) |
Typedefs | |
typedef void(* | espi_callback_handler_t) (const struct device *dev, struct espi_callback *cb, struct espi_event espi_evt) |
Define the application callback handler function signature. | |
Functions | |
int | espi_config (const struct device *dev, struct espi_cfg *cfg) |
Configure operation of a eSPI controller. | |
bool | espi_get_channel_status (const struct device *dev, enum espi_channel ch) |
Query to see if it a channel is ready. | |
int | espi_read_request (const struct device *dev, struct espi_request_packet *req) |
Sends memory, I/O or message read request over eSPI. | |
int | espi_write_request (const struct device *dev, struct espi_request_packet *req) |
Sends memory, I/O or message write request over eSPI. | |
int | espi_read_lpc_request (const struct device *dev, enum lpc_peripheral_opcode op, uint32_t *data) |
Reads SOC data from a LPC peripheral with information updated over eSPI. | |
int | espi_write_lpc_request (const struct device *dev, enum lpc_peripheral_opcode op, uint32_t *data) |
Writes data to a LPC peripheral which generates an eSPI transaction. | |
int | espi_send_vwire (const struct device *dev, enum espi_vwire_signal signal, uint8_t level) |
Sends system/platform signal as a virtual wire packet. | |
int | espi_receive_vwire (const struct device *dev, enum espi_vwire_signal signal, uint8_t *level) |
Retrieves level status for a signal encapsulated in a virtual wire. | |
int | espi_send_oob (const struct device *dev, struct espi_oob_packet *pckt) |
Sends SMBus transaction (out-of-band) packet over eSPI bus. | |
int | espi_receive_oob (const struct device *dev, struct espi_oob_packet *pckt) |
Receives SMBus transaction (out-of-band) packet from eSPI bus. | |
int | espi_read_flash (const struct device *dev, struct espi_flash_packet *pckt) |
Sends a read request packet for shared flash. | |
int | espi_write_flash (const struct device *dev, struct espi_flash_packet *pckt) |
Sends a write request packet for shared flash. | |
int | espi_flash_erase (const struct device *dev, struct espi_flash_packet *pckt) |
Sends a write request packet for shared flash. | |
static void | espi_init_callback (struct espi_callback *callback, espi_callback_handler_t handler, enum espi_bus_event evt_type) |
Callback model. | |
static int | espi_add_callback (const struct device *dev, struct espi_callback *callback) |
Add an application callback. | |
static int | espi_remove_callback (const struct device *dev, struct espi_callback *callback) |
Remove an application callback. | |
int | espi_saf_config (const struct device *dev, const struct espi_saf_cfg *cfg) |
Configure operation of a eSPI controller. | |
int | espi_saf_set_protection_regions (const struct device *dev, const struct espi_saf_protection *pr) |
Set one or more SAF protection regions. | |
int | espi_saf_activate (const struct device *dev) |
Activate SAF block. | |
bool | espi_saf_get_channel_status (const struct device *dev) |
Query to see if SAF is ready. | |
int | espi_saf_flash_read (const struct device *dev, struct espi_saf_packet *pckt) |
Sends a read request packet for slave attached flash. | |
int | espi_saf_flash_write (const struct device *dev, struct espi_saf_packet *pckt) |
Sends a write request packet for slave attached flash. | |
int | espi_saf_flash_erase (const struct device *dev, struct espi_saf_packet *pckt) |
Sends a write request packet for slave attached flash. | |
int | espi_saf_flash_unsuccess (const struct device *dev, struct espi_saf_packet *pckt) |
Response unsuccessful completion for slave attached flash. | |
static void | espi_saf_init_callback (struct espi_callback *callback, espi_callback_handler_t handler, enum espi_bus_event evt_type) |
Callback model. | |
static int | espi_saf_add_callback (const struct device *dev, struct espi_callback *callback) |
Add an application callback. | |
static int | espi_saf_remove_callback (const struct device *dev, struct espi_callback *callback) |
Remove an application callback. | |
eSPI Driver APIs
eSPI SAF Driver APIs
#define ESPI_VWIRE_SIGNAL_OCB_0 ESPI_VWIRE_SIGNAL_TARGET_GPIO_0 |
#include <zephyr/drivers/espi.h>
#define ESPI_VWIRE_SIGNAL_OCB_1 ESPI_VWIRE_SIGNAL_TARGET_GPIO_1 |
#include <zephyr/drivers/espi.h>
#define ESPI_VWIRE_SIGNAL_OCB_2 ESPI_VWIRE_SIGNAL_TARGET_GPIO_2 |
#include <zephyr/drivers/espi.h>
#define ESPI_VWIRE_SIGNAL_OCB_3 ESPI_VWIRE_SIGNAL_TARGET_GPIO_3 |
#include <zephyr/drivers/espi.h>
#define HOST_KBC_EVT_IBF BIT(0) |
#include <zephyr/drivers/espi.h>
#define HOST_KBC_EVT_OBE BIT(1) |
#include <zephyr/drivers/espi.h>
espi_callback_handler_t |
#include <zephyr/drivers/espi.h>
Define the application callback handler function signature.
dev | Device struct for the eSPI device. |
cb | Original struct espi_callback owning this handler. |
espi_evt | event details that trigger the callback handler. |
enum espi_bus_event |
#include <zephyr/drivers/espi.h>
eSPI bus event.
eSPI bus event to indicate events for which user can register callbacks
enum espi_channel |
#include <zephyr/drivers/espi.h>
eSPI channel.
Identifies each eSPI logical channel supported by eSPI controller Each channel allows independent traffic, but the assignment of channel type to channel number is fixed.
Note that generic commands are not associated with any channel, so traffic over eSPI can occur if all channels are disabled or not ready
Enumerator | |
---|---|
ESPI_CHANNEL_PERIPHERAL | |
ESPI_CHANNEL_VWIRE | |
ESPI_CHANNEL_OOB | |
ESPI_CHANNEL_FLASH |
enum espi_cycle_type |
#include <zephyr/drivers/espi.h>
eSPI cycle types supported over eSPI peripheral channel
enum espi_io_mode |
#include <zephyr/drivers/espi.h>
eSPI I/O mode capabilities
Enumerator | |
---|---|
ESPI_IO_MODE_SINGLE_LINE | |
ESPI_IO_MODE_DUAL_LINES | |
ESPI_IO_MODE_QUAD_LINES |
enum espi_pc_event |
#include <zephyr/drivers/espi.h>
eSPI peripheral channel events.
eSPI peripheral channel event types to indicate users.
Enumerator | |
---|---|
ESPI_PC_EVT_BUS_CHANNEL_READY | |
ESPI_PC_EVT_BUS_MASTER_ENABLE |
#include <zephyr/drivers/espi.h>
eSPI peripheral notification type.
eSPI peripheral notification event details to indicate which peripheral trigger the eSPI callback
Enumerator | |
---|---|
ESPI_PERIPHERAL_UART | |
ESPI_PERIPHERAL_8042_KBC | |
ESPI_PERIPHERAL_HOST_IO | |
ESPI_PERIPHERAL_DEBUG_PORT80 | |
ESPI_PERIPHERAL_HOST_IO_PVT |
enum espi_vwire_signal |
#include <zephyr/drivers/espi.h>
eSPI system platform signals that can be send or receive through virtual wire channel
#include <zephyr/drivers/espi.h>
|
inlinestatic |
#include <zephyr/drivers/espi.h>
Add an application callback.
dev | Pointer to the device structure for the driver instance. |
callback | A valid Application's callback structure pointer. |
Note: enables to add as many callback as needed on the same device.
#include <zephyr/drivers/espi.h>
Configure operation of a eSPI controller.
This routine provides a generic interface to override eSPI controller capabilities.
If this eSPI controller is acting as target, the values set here will be discovered as part through the GET_CONFIGURATION command issued by the eSPI controller during initialization.
If this eSPI controller is acting as controller, the values set here will be used by eSPI controller to determine minimum common capabilities with eSPI target then send via SET_CONFIGURATION command.
dev | Pointer to the device structure for the driver instance. |
cfg | the device runtime configuration for the eSPI controller. |
0 | If successful. |
-EIO | General input / output error, failed to configure device. |
-EINVAL | invalid capabilities, failed to configure device. |
-ENOTSUP | capability not supported by eSPI target. |
int espi_flash_erase | ( | const struct device * | dev, |
struct espi_flash_packet * | pckt | ||
) |
#include <zephyr/drivers/espi.h>
Sends a write request packet for shared flash.
This routines provides an interface to send a request to write to the flash components shared between the eSPI controller and eSPI targets.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of write flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by controller. |
-EIO | General input / output error, failed request to controller. |
bool espi_get_channel_status | ( | const struct device * | dev, |
enum espi_channel | ch | ||
) |
#include <zephyr/drivers/espi.h>
Query to see if it a channel is ready.
This routine allows to check if logical channel is ready before use. Note that queries for channels not supported will always return false.
dev | Pointer to the device structure for the driver instance. |
ch | the eSPI channel for which status is to be retrieved. |
true | If eSPI channel is ready. |
false | otherwise. |
|
inlinestatic |
#include <zephyr/drivers/espi.h>
Callback model.
Helper to initialize a struct espi_callback properly.
callback | A valid Application's callback structure pointer. |
handler | A valid handler function pointer. |
evt_type | indicates the eSPI event relevant for the handler. for VWIRE_RECEIVED event the data will indicate the new level asserted |
int espi_read_flash | ( | const struct device * | dev, |
struct espi_flash_packet * | pckt | ||
) |
#include <zephyr/drivers/espi.h>
Sends a read request packet for shared flash.
This routines provides an interface to send a request to read the flash component shared between the eSPI controller and eSPI targets.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of read flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by controller. |
-EIO | General input / output error, failed request to controller. |
int espi_read_lpc_request | ( | const struct device * | dev, |
enum lpc_peripheral_opcode | op, | ||
uint32_t * | data | ||
) |
#include <zephyr/drivers/espi.h>
Reads SOC data from a LPC peripheral with information updated over eSPI.
This routine provides a generic interface to read a block whose information was updated by an eSPI transaction. Reading may trigger a transaction. The eSPI packet is assembled by the HW block.
dev | Pointer to the device structure for the driver instance. |
op | Enum representing opcode for peripheral type and read request. |
data | Parameter to be read from to the LPC peripheral. |
0 | If successful. |
-ENOTSUP | if eSPI peripheral is off or not supported. |
-EINVAL | for unimplemented lpc opcode, but in range. |
int espi_read_request | ( | const struct device * | dev, |
struct espi_request_packet * | req | ||
) |
#include <zephyr/drivers/espi.h>
Sends memory, I/O or message read request over eSPI.
This routines provides a generic interface to send a read request packet.
dev | Pointer to the device structure for the driver instance. |
req | Address of structure representing a memory, I/O or message read request. |
0 | If successful. |
-ENOTSUP | if eSPI controller doesn't support raw packets and instead low memory transactions are handled by controller hardware directly. |
-EIO | General input / output error, failed to send over the bus. |
int espi_receive_oob | ( | const struct device * | dev, |
struct espi_oob_packet * | pckt | ||
) |
#include <zephyr/drivers/espi.h>
Receives SMBus transaction (out-of-band) packet from eSPI bus.
This routines provides an interface to receive and decoded a SMBus transaction from eSPI bus
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the packet representation of SMBus transaction. |
-EIO | General input / output error, failed request to controller. |
int espi_receive_vwire | ( | const struct device * | dev, |
enum espi_vwire_signal | signal, | ||
uint8_t * | level | ||
) |
#include <zephyr/drivers/espi.h>
Retrieves level status for a signal encapsulated in a virtual wire.
This routines provides a generic interface to request a virtual wire packet from eSPI controller and retrieve the signal level.
dev | Pointer to the device structure for the driver instance. |
signal | the signal to be requested from eSPI controller. |
level | the level of signal requested 0b LOW, 1b HIGH. |
-EIO | General input / output error, failed request to controller. |
|
inlinestatic |
#include <zephyr/drivers/espi.h>
Remove an application callback.
dev | Pointer to the device structure for the driver instance. |
callback | A valid application's callback structure pointer. |
callback
. Attempts to remove other registrations on the same device may result in undefined behavior, including failure to invoke callbacks that remain registered and unintended invocation of removed callbacks.Note: enables to remove as many callbacks as added through espi_add_callback().
int espi_saf_activate | ( | const struct device * | dev | ) |
#include <zephyr/drivers/espi_saf.h>
Activate SAF block.
This routine activates the SAF block and should only be called after SAF has been configured and the eSPI Master has enabled the Flash Channel.
dev | Pointer to the device structure for the driver instance. |
0 | If successful |
-EINVAL | if failed to activate SAF. |
|
inlinestatic |
#include <zephyr/drivers/espi_saf.h>
Add an application callback.
dev | Pointer to the device structure for the driver instance. |
callback | A valid Application's callback structure pointer. |
Note: enables to add as many callback as needed on the same device.
int espi_saf_config | ( | const struct device * | dev, |
const struct espi_saf_cfg * | cfg | ||
) |
#include <zephyr/drivers/espi_saf.h>
Configure operation of a eSPI controller.
This routine provides a generic interface to override eSPI controller capabilities.
If this eSPI controller is acting as slave, the values set here will be discovered as part through the GET_CONFIGURATION command issued by the eSPI master during initialization.
If this eSPI controller is acting as master, the values set here will be used by eSPI master to determine minimum common capabilities with eSPI slave then send via SET_CONFIGURATION command.
dev | Pointer to the device structure for the driver instance. |
cfg | the device runtime configuration for the eSPI controller. |
0 | If successful. |
-EIO | General input / output error, failed to configure device. |
-EINVAL | invalid capabilities, failed to configure device. |
-ENOTSUP | capability not supported by eSPI slave. |
int espi_saf_flash_erase | ( | const struct device * | dev, |
struct espi_saf_packet * | pckt | ||
) |
#include <zephyr/drivers/espi_saf.h>
Sends a write request packet for slave attached flash.
This routines provides an interface to send a request to write to the flash components shared between the eSPI master and eSPI slaves.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of erase flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by master. |
-EIO | General input / output error, failed request to master. |
int espi_saf_flash_read | ( | const struct device * | dev, |
struct espi_saf_packet * | pckt | ||
) |
#include <zephyr/drivers/espi_saf.h>
Sends a read request packet for slave attached flash.
This routines provides an interface to send a request to read the flash component shared between the eSPI master and eSPI slaves.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of read flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by master. |
-EIO | General input / output error, failed request to master. |
int espi_saf_flash_unsuccess | ( | const struct device * | dev, |
struct espi_saf_packet * | pckt | ||
) |
#include <zephyr/drivers/espi_saf.h>
Response unsuccessful completion for slave attached flash.
This routines provides an interface to response that transaction is invalid and return unsuccessful completion from target to controller.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by master. |
-EIO | General input / output error, failed request to master. |
int espi_saf_flash_write | ( | const struct device * | dev, |
struct espi_saf_packet * | pckt | ||
) |
#include <zephyr/drivers/espi_saf.h>
Sends a write request packet for slave attached flash.
This routines provides an interface to send a request to write to the flash components shared between the eSPI master and eSPI slaves.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of write flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by master. |
-EIO | General input / output error, failed request to master. |
#include <zephyr/drivers/espi_saf.h>
Query to see if SAF is ready.
This routine allows to check if SAF is ready before use.
dev | Pointer to the device structure for the driver instance. |
true | If eSPI SAF is ready. |
false | otherwise. |
|
inlinestatic |
#include <zephyr/drivers/espi_saf.h>
Callback model.
Helper to initialize a struct espi_callback properly.
callback | A valid Application's callback structure pointer. |
handler | A valid handler function pointer. |
evt_type | indicates the eSPI event relevant for the handler. for VWIRE_RECEIVED event the data will indicate the new level asserted |
|
inlinestatic |
#include <zephyr/drivers/espi_saf.h>
Remove an application callback.
dev | Pointer to the device structure for the driver instance. |
callback | A valid application's callback structure pointer. |
callback
. Attempts to remove other registrations on the same device may result in undefined behavior, including failure to invoke callbacks that remain registered and unintended invocation of removed callbacks.Note: enables to remove as many callbacks as added through espi_add_callback().
int espi_saf_set_protection_regions | ( | const struct device * | dev, |
const struct espi_saf_protection * | pr | ||
) |
#include <zephyr/drivers/espi_saf.h>
Set one or more SAF protection regions.
This routine provides an interface to override the default flash protection regions of the SAF controller.
dev | Pointer to the device structure for the driver instance. |
pr | Pointer to the SAF protection region structure. |
0 | If successful. |
-EIO | General input / output error, failed to configure device. |
-EINVAL | invalid capabilities, failed to configure device. |
-ENOTSUP | capability not supported by eSPI slave. |
int espi_send_oob | ( | const struct device * | dev, |
struct espi_oob_packet * | pckt | ||
) |
#include <zephyr/drivers/espi.h>
Sends SMBus transaction (out-of-band) packet over eSPI bus.
This routines provides an interface to encapsulate a SMBus transaction and send into packet over eSPI bus
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the packet representation of SMBus transaction. |
-EIO | General input / output error, failed request to controller. |
int espi_send_vwire | ( | const struct device * | dev, |
enum espi_vwire_signal | signal, | ||
uint8_t | level | ||
) |
#include <zephyr/drivers/espi.h>
Sends system/platform signal as a virtual wire packet.
This routines provides a generic interface to send a virtual wire packet from target to controller.
dev | Pointer to the device structure for the driver instance. |
signal | The signal to be send to eSPI controller. |
level | The level of signal requested LOW or HIGH. |
0 | If successful. |
-EIO | General input / output error, failed to send over the bus. |
int espi_write_flash | ( | const struct device * | dev, |
struct espi_flash_packet * | pckt | ||
) |
#include <zephyr/drivers/espi.h>
Sends a write request packet for shared flash.
This routines provides an interface to send a request to write to the flash components shared between the eSPI controller and eSPI targets.
dev | Pointer to the device structure for the driver instance. |
pckt | Address of the representation of write flash transaction. |
-ENOTSUP | eSPI flash logical channel transactions not supported. |
-EBUSY | eSPI flash channel is not ready or disabled by controller. |
-EIO | General input / output error, failed request to controller. |
int espi_write_lpc_request | ( | const struct device * | dev, |
enum lpc_peripheral_opcode | op, | ||
uint32_t * | data | ||
) |
#include <zephyr/drivers/espi.h>
Writes data to a LPC peripheral which generates an eSPI transaction.
This routine provides a generic interface to write data to a block which triggers an eSPI transaction. The eSPI packet is assembled by the HW block.
dev | Pointer to the device structure for the driver instance. |
op | Enum representing an opcode for peripheral type and write request. |
data | Represents the parameter passed to the LPC peripheral. |
0 | If successful. |
-ENOTSUP | if eSPI peripheral is off or not supported. |
-EINVAL | for unimplemented lpc opcode, but in range. |
int espi_write_request | ( | const struct device * | dev, |
struct espi_request_packet * | req | ||
) |
#include <zephyr/drivers/espi.h>
Sends memory, I/O or message write request over eSPI.
This routines provides a generic interface to send a write request packet.
dev | Pointer to the device structure for the driver instance. |
req | Address of structure representing a memory, I/O or message write request. |
0 | If successful. |
-ENOTSUP | if eSPI controller doesn't support raw packets and instead low memory transactions are handled by controller hardware directly. |
-EINVAL | General input / output error, failed to send over the bus. |