Lines Matching +full:host +full:- +full:int +full:- +full:gpios
4 * SPDX-License-Identifier: Apache-2.0
44 *+----------------------------------------------------------------------+
46 *| eSPI controller +-------------+ |
47 *| +-----------+ | Power | +----------+ |
49 *| +------------+ |processor | | controller | | sources | |
50 *| | SPI flash | +-----------+ +-------------+ +----------+ |
52 *| +------------+ | | | |
53 *| | | | +--------+ +---------------+ |
55 *| | | +-----+ +--------+ +----------+ +----v-----+ |
58 *| | | | +--------+ +----------+ +----------+ |
60 *| | | | ------+ | | |
62 *| | | +------v-----+ +---v-------v-------------v----+ |
64 *| | | | access +--->+ | |
65 *| | | +------------+ +------------------------------+ |
67 *| | +-----------+ | |
72 *+----------------------------------------------------------------------+
74 * v +-----------------+
75 * +---------+ | | | | | |
77 * +---------+ | + + + + | eSPI bus
81 * +-----------------+
83 *+-----------------------------------------------------------------------+
88 *+-----------------------------------------------------------------------+
118 * 0-eSPI bus in reset, 1-eSPI bus out-of-reset
120 * Note: There is no need to send this callback for in-band reset.
124 /** Indicates the eSPI HW has received channel enable notification from eSPI host,
125 * once the eSPI channel is signal as ready to the eSPI host,
130 /** Indicates the eSPI HW has received a virtual wire message from eSPI host.
135 /** Indicates the eSPI HW has received a Out-of-band package from eSPI host.
139 /** Indicates the eSPI HW has received a peripheral eSPI host event.
258 * Virtual wire GPIOs that can be sent from target to controller for
278 /* USB-C port over current */
380 * @brief eSPI out-of-band transaction packet format
450 typedef int (*espi_api_config)(const struct device *dev, struct espi_cfg *cfg);
454 typedef int (*espi_api_read_request)(const struct device *dev,
456 typedef int (*espi_api_write_request)(const struct device *dev,
458 typedef int (*espi_api_lpc_read_request)(const struct device *dev,
461 typedef int (*espi_api_lpc_write_request)(const struct device *dev,
465 typedef int (*espi_api_send_vwire)(const struct device *dev,
468 typedef int (*espi_api_receive_vwire)(const struct device *dev,
472 typedef int (*espi_api_send_oob)(const struct device *dev,
474 typedef int (*espi_api_receive_oob)(const struct device *dev,
477 typedef int (*espi_api_flash_read)(const struct device *dev,
479 typedef int (*espi_api_flash_write)(const struct device *dev,
481 typedef int (*espi_api_flash_erase)(const struct device *dev,
484 typedef int (*espi_api_manage_callback)(const struct device *dev,
524 * +---------+ +---------+ +------+ +---------+ +---------+
526 * | target | | driver | | bus | | driver | | host |
527 * +--------+ +---------+ +------+ +---------+ +---------+
530 * +--------------+ ctrl regs | cap ctrl reg| +-----------+
531 * | +-------+ | +--------+ |
532 * | |<------+ | +------->| |
536 * | | +<------------------+ |
537 * | |<-----------| | |
539 * | |----------->+ response | |
540 * | | |------------------>+ |
543 * | | +<------------------+ |
545 * | | +------------------>+ |
553 * @retval -EIO General input / output error, failed to configure device.
554 * @retval -EINVAL invalid capabilities, failed to configure device.
555 * @retval -ENOTSUP capability not supported by eSPI target.
557 __syscall int espi_config(const struct device *dev, struct espi_cfg *cfg);
559 static inline int z_impl_espi_config(const struct device *dev, in z_impl_espi_config()
563 (const struct espi_driver_api *)dev->api; in z_impl_espi_config()
565 return api->config(dev, cfg); in z_impl_espi_config()
587 (const struct espi_driver_api *)dev->api; in z_impl_espi_get_channel_status()
589 return api->get_channel_status(dev, ch); in z_impl_espi_get_channel_status()
602 * @retval -ENOTSUP if eSPI controller doesn't support raw packets and instead
604 * @retval -EIO General input / output error, failed to send over the bus.
606 __syscall int espi_read_request(const struct device *dev,
609 static inline int z_impl_espi_read_request(const struct device *dev, in z_impl_espi_read_request()
613 (const struct espi_driver_api *)dev->api; in z_impl_espi_read_request()
615 if (!api->read_request) { in z_impl_espi_read_request()
616 return -ENOTSUP; in z_impl_espi_read_request()
619 return api->read_request(dev, req); in z_impl_espi_read_request()
632 * @retval -ENOTSUP if eSPI controller doesn't support raw packets and instead
634 * @retval -EINVAL General input / output error, failed to send over the bus.
636 __syscall int espi_write_request(const struct device *dev,
639 static inline int z_impl_espi_write_request(const struct device *dev, in z_impl_espi_write_request()
643 (const struct espi_driver_api *)dev->api; in z_impl_espi_write_request()
645 if (!api->write_request) { in z_impl_espi_write_request()
646 return -ENOTSUP; in z_impl_espi_write_request()
649 return api->write_request(dev, req); in z_impl_espi_write_request()
665 * @retval -ENOTSUP if eSPI peripheral is off or not supported.
666 * @retval -EINVAL for unimplemented lpc opcode, but in range.
668 __syscall int espi_read_lpc_request(const struct device *dev,
672 static inline int z_impl_espi_read_lpc_request(const struct device *dev, in z_impl_espi_read_lpc_request()
677 (const struct espi_driver_api *)dev->api; in z_impl_espi_read_lpc_request()
679 if (!api->read_lpc_request) { in z_impl_espi_read_lpc_request()
680 return -ENOTSUP; in z_impl_espi_read_lpc_request()
683 return api->read_lpc_request(dev, op, data); in z_impl_espi_read_lpc_request()
698 * @retval -ENOTSUP if eSPI peripheral is off or not supported.
699 * @retval -EINVAL for unimplemented lpc opcode, but in range.
701 __syscall int espi_write_lpc_request(const struct device *dev,
705 static inline int z_impl_espi_write_lpc_request(const struct device *dev, in z_impl_espi_write_lpc_request()
710 (const struct espi_driver_api *)dev->api; in z_impl_espi_write_lpc_request()
712 if (!api->write_lpc_request) { in z_impl_espi_write_lpc_request()
713 return -ENOTSUP; in z_impl_espi_write_lpc_request()
716 return api->write_lpc_request(dev, op, data); in z_impl_espi_write_lpc_request()
730 * @retval -EIO General input / output error, failed to send over the bus.
732 __syscall int espi_send_vwire(const struct device *dev,
736 static inline int z_impl_espi_send_vwire(const struct device *dev, in z_impl_espi_send_vwire()
741 (const struct espi_driver_api *)dev->api; in z_impl_espi_send_vwire()
743 return api->send_vwire(dev, signal, level); in z_impl_espi_send_vwire()
756 * @retval -EIO General input / output error, failed request to controller.
758 __syscall int espi_receive_vwire(const struct device *dev,
762 static inline int z_impl_espi_receive_vwire(const struct device *dev, in z_impl_espi_receive_vwire()
767 (const struct espi_driver_api *)dev->api; in z_impl_espi_receive_vwire()
769 return api->receive_vwire(dev, signal, level); in z_impl_espi_receive_vwire()
773 * @brief Sends SMBus transaction (out-of-band) packet over eSPI bus.
781 * @retval -EIO General input / output error, failed request to controller.
783 __syscall int espi_send_oob(const struct device *dev,
786 static inline int z_impl_espi_send_oob(const struct device *dev, in z_impl_espi_send_oob()
790 (const struct espi_driver_api *)dev->api; in z_impl_espi_send_oob()
792 if (!api->send_oob) { in z_impl_espi_send_oob()
793 return -ENOTSUP; in z_impl_espi_send_oob()
796 return api->send_oob(dev, pckt); in z_impl_espi_send_oob()
800 * @brief Receives SMBus transaction (out-of-band) packet from eSPI bus.
808 * @retval -EIO General input / output error, failed request to controller.
810 __syscall int espi_receive_oob(const struct device *dev,
813 static inline int z_impl_espi_receive_oob(const struct device *dev, in z_impl_espi_receive_oob()
817 (const struct espi_driver_api *)dev->api; in z_impl_espi_receive_oob()
819 if (!api->receive_oob) { in z_impl_espi_receive_oob()
820 return -ENOTSUP; in z_impl_espi_receive_oob()
823 return api->receive_oob(dev, pckt); in z_impl_espi_receive_oob()
835 * @retval -ENOTSUP eSPI flash logical channel transactions not supported.
836 * @retval -EBUSY eSPI flash channel is not ready or disabled by controller.
837 * @retval -EIO General input / output error, failed request to controller.
839 __syscall int espi_read_flash(const struct device *dev,
842 static inline int z_impl_espi_read_flash(const struct device *dev, in z_impl_espi_read_flash()
846 (const struct espi_driver_api *)dev->api; in z_impl_espi_read_flash()
848 if (!api->flash_read) { in z_impl_espi_read_flash()
849 return -ENOTSUP; in z_impl_espi_read_flash()
852 return api->flash_read(dev, pckt); in z_impl_espi_read_flash()
864 * @retval -ENOTSUP eSPI flash logical channel transactions not supported.
865 * @retval -EBUSY eSPI flash channel is not ready or disabled by controller.
866 * @retval -EIO General input / output error, failed request to controller.
868 __syscall int espi_write_flash(const struct device *dev,
871 static inline int z_impl_espi_write_flash(const struct device *dev, in z_impl_espi_write_flash()
875 (const struct espi_driver_api *)dev->api; in z_impl_espi_write_flash()
877 if (!api->flash_write) { in z_impl_espi_write_flash()
878 return -ENOTSUP; in z_impl_espi_write_flash()
881 return api->flash_write(dev, pckt); in z_impl_espi_write_flash()
893 * @retval -ENOTSUP eSPI flash logical channel transactions not supported.
894 * @retval -EBUSY eSPI flash channel is not ready or disabled by controller.
895 * @retval -EIO General input / output error, failed request to controller.
897 __syscall int espi_flash_erase(const struct device *dev,
900 static inline int z_impl_espi_flash_erase(const struct device *dev, in z_impl_espi_flash_erase()
904 (const struct espi_driver_api *)dev->api; in z_impl_espi_flash_erase()
906 if (!api->flash_erase) { in z_impl_espi_flash_erase()
907 return -ENOTSUP; in z_impl_espi_flash_erase()
910 return api->flash_erase(dev, pckt); in z_impl_espi_flash_erase()
917 *+-------+ +-------------+ +------+ +---------+
918 *| App | | eSPI driver | | HW | |eSPI Host|
919 *+---+---+ +-------+-----+ +---+--+ +----+----+
922 * +----------------------------> | | |
924 * +----------------------------->+ |
925 * | | | eSPI reset | eSPI host
926 * | | IRQ +<------------+ resets the
927 * | | <-----------+ | bus
928 * |<-----------------------------| | |
933 * | | | VW CH ready| eSPI host
934 * | | IRQ +<------------+ enables VW
935 * | | <-----------+ | channel
942 * | | <-------------+ event
943 * | +<------------+ |
944 * +<-----------------------------+ callback | |
948 * | | | SLP_S5 | eSPI host
949 * | | <-------------+ send VWire
950 * | +<------------+ |
951 * +<-----------------------------+ callback | |
956 * +------------------------------>------------>|------------>|
958 * | | | HOST_RST | eSPI host
959 * | | <-------------+ send VWire
960 * | +<------------+ |
961 * +<-----------------------------+ callback | |
962 * | App reset host-related | | |
965 * | | | C10 | eSPI host
966 * | | +<------------+ send VWire
967 * | <-------------+ |
968 * <------------------------------+ | |
989 callback->handler = handler; in espi_init_callback()
990 callback->evt_type = evt_type; in espi_init_callback()
1005 static inline int espi_add_callback(const struct device *dev, in espi_add_callback()
1009 (const struct espi_driver_api *)dev->api; in espi_add_callback()
1011 if (!api->manage_callback) { in espi_add_callback()
1012 return -ENOTSUP; in espi_add_callback()
1015 return api->manage_callback(dev, callback, true); in espi_add_callback()
1034 static inline int espi_remove_callback(const struct device *dev, in espi_remove_callback()
1038 (const struct espi_driver_api *)dev->api; in espi_remove_callback()
1040 if (!api->manage_callback) { in espi_remove_callback()
1041 return -ENOTSUP; in espi_remove_callback()
1044 return api->manage_callback(dev, callback, false); in espi_remove_callback()