Skip to content

Conversation

jerome-pouiller
Copy link
Contributor

@jerome-pouiller jerome-pouiller commented Oct 14, 2025

Silabs siwx91x offer two DMA hardware block: GPDMA and UDMA.

While UDMA has some benefit when running in low power modes, GPDMA offer better performances. So GDMA is probably better suited for SPI device.

Ideally, we would like to leave the ability to switch back to UDMA.
Unfortunately, UDMA and GPDMA are not configured in the same way:

  • the maximum length of the block are different (1024 or 2048 for UDMA and 4096 for GPDMA)
  • the burst length is different

So, we only support GPDMA.

Group the DMA nodes in the same place.

Signed-off-by: Jérôme Pouiller <[email protected]>
@jerome-pouiller jerome-pouiller force-pushed the spi-gpdma branch 2 times, most recently from 93b9f18 to 1a319f5 Compare October 14, 2025 11:41

desc = gspi_siwx91x_fill_data_desc(cfg, channel->dma_descriptors, buffer, buffer_count,
padded_transaction_size, is_tx, dfs);
padded_transaction_size, is_tx, 4);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, remove the last parameter (dfs) from this function and change the GSPI_DMA_MAX_DESCRIPTOR_TRANSFER_SIZE to 4096

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


ret = gspi_siwx91x_dma_config(spi_dev, channel,
ARRAY_INDEX(channel->dma_descriptors, desc) + 1, is_tx, dfs);
ARRAY_INDEX(channel->dma_descriptors, desc) + 1, is_tx, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hardcoding this to 1 may limit the source_data_size and dest_data_size to 8-bit. Instead pass dfs to the function and hardcode source_burst_length and dest_burst_length to 1 in gspi_siwx91x_dma_config function to enable transfer for 16-bit data size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

pinctrl-names = "default";

dmas = <&dma0 11>, <&dma0 10>;
dmas = <&dma1 0 11>, <&dma1 1 10>;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this too should be replaced with gpdma

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, CI also noticed it.

GPDMA hardware block has some requirement regarding the buffers alignments.

Note the previous condition was too permissive. It ignored
source_burst_length during the check of the transaction size.

Signed-off-by: Jérôme Pouiller <[email protected]>
The DMAs expect a 32 bits aligned address as source.

Signed-off-by: Jérôme Pouiller <[email protected]>
The siwx91x platform provides two DMA block: UDMA and GPDMA. GPDMA require
the dma_slot attribute.

Signed-off-by: Jérôme Pouiller <[email protected]>
Since various macros don't end with a colon, the code formatters give bad
results. Let's fix that.

Signed-off-by: Jérôme Pouiller <[email protected]>
Properly reset the device before the transaction, whatever its previous
state.

Signed-off-by: Jérôme Pouiller <[email protected]>
Silabs siwx91x offer two DMA hardware block: GPDMA and UDMA.

While UDMA has some benefit when running in low power modes, GPDMA offer
better performances. So GDMA is probably better suited for SPI device.

Ideally, we would like to leave the ability to switch back to UDMA.
Unfortunately, UDMA and GPDMA are not configured in the same way:
  - the maximum length of the block are different (1024 or 2048 for UDMA
    and 4096 for GPDMA)
  - the burst length is different

So, we only support GPDMA.

Signed-off-by: Jérôme Pouiller <[email protected]>
We now support GPDMA with SPI. So update the tests to reflect this changes.

Signed-off-by: Jérôme Pouiller <[email protected]>
Copy link

@jerome-pouiller jerome-pouiller marked this pull request as ready for review October 14, 2025 16:15
@zephyrbot zephyrbot added area: Tests Issues related to a particular existing or missing test area: SPI SPI bus area: DMA Direct Memory Access platform: Silabs Silicon Labs area: Boards/SoCs labels Oct 14, 2025
@jerome-pouiller
Copy link
Contributor Author

Oops, dma_slot is always 0. I will fix that.

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

Labels

area: Boards/SoCs area: DMA Direct Memory Access area: SPI SPI bus area: Tests Issues related to a particular existing or missing test platform: Silabs Silicon Labs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants