Skip to content

Fix handling of cmd_done flag#54

Merged
enjoy-digital merged 2 commits intoenjoy-digital:masterfrom
LnnrtS:fix_cmd_done_flag
Feb 10, 2026
Merged

Fix handling of cmd_done flag#54
enjoy-digital merged 2 commits intoenjoy-digital:masterfrom
LnnrtS:fix_cmd_done_flag

Conversation

@LnnrtS
Copy link
Contributor

@LnnrtS LnnrtS commented Oct 27, 2025

This flag can already be set once a command response has been received.

Requires firmware fix

@maass-hamburg
Copy link
Contributor

cmd_done is also connected to a interrupt, while data_done is not. Some other drivers might depend on this behavior, like zephyrproject-rtos/zephyr#93816 The linux driver might also be effected.

@LnnrtS
Copy link
Contributor Author

LnnrtS commented Nov 7, 2025

I reviewed the zephyr driver and I would assume it would still work with this fix. Can you try this @maass-hamburg ?
Regarding linux its harder to judge for me.

What is the way to introduce such potentially breaking changes in litex?

One way could be to also add an interrupt for data done and adapt the drivers to using that one so they should keep the same behavior as now and can decide later if they want to switch to the correct interrupt

@maass-hamburg
Copy link
Contributor

maass-hamburg commented Nov 7, 2025

to remain backwards compatible, the existing cmd_done irq should use data_done. It could renamed, but needs to stay at that position and a new cmd_done could be added.

the zephyr driver expects, that the tx is completed when the cmd_done irq is fired. the only thing that would be allowed to run longer is the dma (only the memory write/sd card read). the other dma irq (memory read/sd card write) would fire before data_done and that would be a problem if we change it.

maass-hamburg added a commit to maass-hamburg/litex that referenced this pull request Nov 10, 2025
add data_done irq, in prep for
enjoy-digital/litesdcard#54
will take the former place of cmd_done, so we
remain backwards compatible.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
@LnnrtS
Copy link
Contributor Author

LnnrtS commented Nov 18, 2025

Do I understand correctly that everything you mentioned @maass-hamburg is now implemented..?

Before this could be merged, enjoy-digital/litex#2358 should also be merged, right? That driver does not use interrupt sources but reads the status register directly

@maass-hamburg
Copy link
Contributor

Do I understand correctly that everything you mentioned @maass-hamburg is now implemented..?

Before this could be merged, enjoy-digital/litex#2358 should also be merged, right? That driver does not use interrupt sources but reads the status register directly

yes

@maass-hamburg
Copy link
Contributor

@enjoy-digital this looks fine

@enjoy-digital
Copy link
Owner

Thanks @LnnrtS, @maass-hamburg, let's merge.

@enjoy-digital enjoy-digital merged commit f7cfdca into enjoy-digital:master Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants