Skip to content

projects/ad738x_fmc: add DMA gate to SPI offload trigger #1807

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dlech
Copy link
Collaborator

@dlech dlech commented Jul 1, 2025

This is a patch that I have been using locally for quite a while while working on the Linux driver for AD738x. I've also been discussing with @LBFFilho if this is sufficient or if additional fixes are needed, but from a bunch of testing, this seems to be working well.

PR Description

Add an AND gate to disable the SPI offload trigger when the DMA is full.

Before this change, when NUM_OF_SDI=1, the SPI offload would pause in the middle of a SPI message when the DMA got full which confused both the DMA controller and the ADC chip causing data channels to become misalligned in memory.

After this change, the trigger is prevented from firing when the DMA is full so the SPI message doesn't even start, avoiding the problems mentioned above.

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)
  • Documentation

PR Checklist

  • I have followed the code style guidelines
  • I have performed a self-review of changes
  • I have compiled all hdl projects and libraries affected by this PR
  • I have tested in hardware affected projects, at least on relevant boards
  • I have commented my code, at least hard-to-understand parts
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe files, Copyright etc)
  • I have not introduced new Warnings/Critical Warnings on compilation
  • I have added new hdl testbenches or updated existing ones

Add an AND gate to disable the SPI offload trigger when the DMA is full.

Before this change, when NUM_OF_SDI=1, the SPI offload would pause in the
middle of a SPI message when the DMA got full which confused both the DMA
controller and the ADC chip causing data channels to become misalligned in
memory.

After this change, the trigger is prevented from firing when the DMA is full
so the SPI message doesn't even start, avoiding the problems mentioned above.

Signed-off-by: David Lechner <dlechner@baylibre.com>
@dlech dlech requested review from sarpadi and PIoandan as code owners July 1, 2025 18:38
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.

1 participant