opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

[ip/spi_device] Software Usage

Open eunchan opened this issue 7 years ago • 9 comments

Current SPI_DEVICE module has wrong interrupt connections for tx full, tx empty, rx not empty. Those are connected to the Asynchronous FIFO used between SRAM FIFO and SPI Clock domain logic. RX level and TX level connect to the SRAM FIFO.

The question is: do we need any info from the SPI_DEVICE SRAM FIFO (2kB) other than the levels? I think SRAM RX FULL interrupt might be needed even the logic has rx level interrupt (triggers when RX depth is greater than the configured depth). TX SRAM FIFO case, I am not sure the software needs TX Empty interrupt or not. empty can happen every time the all the data sent out to the host.

CC: @tjaychen @weicaiyang

eunchan avatar Aug 21 '19 23:08 eunchan

Personally I think the the tx empty interrupt is nice to have, especially if software does a bulk transfer of data and just wants to know when it completes.

I think the reality is that they'll use level way more often on big transfers to make sure things never stall and just continuously fill in, but it's probably very nice to have the flexibility.

Can TX level just be used for empty? (program no data left?)

tjaychen avatar Aug 21 '19 23:08 tjaychen

Can TX level just be used for empty? (program no data left?)

If the level is set to 1 then yes, it detects when TX depth goes to 0 (empty) it generates an interrupt.

eunchan avatar Aug 22 '19 00:08 eunchan

Yeah then I'd say just get rid of the tx empty interrupt then, it's functionally a subset of the level right? Speaking of which, I should probably do the same for flash

On Wed, Aug 21, 2019, 17:24 Eunchan Kim [email protected] wrote:

Can TX level just be used for empty? (program no data left?)

If the level is set to 1 then yes, it detects when TX depth goes to 0 (empty) it generates an interrupt.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lowRISC/opentitan/issues/5?email_source=notifications&email_token=AAH2RSSEFOT3MK2KZNQZ2TDQFXMDXA5CNFSM4IOPGJHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43P6QY#issuecomment-523697987, or mute the thread https://github.com/notifications/unsubscribe-auth/AAH2RSSCFMA2DFQE5JHVSZTQFXMDXANCNFSM4IOPGJHA .

tjaychen avatar Aug 22 '19 00:08 tjaychen

@moidx If you have a time later (after repo migrated), could you also comment here?

eunchan avatar Aug 31 '19 01:08 eunchan

I agree that rxlvl and txlvl interrupts fulfill most use cases, and that it is ok to remove txempty.

How do we handle overflows at the moment? Would it be ok to add support for rxoverflow. We can discuss this further here or on a separate issue.

Also, there are some emulated protocols running on top of SPI dev that operate at the frame boundary. In such cases, cs_deassert (and sometimes cs_assert) interrupts are useful to manage the abstraction. I can open a separate issue to investigate if there is a need to adding support for this in OpenTitan.

moidx avatar Sep 05 '19 21:09 moidx

the plan is probably to implement the CS de-assert read back status. The interrupt will likely be held until later. Fork this issue into two.

tjaychen avatar Sep 23 '19 21:09 tjaychen

@tjaychen or @eunchan is this closed now?

sjgitty avatar Oct 25 '19 05:10 sjgitty

@tjaychen @eunchan ping

aytong avatar Nov 01 '19 00:11 aytong

Yes. Can be close now.

eunchan avatar Nov 01 '19 06:11 eunchan