Repository navigation
[sw] Add SPI device driver and smoketest - #266
Conversation
marnovandermaas
left a comment
There was a problem hiding this comment.
Just had a few comments for the hardware. The tests look good to me and thanks for adding these. It would be good to get @engdoreis to have a look at the tests as well for a review.
engdoreis
left a comment
There was a problem hiding this comment.
Thanks for this PR, this will unblock the bootloader, I left a few comments:
| // [23:16]: Number of parameter headers, zero-based (JESD216F 6.2.2) | ||
| // [31:24]: SFDP access protocol (JESD216F 6.2.3) | ||
| DEV_WRITE(buf_ptr, | ||
| reg32_field( 7, 0, SPI_DEVICE_SFDP_MINOR_REVISION) | |
There was a problem hiding this comment.
I think that the content of the table should come from the app via a struct, but I'm ok to merge as is because it serves the purpose of the test.
There was a problem hiding this comment.
Thanks for your suggestion, perhaps that can be a future enhancement
524122f to
5a4ca83
Compare
engdoreis
left a comment
There was a problem hiding this comment.
I left one more comment, otherwise LGTM.
This driver is based on the silicon creator SPI device driver in opentitan at `sw/device/silicon_creator/lib/drivers/spi_device.*` The initialisation function configures flash commands and writes the SFDP table content.
To be used with ftditool in CI
marnovandermaas
left a comment
There was a problem hiding this comment.
Let's merge this to make progress!
Closes #242
Testing on FPGA can be done with the FT4222H dongle and ftditool by running
nix shell git+ssh://git@github.com/lowrisc/ftditool.JEDEC ID read can be done by running
ftditool jedec, which should return:Jedec: mem_type: 0x8 capacity: 0x14 mid: 0xefSFDP read can be done by running
ftditool sfdp, which should return:Sfdp: { header: SfdpHeader: { signature: 0x50444653 minor: 10 major: 1 num_headers: 0 access_proto: 0xff} parameter: ParamHeader: { id: 0xff00 minor: 7 major: 1 length: 23 table_offset: 0x4} }Flash read write test can be done by running
ftditool test-page, which should return:page read 0x0 : Array<256>: {5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a, 5a,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