Add support for SPI host command backend for STM32 chips family. Unfortunately, the current SPI API can't be used to handle the host commands communication. The main issues are unknown command size sent by the host(the SPI transaction sends/receives specific number of bytes) and need to constant sending status byte(the SPI module is enabled and disabled per transaction). Thus the SPI backend includes basic SPI STM32 driver adjusted to host command specification. Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
106 lines
3.4 KiB
Plaintext
106 lines
3.4 KiB
Plaintext
# Host command handler functionality
|
|
|
|
# Copyright (c) 2020 Google LLC
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menu "Host command handler subsystem"
|
|
|
|
config EC_HOST_CMD
|
|
bool "Support Embedded Controller host command handler subsystem"
|
|
help
|
|
Enable host command processing for embedded controllers on notebook
|
|
computers.
|
|
|
|
if EC_HOST_CMD
|
|
|
|
module = EC_HC
|
|
module-str = ec-host-commands
|
|
source "subsys/logging/Kconfig.template.log_config"
|
|
|
|
config EC_HOST_CMD_HANDLER_STACK_SIZE
|
|
int "Stack size for the EC host command handler thread"
|
|
default 800
|
|
|
|
config EC_HOST_CMD_HANDLER_TX_BUFFER_SIZE
|
|
int "Buffer size in bytes for TX buffer shared by all EC host commands"
|
|
default 0 if EC_HOST_CMD_BACKEND_ESPI
|
|
default 0 if EC_HOST_CMD_BACKEND_SHI
|
|
default 256 if EC_HOST_CMD_BACKEND_UART
|
|
default 552 if EC_HOST_CMD_BACKEND_SPI
|
|
default 256
|
|
help
|
|
Buffer size in bytes for TX buffer defined by the host command handler.
|
|
Some backend layers can define their own buffer, so the size can be zero to
|
|
avoid duplicating buffers. If multiple backends are used, the size has to be
|
|
set by user to the largest one.
|
|
|
|
config EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE
|
|
int "Buffer size in bytes for RX buffer shared by all EC host commands"
|
|
default 256 if EC_HOST_CMD_BACKEND_ESPI
|
|
default 0 if EC_HOST_CMD_BACKEND_SHI
|
|
default 544 if EC_HOST_CMD_BACKEND_UART
|
|
default 544 if EC_HOST_CMD_BACKEND_SPI
|
|
default 256
|
|
help
|
|
Buffer size in bytes for TX buffer defined by the host command handler.
|
|
Some backend layers can define their own buffer, so the size can be zero to
|
|
avoid duplicating buffers. If multiple backends are used, the size has to be
|
|
set by user to the largest one.
|
|
|
|
config EC_HOST_CMD_HANDLER_PRIO
|
|
int "Priority of host command task"
|
|
default 13
|
|
help
|
|
Priority of the kernel task that handles the host commands.
|
|
If the priority is too low (high in value), the host commands handler may be unable to
|
|
process the command on time and the AP will abort the waiting for response and be unable
|
|
to boot the system properly.
|
|
|
|
config EC_HOST_CMD_INIT_PRIORITY
|
|
int "Initialization priority"
|
|
default 80
|
|
range 0 99
|
|
help
|
|
Initialization priority for Host Command. It must be higher than the initialization
|
|
priority of the used backend device.
|
|
|
|
config EC_HOST_CMD_HANDLER_TX_BUFFER_DEF
|
|
bool
|
|
default y if EC_HOST_CMD_HANDLER_TX_BUFFER_SIZE > 0
|
|
help
|
|
The handler defines common tx buffer
|
|
|
|
config EC_HOST_CMD_HANDLER_RX_BUFFER_DEF
|
|
bool
|
|
default y if EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE > 0
|
|
help
|
|
The handler defines common rx buffer
|
|
|
|
config EC_HOST_CMD_INITIALIZE_AT_BOOT
|
|
bool "Initialize the host command subsystem automacitlly"
|
|
default y
|
|
help
|
|
Automatically initialize the host command subsystem with the chosen backend.
|
|
The ec_host_cmd_init function is called by the chosen backend.
|
|
|
|
config EC_HOST_CMD_DEDICATED_THREAD
|
|
bool "Create a new task for host command"
|
|
help
|
|
The ec_host_cmd_init function creates a new thread dedicated for Host Command.
|
|
Otherwise the ec_host_cmd_task function has to be called within another thread.
|
|
|
|
config EC_HOST_CMD_IN_PROGRESS_STATUS
|
|
bool "Save status of last IN_PROGRESS command"
|
|
default y if EC_HOST_CMD_BACKEND_SHI
|
|
help
|
|
Enable support for saving final status of a last command that has sent
|
|
EC_HOST_CMD_IN_PROGRESS status. The saved status can be get with the
|
|
ec_host_cmd_send_in_progress_status function.
|
|
|
|
source "subsys/mgmt/ec_host_cmd/Kconfig.logging"
|
|
source "subsys/mgmt/ec_host_cmd/backends/Kconfig"
|
|
|
|
endif # EC_HOST_CMD
|
|
|
|
endmenu
|