Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ot] hw/opentitan: ot_spi_host: rework SPI Host #139

Merged

Conversation

rivos-eblot
Copy link

@rivos-eblot rivos-eblot commented Feb 7, 2025

  • fix STATUS.active bit
  • fix command FIFO management
  • add basic SPI bus clock pacing
  • improve FSM scheduling

All SPI Host tests from sw/device/tests now pass

+---------------------------------+--------+----------+--------+-------+
| Name                            | Result |     Time | Icount | Error |
+=================================+========+==========+========+=======+
| spi_host_irq_test               |   PASS |  6668 ms |      6 |       |
+---------------------------------+--------+----------+--------+-------+
| spi_host_macronix1Gb_flash_test |   PASS | 13669 ms |      6 |       |
+---------------------------------+--------+----------+--------+-------+
| spi_host_smoketest              |   PASS |  6786 ms |      6 |       |
+---------------------------------+--------+----------+--------+-------+
| spi_host_winbond_flash_test     |   PASS | 11870 ms |      6 |       |
+---------------------------------+--------+----------+--------+-------+

See #129 for details.

@rivos-eblot rivos-eblot mentioned this pull request Feb 7, 2025
@rivos-eblot rivos-eblot force-pushed the dev/ebl/spihost_active_bit branch from 0f93238 to 5fd3cb6 Compare February 10, 2025 11:42
@rivos-eblot rivos-eblot force-pushed the dev/ebl/spihost_active_bit branch 5 times, most recently from cd9a600 to 2549644 Compare February 11, 2025 09:15
@rivos-eblot rivos-eblot force-pushed the dev/ebl/spihost_active_bit branch from 2549644 to 64f0245 Compare February 11, 2025 11:02
@rivos-eblot rivos-eblot changed the title [ot] hw/opentitan: ot_spi_host: fix STATUS.active bit and add basic clock management [ot] hw/opentitan: ot_spi_host: rework SPI Host Feb 11, 2025
hw/opentitan/ot_spi_host.c Outdated Show resolved Hide resolved
hw/opentitan/ot_spi_host.c Show resolved Hide resolved
docs/opentitan/darjeeling.md Outdated Show resolved Hide resolved
Ideally, this should be implemented as a irq signal to receive
dynamic clock settings from the clock manager. Until ot_clkmgr supports
this feature, use a simple property.

Signed-off-by: Emmanuel Blot <[email protected]>
…ation

Restore configuration that got unexpectedly discarded in "rework SPI event management" commit

Signed-off-by: Emmanuel Blot <[email protected]>
Documentation was misleading: "the command is complete when STATUS.ACTIVE goes low."
It turns out STATUS.active goes low when the last pushed command is completed,
in other words, STATUS.active is not released as soon as a command is complete.

Signed-off-by: Emmanuel Blot <[email protected]>
Update SPI Host doc clarifies that registers are -not- reset upon a SW reset.

Signed-off-by: Emmanuel Blot <[email protected]>
Observing Verilator waves, it seems nothing precludes the SPI HOST FSM
from executing on error.

Signed-off-by: Emmanuel Blot <[email protected]>
Observing Verilator waves, the command FIFO only contains next command,
not the one that is being executed. In other words, there can be 5 in-fly commands,
not 4, as 4 are stored in the command FIFO + 1 is being executed.

Remove CS channel limitation (from 8 to 32 bits) and command tracking value
(from 16 to 32 bits)

Signed-off-by: Emmanuel Blot <[email protected]>
Active command status provides the same information.

Signed-off-by: Emmanuel Blot <[email protected]>
Command completion is handled in a dedicated function.
Add a short delay on command push to yield execution back to the vCPU
before kicking the FSM.

Signed-off-by: Emmanuel Blot <[email protected]>
Remove deprecated Doxygen-like C comments, use QEMU style.

Signed-off-by: Emmanuel Blot <[email protected]>
@rivos-eblot rivos-eblot force-pushed the dev/ebl/spihost_active_bit branch from 76c5a7f to 0a35efd Compare February 11, 2025 14:16
When overriding the parent's reset implementation, the child is responsible
to call its parent's implementation.

Signed-off-by: Emmanuel Blot <[email protected]>
OT_SPI_HOST_IRQ_NUM is no longer used.

Signed-off-by: Emmanuel Blot <[email protected]>
@rivos-eblot rivos-eblot force-pushed the dev/ebl/spihost_active_bit branch from 0a35efd to 1063c4c Compare February 12, 2025 15:25
@rivos-eblot rivos-eblot merged commit 8ace5d2 into lowRISC:ot-earlgrey-9.2.0 Feb 13, 2025
7 checks passed
@rivos-eblot rivos-eblot deleted the dev/ebl/spihost_active_bit branch February 13, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants