Skip to content

Commit

Permalink
[spi_device] Remove generic mode mentions
Browse files Browse the repository at this point in the history
Eliminate remaining mentions of generic mode, as it is no longer
supported.

Signed-off-by: Alexander Williams <[email protected]>
  • Loading branch information
a-will committed Feb 2, 2024
1 parent dd11737 commit f28b713
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 45 deletions.
46 changes: 11 additions & 35 deletions hw/ip/spi_device/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,26 +35,15 @@
- 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
- 5 Locality (compile-time parameter)

## 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.
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion hw/ip/spi_device/doc/programmers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions hw/ip/spi_device/dv/env/spi_device_env_cov.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion hw/ip/spi_device/dv/env/spi_device_env_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package spi_device_env_pkg;
} tpm_cfg_mode_e;

typedef enum {
GenericMode,
DisabledMode,
FlashMode,
PassthroughMode
} device_mode_e;
Expand Down
2 changes: 1 addition & 1 deletion hw/ip/spi_device/rtl/spi_device.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions hw/ip/spi_device/rtl/spi_p2s.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f28b713

Please sign in to comment.