Skip to content

SPI Host should not start FSM on some error types #147

Description

@rivos-eblot
  1. If CSID is invalid, CSID is assigned the default CSID, but the FSM should not be started.
    Using the following patch:

    --- a/sw/device/tests/spi_host_irq_test.c
    +++ b/sw/device/tests/spi_host_irq_test.c
    @@ -276,6 +276,8 @@ static status_t rx_full_event_irq(void) {
       static_assert(kRxFifoLen <= UINT16_MAX, "kRxFifoLen must fit in uint16_t");
       irq_fired = UINT32_MAX;
     
    +  mmio_region_write32(spi_host.base_addr, SPI_HOST_CSID_REG_OFFSET, 1);
    +
       dif_spi_host_status_t status;
       TRY(dif_spi_host_get_status(&spi_host, &status));
       TRY_CHECK(!status.rx_full);

    Commands for the dummy read are pushed into the CMD FIFO, the firsrt command is handled, but FSM stays @ IDLE (and the test deadlock, waiting on WFI: 2000115c 10500073 wfi which never happens)
    Image
    The command is therefore not handled, and remaining commands are not popped up from the command FIFO.

  2. If the command is invalid (typically dual/quad + bidirectional transfer), the FSM behavior is somewhat similar
    Using the following patch:

    --- a/sw/device/tests/spi_host_irq_test.c
    +++ b/sw/device/tests/spi_host_irq_test.c
    @@ -257,8 +257,8 @@ static status_t dummy_read_from_flash(uint32_t address, uint16_t len) {
       uint8_t opcode = kSpiDeviceFlashOpReadNormal;
       TRY(dif_spi_host_fifo_write(&spi_host, &opcode, sizeof(opcode)));
       TRY(dif_spi_host_write_command(&spi_host, sizeof(opcode),
    -                                 kDifSpiHostWidthStandard,
    -                                 kDifSpiHostDirectionTx, false));
    +                                 kDifSpiHostWidthQuad,
    +                                 kDifSpiHostDirectionBidirectional, false));
       TRY(dif_spi_host_fifo_write(&spi_host, &address, kAddressSize));
       TRY(dif_spi_host_write_command(&spi_host, kAddressSize,
                                      kDifSpiHostWidthStandard,     }

    Commands for the dummy read are pushed into the CMD FIFO, the firsrt command is handled, but FSM stays @ IDLE (and the test deadlock, waiting on WFI: 20001158 10500073 wfi which never happens)
    Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions