Skip to content

Conversation

jwnrt
Copy link

@jwnrt jwnrt commented Sep 24, 2025

Read commands automatically increment the address so the last read address register was too high. We still need to do the register assignment on CS deassert to match the RTL (see Alex's comment below).

I tested this against the OpenTitan spi_device_flash_smoketest.

Copy link

@AlexJones0 AlexJones0 left a comment

Choose a reason for hiding this comment

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

I don't know OpenTitan's SPI device well but this looks correct to me from the docs and code.

Some relevant links I found if it helps anyone else reviewing:

The LAST_READ_ADDR shows the last read address of the recent read command. For instance, if the host system issues 0xABCD_E000 and reads 128 (or 0x80) bytes, the LAST_READ_ADDR after the transaction will show 0xABCD_E07F. It does not show the commands falling into the mailbox region or Read SFDP command’s address

@jwnrt jwnrt force-pushed the jw/spi-device-last-read-addr branch from 39bca91 to 6491d7f Compare September 24, 2025 09:50
@jwnrt jwnrt requested a review from AlexJones0 September 24, 2025 09:51
@jwnrt
Copy link
Author

jwnrt commented Sep 24, 2025

Thanks for the links

Read commands automatically increment the address so the last read
address register was too high.

I don't want to assign to this register before we do the increment
because the OpenTitan docs say it's only updated on CS release.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
@jwnrt jwnrt force-pushed the jw/spi-device-last-read-addr branch from 6491d7f to 70ed529 Compare September 24, 2025 09:58
Copy link

@AlexJones0 AlexJones0 left a comment

Choose a reason for hiding this comment

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

Thanks @jwnrt, this LGTM now.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
Copy link

@rivos-eblot rivos-eblot left a comment

Choose a reason for hiding this comment

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

LGTM

@jwnrt jwnrt merged commit b2fca61 into lowRISC:ot-9.2.0 Sep 24, 2025
8 checks passed
@jwnrt jwnrt deleted the jw/spi-device-last-read-addr branch September 24, 2025 10:37
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.

3 participants