Skip to content

Conversation

@jsbatch
Copy link
Contributor

@jsbatch jsbatch commented Oct 21, 2025

Adding Infineon PDL based driver to support DMA on the PSOC Edge 84 microcontroller family. Adds support for the following tests:

  • tests/drivers/dma/chan_blen_transfer
  • tests/drivers/dma/loop_transfer
@zephyrbot zephyrbot added area: Tests Issues related to a particular existing or missing test area: DMA Direct Memory Access area: Devicetree Bindings platform: Infineon Infineon Technologies AG labels Oct 21, 2025
@sreeramIfx sreeramIfx added this to the v4.3.0 milestone Oct 21, 2025
Copy link
Contributor

@teburd teburd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a duplicate of the existing dma_ifx_cat1.c driver to me. With maybe some added features. There shouldn't be two of these unless they are in fact two distinct IP blocks with different register maps and/or HAL interfaces.

The binding has a large number of options that don't appear to be used. These really should be added as they are required. By exposing these properties you are giving the appearance to someone creating a board port that these are configurable when they are not. That'll likely lead to some confusion.

data->channels[channel].error_callback_dis = config->error_callback_dis;

/* Lock and page in the channel configuration */
uint32_t key = irq_lock();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is ok, its not great to block interrupts while translating the descriptors. I get the reasoning here is in part because you have a single pool of descriptors of each dma that is shared among all channels. sys_mem_blocks could be used instead at a small cost to maintain the shared pool per dma instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reworked things done within the irq_lock in an effort to minimize the amount of time.

}

/* initialize descriptor */
dma_status = Cy_DMA_Descriptor_Init(descriptor, &descriptor_config);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear from the HAL usage here, but if registers are setup per channel then no locking at all should be needed. If some register is shared, a spin lock around the shared register updates is all that should be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, I've reworked the irq lock to avoid this.

* cache and will lead to errors)
*/
#ifdef CONFIG_CPU_HAS_DCACHE
SCB_InvalidateDCache();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys_cache_data_invd_all() though this is a bit of a shotgun approach

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree invalidating all of cache overkill, and we plan on addressing this in the future. I've updated the function calls to use the sys_cache calls instead of calling into SCB directly.

* written back to the memory
*/
#ifdef CONFIG_CPU_HAS_DCACHE
SCB_CleanDCache();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys_cache_data_flush_all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use sys_cache.

@teburd
Copy link
Contributor

teburd commented Oct 24, 2025

I understand now a bit better that this is an alternative driver to the cat1 dma IP built on a newer/redesigned HAL, that's fine. The issues still need to be addressed and the compatible should not change. A Kconfig selection should choose the driver variant and some documentation/comments about all of this should be done here to avoid confusion. I did not know what PDL means at first glance. Please add some comments in the driver file and Kconfig description noting this and add a zephyr issue to deprecate the older driver.

@jsbatch jsbatch force-pushed the main-pse84_dma_pr branch 2 times, most recently from a22a9af to 4d796ac Compare October 29, 2025 22:04
@jsbatch
Copy link
Contributor Author

jsbatch commented Oct 29, 2025

I understand now a bit better that this is an alternative driver to the cat1 dma IP built on a newer/redesigned HAL, that's fine. The issues still need to be addressed and the compatible should not change. A Kconfig selection should choose the driver variant and some documentation/comments about all of this should be done here to avoid confusion. I did not know what PDL means at first glance. Please add some comments in the driver file and Kconfig description noting this and add a zephyr issue to deprecate the older driver.

I've reworked this to use a Kconfig flag to differentiate between which devices use the older dma_ifx_cat1.c driver and the new dma_ifx_cat1_pdl.c driver. The older driver uses an older HAL which is Infineon is phasing out. The plan is for all devices to eventually migrate to the new PDL based driver, at which point the Kconfig flag will be removed.

Adding binding file for IFX Cat1 DMA PDL based driver implementation. Signed-off-by: John Batch <john.batch@infineon.com>
Updates DMA includes from the modules needed for DMA PDL based driver implementation. Signed-off-by: John Batch <john.batch@infineon.com>
Adds USE_INFINEON_LEGACY_HAL kconfig option to the PSOC6, CYW920829, and xmc7200 series SOCs. These devices have not transitioned to newer HAL based drivers yet. Signed-off-by: John Batch <john.batch@infineon.com>
Adds Infineon Cat1 PDL based driver for DMA. Signed-off-by: John Batch <john.batch@infineon.com>
Adds overlays to enable test runs for DMA on the following tests: -tests/drivers/dma/chan_blen_transfer -tests/drivers/dma/loop_transfer Signed-off-by: John Batch <john.batch@infineon.com>
Adds support to the kit_pse84_eval board for DMA. Signed-off-by: John Batch <john.batch@infineon.com>
@jsbatch
Copy link
Contributor Author

jsbatch commented Oct 30, 2025

add a zephyr issue to deprecate the older driver.

I've added this issue to capture moving Infineon drivers from HAL to PDL. #98600

@jsbatch jsbatch requested a review from teburd October 30, 2025 17:28
@JarmouniA
Copy link
Contributor

@jsbatch @billwatersiii out-of-scope for this PR, but the approach we followed here to introduce a PDL-based driver for the same hw device should be applied to all other infineon drivers, for ex. here

depends on DT_HAS_INFINEON_CAT1_UART_PDL_ENABLED

@jsbatch
Copy link
Contributor Author

jsbatch commented Oct 31, 2025

@jsbatch @billwatersiii out-of-scope for this PR, but the approach we followed here to introduce a PDL-based driver for the same hw device should be applied to all other infineon drivers, for ex. here

depends on DT_HAS_INFINEON_CAT1_UART_PDL_ENABLED

Yes, I’m already working on updating other drivers to follow the same approach. I wanted to get the approach finalized in this PR before getting too far into other driver changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs area: Devicetree Bindings area: DMA Direct Memory Access area: Tests Issues related to a particular existing or missing test platform: Infineon Infineon Technologies AG

5 participants