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

RFC: LiteSDCard: Add support for DMA/data completion interrupts #16

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Commits on Oct 14, 2023

  1. mmc: litex_mmc: use BIT() macros for IRQ registers

    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    f3fdb53 View commit details
    Browse the repository at this point in the history
  2. mmc: litex_mmc: move completion setup to irq_init

    Initializing completion(s) belongs with the rest of the IRQ support
    setup, in `irq_init()`.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    c040c28 View commit details
    Browse the repository at this point in the history
  3. mmc: litex_mmc: wait for data completion outside cmd handler

    Setting up DMA data transfers happens outside (and before) the call
    to `send_cmd()`; therefore, wait for their completion also outside
    (and after) the `send_cmd()` call.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    1af3e8a View commit details
    Browse the repository at this point in the history
  4. mmc: litex_mmc: isolate cmd irq heuristic

    Separate the criteria for selecting commands that should use IRQ
    into an explicit Boolean flag.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    1f7136d View commit details
    Browse the repository at this point in the history
  5. mmc: litex_mmc: fix cmd irq/completion sequencing

    To ensure interrupts cannot be missed, we must (re)initialize
    completions *before* setting up any transaction that will result
    in the assertion of an interrupt. Waiting for completion should
    follow *after* the hardware transaction setup, and before proceeding
    with e.g. a polling loop acting as fall-back for when IRQ support
    is unavailable.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    5a7c053 View commit details
    Browse the repository at this point in the history
  6. mmc: litex_mmc: switch cmd_done irq to edge-triggered

    Switch from *level* to *edge* triggered IRQ mode for the command
    completion interrupt. The SDIRQ_CMD_DONE interrupt will no longer
    have to be toggled by the interrupt handler, laying the groundwork
    for supporting (edge-triggered) data/dma completion interrupts in
    a subsequent patch.
    
    NOTE: this requires the underlying LiteX gateware to be newer
    than commit #XXXXXXXX ("integration/soc/add_sdcard: switch to
    edge-triggered cmd-done irq")
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    f1557fa View commit details
    Browse the repository at this point in the history
  7. mmc: litex_mmc: use irq for all commands

    Instead of heuristically selecting "slow" commands to use
    interrupts, leaving "fast" ones to use polling, apply IRQ
    handling equally to *all* commands.
    
    The measured transfer times decreased slightly for some LiteX
    designs (e.g., using VexRiscv/NaxRiscv), and did not increase
    measurably for others (e.g., using RocketChip).
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    66074a0 View commit details
    Browse the repository at this point in the history
  8. mmc: litex_mmc: turn off IRQs on driver removal

    Ensure that interrupts are turned off as part of removing the driver.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    10240a9 View commit details
    Browse the repository at this point in the history
  9. mmc: litex_mmc: ack all handled IRQs together

    Collect handled IRQs and ack them all together with
    a single MMIO port write.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    1491670 View commit details
    Browse the repository at this point in the history
  10. mmc: litex_mmc: add IRQ support for DMA data xfers

    Add support for utilizing interrupts generated by LiteSDCard when
    DMA data transfers complete.
    
    Signed-off-by: Gabriel Somlo <[email protected]>
    gsomlo committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    b695cee View commit details
    Browse the repository at this point in the history