From f28b7134094c1197ad9bab54729a5cb95a667f3c Mon Sep 17 00:00:00 2001 From: Alexander Williams Date: Wed, 24 Jan 2024 14:17:21 -0800 Subject: [PATCH] [spi_device] Remove generic mode mentions Eliminate remaining mentions of generic mode, as it is no longer supported. Signed-off-by: Alexander Williams --- hw/ip/spi_device/README.md | 46 +++++-------------- hw/ip/spi_device/doc/programmers_guide.md | 2 +- hw/ip/spi_device/dv/env/spi_device_env_cov.sv | 4 -- hw/ip/spi_device/dv/env/spi_device_env_pkg.sv | 2 +- hw/ip/spi_device/rtl/spi_device.sv | 2 +- hw/ip/spi_device/rtl/spi_p2s.sv | 5 +- 6 files changed, 16 insertions(+), 45 deletions(-) diff --git a/hw/ip/spi_device/README.md b/hw/ip/spi_device/README.md index 3e34aee1664e3..d4325de59116a 100644 --- a/hw/ip/spi_device/README.md +++ b/hw/ip/spi_device/README.md @@ -10,20 +10,6 @@ ## Features -### SPI Generic Mode - -- Single-bit wide SPI device interface implementing a raw data transfer protocol - termed "Firmware Operation Mode" - - No address bits, data is sent and received from peripheral pins to/from an - internal buffer - - Intended to be used to bulk-load data into and out of the chip - - Not intended to support EEPROM or other addressing modes (functionality to - come in later versions) -- Supports clock polarity and reverse bit order configurations -- Flexible RX/TX Buffer size within an SRAM range -- Interrupts for RX/TX SRAM FIFO conditions (empty, full, designated level for - RX, TX) - ### SPI Flash/ Passthrough Modes - Support Serial Flash emulation @@ -49,8 +35,7 @@ - 1 TPM command (8b) and 1 address (24bit) buffer - HW controlled wait state - Shared SPI with other SPI Device functionalities. Unique CS# for the TPM - - Flash or Passthrough mode can be active with TPM mode. - Generic and TPM modes are mutually exclusive. + - Flash or Passthrough mode can be active with TPM mode, with the shared pins allowing them to time-multiplex the bus. - HW processed registers for read requests during FIFO mode - TPM_ACCESS_x, TPM_STS_x, TPM_INTF_CAPABILITY, TPM_INT_ENABLE, TPM_INT_STATUS, TPM_INT_VECTOR, TPM_DID_VID, TPM_RID - TPM_HASH_START returns FFh @@ -58,17 +43,7 @@ ## Description -The SPI device module consists of four functions, the generic mode, SPI Flash mode, SPI passthrough mode, and TPM over SPI mode. - -The SPI generic mode is a serial-to-parallel receive (RX) and -parallel-to-serial transmit (TX) full duplex design (single line mode) used to communicate -with an outside host. This first version of the module supports operations -controlled by firmware to dump incoming single-line RX data (SDI) to an -internal RX buffer, and send data from a transmit buffer to single-line TX -output (SDO). The clock for the peripheral data transfer uses the SPI -peripheral pin SCK. In this design the SCK is directly used to drive the -interface logic as its primary clock, which has performance benefits, but incurs -design complications described later. +The SPI device module consists of three functions, SPI Flash mode, SPI passthrough mode, and TPM over SPI mode. The SW can receive TPM commands with payload (address and data) and respond to the read commands with the return data using the TPM submodule in the SPI_DEVICE HWIP. The submodule provides the command, address, write, and read FIFOs for the SW to communicate with the TPM host system. @@ -94,15 +69,16 @@ Mailbox is an exception as it shares the Read command opcode. ### SPI Device Modes and Active Submodules -SPI Device HWIP has three modes + TPM mode, which are "Generic" mode (also known as FwMode), "Flash" mode, and "Passthrough" mode. -Generic mode is exclusive. Flash and Passthrough modes share many parts of the datapath. -TPM mode only shares the SPI and has separate CSb port, which allows that the host sends TPM commands while other SPI mode is active (except Generic mode). +SPI Device HWIP has two flash-like modes + TPM mode. +Flash and Passthrough modes share many parts of the datapath. +With Flash mode, all commands target the internal node, and a special read buffer is available to stream data back to the host in FIFO style. +With Passthrough mode, commands may target the internal node and/or a downstream SPI flash, and the read buffer is not available. +TPM mode only shares the SPI and has separate CSb port, which allows that the host sends TPM commands while other SPI mode is active. -Mode | FwMode | Status | JEDEC | SFDP | Mailbox | Read | Addr4B | Upload | Passthrough ----------|--------|--------|-------|------|---------|------|--------|--------|------------- -Generic | Y | | | | | | | | -Flash | | Y | Y | Y | Y | Y | Y | Y | -Passthru | | Y/N | Y/N | Y/N | Y/N | N | Y | Y | Y +Mode | Status | JEDEC | SFDP | Mailbox | Read | Addr4B | Upload | Passthrough +---------|--------|-------|------|---------|------|--------|--------|------------- +Flash | Y | Y | Y | Y | Y | Y | Y | +Passthru | Y/N | Y/N | Y/N | Y/N | N | Y | Y | Y *Y/N*: Based on INTERCEPT_EN diff --git a/hw/ip/spi_device/doc/programmers_guide.md b/hw/ip/spi_device/doc/programmers_guide.md index ab1aba62f4725..da6ae37e1b141 100644 --- a/hw/ip/spi_device/doc/programmers_guide.md +++ b/hw/ip/spi_device/doc/programmers_guide.md @@ -17,7 +17,7 @@ They are not used in this version of IP. ### Initialization The SW should enable the TPM submodule by writing 1 to the TPM_CFG.en CSR field. -Other SPI_DEVICE features (Generic, Flash, Passthrough) CSRs do not affect the TPM feature. +Other SPI_DEVICE features (Flash, Passthrough) CSRs do not affect the TPM feature. Update TPM_ACCESS_0, TPM_ACCESS_1 CSRs. The TPM submodule uses TPM_ACCESS_x.activeLocality to determine if the TPM_STS is returned to the host system. diff --git a/hw/ip/spi_device/dv/env/spi_device_env_cov.sv b/hw/ip/spi_device/dv/env/spi_device_env_cov.sv index 3090d412c9643..d7e3a204886d7 100644 --- a/hw/ip/spi_device/dv/env/spi_device_env_cov.sv +++ b/hw/ip/spi_device/dv/env/spi_device_env_cov.sv @@ -31,10 +31,6 @@ class spi_device_env_cov extends cip_base_env_cov #(.CFG_T(spi_device_env_cfg)); cp_mode: coverpoint mode; cp_tpm_enabled: coverpoint tpm_enabled; cr_all: cross cp_mode, cp_tpm_enabled { - // FW mode can't run with TPM enabled - // but if we turn the mode on without realling sending transactions, it's fine. - ignore_bins invalid = binsof(cp_mode) intersect { GenericMode } && - binsof(cp_tpm_enabled) intersect { 1 }; } endgroup diff --git a/hw/ip/spi_device/dv/env/spi_device_env_pkg.sv b/hw/ip/spi_device/dv/env/spi_device_env_pkg.sv index 51ba0342fa873..8f6d2097353b0 100644 --- a/hw/ip/spi_device/dv/env/spi_device_env_pkg.sv +++ b/hw/ip/spi_device/dv/env/spi_device_env_pkg.sv @@ -42,7 +42,7 @@ package spi_device_env_pkg; } tpm_cfg_mode_e; typedef enum { - GenericMode, + DisabledMode, FlashMode, PassthroughMode } device_mode_e; diff --git a/hw/ip/spi_device/rtl/spi_device.sv b/hw/ip/spi_device/rtl/spi_device.sv index 1a07c372dcaac..73cec591bc0d2 100644 --- a/hw/ip/spi_device/rtl/spi_device.sv +++ b/hw/ip/spi_device/rtl/spi_device.sv @@ -953,7 +953,7 @@ module spi_device cio_sd_en_o = {2'b 00, tpm_miso_en, 1'b 0}; end else begin : spi_out_flash_passthrough - // SPI Generic, Flash, Passthrough modes + // SPI Flash, Passthrough modes unique case (spi_mode) FlashMode: begin cio_sd_o = internal_sd; diff --git a/hw/ip/spi_device/rtl/spi_p2s.sv b/hw/ip/spi_device/rtl/spi_p2s.sv index 0a1841cfbe20c..4c70b006d2eef 100644 --- a/hw/ip/spi_device/rtl/spi_p2s.sv +++ b/hw/ip/spi_device/rtl/spi_p2s.sv @@ -22,7 +22,7 @@ module spi_p2s // Configuration // If CPHA=1, then the first byte should be delayed. - // But this does not matter in SPI Flash. Only applicable to Generic mode + // But this does not matter in SPI Flash. input cpha_i, // Control @@ -54,8 +54,7 @@ module spi_p2s io_mode_e io_mode; // in Mode3, the logic skips first clock edge to move to next bit. - // This is not necessary for Flash / Passthrough mode. But Generic mode - // sends the data through TX line right after reset + // This is not necessary for Flash / Passthrough mode. logic first_beat, last_beat; count_t cnt;