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

[ottf,opentitanlib,test] Impl spi device ottf tx console #24380

Merged

Conversation

anthonychen1251
Copy link
Member

@anthonychen1251 anthonychen1251 commented Aug 22, 2024

This PR has three commits that:

  1. Update the opentitanlib SPI console module to support TX direction
  2. Add support for reading data from the Host via the OTTF SPI device console
  3. Test the OTTF spi_device console in TX direction.

Workflow:

  1. Device Ready Signal: Device initiates communication by sending a sync message to Host, signaling its readiness to receive data and its active wait state for an upload command.
  2. Host Initiates Upload: Host responds by issuing an upload command. Following this, Host actively polls the status register, waiting for the BUSY bit to be cleared.
  3. Device Data Processing: Upon receiving the upload command, Device reads data from the payload buffer. After processing, it clears the BUSY bit and enters a busy wait state, anticipating the next upload command.
  4. Host Continues Upload: Host proceeds to send the subsequent upload command, repeating the process from step 2.

Transmission Completion:

  • The write address of the last data chunk will be set to a special address, informing Device that the transmission is completed and Device can stop its busy wait state for further upload commands.

This PR addresses #21726 partially. The support for ujson_ottf will be added in another PR.

@anthonychen1251 anthonychen1251 requested review from a team as code owners August 22, 2024 12:43
@anthonychen1251 anthonychen1251 requested review from HU90m and removed request for a team August 22, 2024 12:43
@anthonychen1251
Copy link
Member Author

cc @timothytrippel

@anthonychen1251 anthonychen1251 force-pushed the impl-spi-device-ottf-tx-console branch 2 times, most recently from 1f6fed2 to f459c6a Compare August 22, 2024 14:08
@anthonychen1251
Copy link
Member Author

The failed test case //sw/device/tests/autogen:plic_all_irqs_test_0_fpga_cw310_test_rom in the CI seems to be unrelated to this PR
https://dev.azure.com/lowrisc/opentitan/_build/results?buildId=158578&view=logs&j=d89e056e-6446-5926-00a7-11a2b28fa178&t=a49a45e3-0956-5a06-797b-44acbb659374&l=6558

This updates the console module to support TX direction by issuing upload
commands. The write address of the last data chunk will be set to a
special address, informing Device that the transmission is completed
and Device can stop its busy wait state for further upload commands.

Signed-off-by: Anthony Chen <antchen@google.com>
This adds support for reading data via the OTTF SPI device console.
Device keeps waiting spi upload commands and then transfers data in
chunks until a transmission complete signal (special address) is
received.

Signed-off-by: Anthony Chen <antchen@google.com>
This tests the OTTF spi_device console in TX direction.

Signed-off-by: Anthony Chen <antchen@google.com>
@anthonychen1251
Copy link
Member Author

Just realized that it's unnecessary to send an extra upload command to inform the Device that the transmission is complete. Update the commits and the comment with the termination approach.

@timothytrippel timothytrippel requested review from timothytrippel and pamaury and removed request for a team August 26, 2024 01:07
Copy link
Contributor

@timothytrippel timothytrippel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @anthonychen1251 !

@timothytrippel timothytrippel merged commit e362675 into lowRISC:master Aug 27, 2024
40 checks passed
@anthonychen1251 anthonychen1251 deleted the impl-spi-device-ottf-tx-console branch September 13, 2024 06:06
@timothytrippel timothytrippel added the CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 label Oct 22, 2024
Copy link

Successfully created backport PR for earlgrey_1.0.0:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants