Draft: Fix SDIO Card Interrupt handling
2 unresolved threads
c
common +3 -3
sdmmc_io +2 -0
VersionNum +7 -7
+ 3
- 3
+ 2
- 0
+ 7
- 7
Detail: Fixes required to enable use of the SDIO Card interrupt.
Admin: Shown working with Pi4b and my rk3399 platforms
Just done a commit merge/rebase to remove checker syntax issues. now passes
505 | f->interrupt_handler(f->interrupt_private); | |
504 | 506 | |
505 | /* Unlock slot if appropriate */ | |
506 | if (f->interrupt_call_with_lock) | |
507 | sdiolib_unlock(f->os_specific); | |
507 | /* Unlock slot if appropriate */ | |
508 | if (f->interrupt_call_with_lock) | |
509 | sdiolib_unlock(f->os_specific); | |
508 | 510 | |
509 | /* Ensure semaphore is cleared prior to re-enabling the controller interrupt */ | |
510 | f->interrupt_semaphore = 0; | |
511 | /* Ensure semaphore is cleared prior to re-enabling the */ | |
512 | /* controller interrupt */ | |
513 | /* If we had a second interrupt whilst here, then go around */ | |
514 | if(f->interrupt_semaphore)f->interrupt_semaphore--; | |
515 | } | |
Please register or sign in to reply |
563 | 568 | f->thread_stack = NULL; |
564 | 569 | return e; |
565 | 570 | } |
571 | // ensure master irq enable for this device is on | |
572 | (void) sdiolib_io_rw_direct_write(function, true, CCCR_INT_ENABLE, 1); | |
|
Ok Ben, I believe this tidies things up. BTW I see that the sdio_io int enable and disable routines already handle the global bit. sdmmc now behaves the same. The interrupt semaphore is now atomically cleared at the start of the interrupt thread, so if perchance a further sdio card irq is detected it'll be caught next time around.
Hopefully now ready for merge. Changes shown woorking on 3399 and pi4b
mentioned in merge request !4 (closed)
Copied from !4 (closed), the interrupt task thread runs a sequence of SDIO commands before it completes it's loop. These signal completion with a card interrupt. If you wait for completion of the loop before flushing the semphore you WILL miss some of these. From what I saw, the semaphore routine is triggered as a result of the SDIO interrupt poll task which continues to cycle behind the Card interrupt task. The chip guards the card interrupt bit against false triggering, as far as I see, so that is not a concern. Sampling and clearing the semaphore at routine start overcomes thei potential semaphore loss. FWIW I checked whether additional semaphore entries occurred, and they definitely do, both on rk3399 and Pi4b systems.
Also please see previous comment about aligning global enable setting of sdmmc_io with that in sdio_io.
marked this merge request as draft
I have now got to a stable set of code, and resubmitted as !5 (closed). This MR set to draft.. will be deleted later, but felt it wise to leave the comment trail.
closed
Files with large changes are collapsed by default.
Files with large changes are collapsed by default.
Files with large changes are collapsed by default.