diff options
author | Firas Sammoura <fsammoura@google.com> | 2022-06-17 16:41:11 +0000 |
---|---|---|
committer | Firas Sammoura <fsammoura@google.com> | 2022-06-17 16:41:11 +0000 |
commit | 6c1587ca70f558b4f96b3f0b18ad8b027d3ba99d (patch) | |
tree | 9a15b4a98d7987870a1805a33883d0cf9123fc05 /chip/stm32/usb_spi.h | |
parent | 63a8a1366e390b757c37e167927102be0fc4fb63 (diff) | |
parent | a46d3f3feaac0d69012f61b66f652bff991d05a7 (diff) | |
download | chrome-ec-6c1587ca70f558b4f96b3f0b18ad8b027d3ba99d.tar.gz |
Merge remote-tracking branch cros/main into firmware-fpmcu-dartmonkey-release
Generated by: ./util/update_release_branch.py --board dartmonkey --relevant_paths_file ./util/fingerprint-relevant-paths.txt firmware-fpmcu-dartmonkey-release
Relevant changes:
git log --oneline 63a8a1366e..a46d3f3fea -- board/nocturne_fp
board/dartmonkey common/fpsensor docs/fingerprint driver/fingerprint
util/getversion.sh
981fb88cf8 docs/fingerprint: Resolve contradictory FPMCU factory flashing instructions
60032a8828 docs/fingerprint: Clean up formatting in fingerprint-factory-quick-guide.md
f49eb6f894 docs/fingerprint: Run mdformat
64aa5fc7bb docs/fingerprint: Add links to info on fuzz testing
8bd99cc434 fpsensor: Use correct return type
2b2d7a991d fpsensor: Use correct return type
BRANCH=None
BUG=b:234772776 b:234181908
TEST=`make -j buildall`
Cq-Include-Trybots: chromeos/cq:cq-orchestrator
Signed-off-by: Firas Sammoura <fsammoura@google.com>
Change-Id: I1714a77d292aad81bdc71982c88b2b067cfdada7
Diffstat (limited to 'chip/stm32/usb_spi.h')
-rw-r--r-- | chip/stm32/usb_spi.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/chip/stm32/usb_spi.h b/chip/stm32/usb_spi.h index a1be2c11fb..fa86ba3651 100644 --- a/chip/stm32/usb_spi.h +++ b/chip/stm32/usb_spi.h @@ -232,6 +232,30 @@ * * packet id: 2 byte enum USB_SPI_PKT_ID_CMD_RESTART_RESPONSE * + * Command chip select Packet (Host to Device): + * + * +----------------+-------------+ + * | packet id : 2B | action : 2B | + * +----------------+-------------+ + * + * packet id: 2 byte enum USB_SPI_PKT_ID_CMD_CHIP_SELECT + * + * action: 2 byte, current options: + * 0: Deassert chip select + * 1: Assert chip select + * + * Response chip select Packet (Device to Host): + * + * +----------------+------------------+ + * | packet id : 2B | status code : 2B | + * +----------------+------------------+ + * + * packet id: 2 byte enum USB_SPI_PKT_ID_RSP_CHIP_SELECT + * + * status code: 2 byte status code + * 0x0000: Success + * others: Error + * * USB Error Codes: * * send_command return codes have the following format: @@ -280,6 +304,12 @@ enum packet_id_type { USB_SPI_PKT_ID_RSP_TRANSFER_START = 5, /* Additional packets containing read payload. */ USB_SPI_PKT_ID_RSP_TRANSFER_CONTINUE = 6, + /* + * Request assertion or deassertion of chip select + */ + USB_SPI_PKT_ID_CMD_CHIP_SELECT = 7, + /* Response to above request. */ + USB_SPI_PKT_ID_RSP_CHIP_SELECT = 8, }; enum feature_bitmap { @@ -314,6 +344,21 @@ struct usb_spi_continue_v2 { uint8_t data[USB_SPI_PAYLOAD_SIZE_V2_CONTINUE]; } __packed; +enum chip_select_flags { + /* Indicates chip select should be asserted. */ + USB_SPI_CHIP_SELECT = BIT(0) +}; + +struct usb_spi_chip_select_command { + uint16_t packet_id; + uint16_t flags; +} __packed; + +struct usb_spi_chip_select_response { + uint16_t packet_id; + uint16_t status_code; +} __packed; + struct usb_spi_packet_ctx { union { uint8_t bytes[USB_MAX_PACKET_SIZE]; @@ -323,6 +368,8 @@ struct usb_spi_packet_ctx { struct usb_spi_response_configuration_v2 rsp_config; struct usb_spi_response_v2 rsp_start; struct usb_spi_continue_v2 rsp_continue; + struct usb_spi_chip_select_command cmd_cs; + struct usb_spi_chip_select_response rsp_cs; } __packed; /* * By storing the number of bytes in the header and knowing that the @@ -392,6 +439,8 @@ enum usb_spi_mode { USB_SPI_MODE_IDLE = 0, /* Indicates the device needs to send it's USB SPI configuration.*/ USB_SPI_MODE_SEND_CONFIGURATION, + /* Indicates the device needs to respond to chip select. */ + USB_SPI_MODE_SEND_CHIP_SELECT_RESPONSE, /* Indicates we device needs start the SPI transfer. */ USB_SPI_MODE_START_SPI, /* Indicates we should start a transfer response. */ |