Skip to content

Commit 6fddc44

Browse files
niedzwiecki-dawidfabiobaltieri
authored andcommitted
mgmt: ec_host_cmd: add USB backend
Add a new ec_host_cmd backend based on USB. The backend uses the new USB device stack. The backend implements a vendor-specific (Google) USB interface. It uses three endpoints: - bulk OUT to transfer a host command request - bulk IN to transfer a host command response - interrupt IN to signal an event and readiness of the response Signed-off-by: Dawid Niedzwiecki <[email protected]>
1 parent da61ccc commit 6fddc44

File tree

5 files changed

+701
-0
lines changed

5 files changed

+701
-0
lines changed

include/zephyr/mgmt/ec_host_cmd/backend.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ struct ec_host_cmd_backend *ec_host_cmd_backend_get_uart(const struct device *de
162162
*/
163163
struct ec_host_cmd_backend *ec_host_cmd_backend_get_spi(struct gpio_dt_spec *cs);
164164

165+
/**
166+
* @brief Signal event over USB
167+
*
168+
* Signal event using USB interrupt endpoint. It informs host that there is a pending event that has
169+
* to be handled. The function performs remote wake-up if needed.
170+
*/
171+
void ec_host_cmd_backend_usb_trigger_event(void);
172+
165173
/**
166174
* @}
167175
*/

subsys/mgmt/ec_host_cmd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ config EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE
4949

5050
config EC_HOST_CMD_HANDLER_BUFFER_ALIGN
5151
int "Memory alignment for the tx/rx buffers"
52+
default DCACHE_LINE_SIZE if (DCACHE_LINE_SIZE > 0) && EC_HOST_CMD_BACKEND_USB
5253
default 4
5354
help
5455
Some interfaces need a special memory alignment to work properly. Use that config

subsys/mgmt/ec_host_cmd/backends/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ zephyr_library_sources_ifdef(
2525
zephyr_library_sources_ifdef(
2626
CONFIG_EC_HOST_CMD_BACKEND_SPI_STM32
2727
ec_host_cmd_backend_spi_stm32.c)
28+
29+
zephyr_library_sources_ifdef(
30+
CONFIG_EC_HOST_CMD_BACKEND_USB
31+
ec_host_cmd_backend_usb.c)

subsys/mgmt/ec_host_cmd/backends/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,10 @@ config EC_HOST_CMD_BACKEND_UART_TIMEOUT
132132
chunk.
133133

134134
endif # EC_HOST_CMD_BACKEND_UART
135+
136+
config EC_HOST_CMD_BACKEND_USB
137+
bool "Host commands support using USB"
138+
default y
139+
depends on USB_DEVICE_STACK_NEXT
140+
help
141+
Enable support for Embedded Controller host commands using the USB.

0 commit comments

Comments
 (0)