Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

SPI Host: FSM Bug CSID Switch #390

Closed
crsystems opened this issue Apr 21, 2022 · 0 comments · Fixed by #394
Closed

SPI Host: FSM Bug CSID Switch #390

crsystems opened this issue Apr 21, 2022 · 0 comments · Fixed by #394

Comments

@crsystems
Copy link

The OpenTitan SPI host FSM contains a bug as it jumps to the WaitIdle state after receiving a command with a different CSID as the previous command. It therefore basically always skips the first command after a CSID change which this patch rectifies (OpenTitan does it the same way).

diff --git a/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv b/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv
index 4fb1360d..babb6138 100644
--- a/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv
+++ b/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv
@@ -290,7 +290,7 @@ module spi_host_fsm
           if (idle_cntr_q == 4'h0) begin
             prestall_st_d = WaitLead;
           end else begin
-            prestall_st_d = WaitIdle;
+            prestall_st_d = CSBSwitch;
           end
         end
         IdleCSBActive: begin
paulsc96 added a commit that referenced this issue Apr 25, 2022
paulsc96 added a commit that referenced this issue Apr 26, 2022
* spi_host: More fixes (#390, #393)

* vendor: Add `spi_host` fix
colluca pushed a commit to pulp-platform/occamy that referenced this issue Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant