Skip to content

Conversation

@Hi-Im-David
Copy link
Contributor

@Hi-Im-David Hi-Im-David commented Aug 13, 2025

PR for the mspi_dw driver to support Async and DMA transactions and support for the new nrf-mspi peripheral (name tbc). This peripheral is similar to the exmif in nRF54H20, using the same core designware IP, but has been configured to support DMA and slave mode. The DMA being used is part of the wrapper and not the core IP.

Concurrent Aync transactions and XiP support for nrf-mspi will be added in a future PR. The DMA support uses the DMA in a vendor specific wrapper.

@Hi-Im-David
Copy link
Contributor Author

Hi-Im-David commented Aug 13, 2025

Current known issues/to do list for this PR:

  • Async timeout support
  • Move start_next_packet call in async transactions to work thread
  • Length of DMA transactions are inconsistent
  • Tidy commits
  • Rebase

To be done in follow-up PR:

  • HW bug described in Jira ticket
  • Endian configuration
  • (stretch) Concurrent Async transactions
  • XiP support for nrf-mspi
  • API edit for a read only (no sending of cmd and addr) function
  • nrf-mspi naming issue

@Hi-Im-David Hi-Im-David changed the title [WIP] Mspi dw dma async support [WIP] MSPI_DW DMA and Async support Aug 13, 2025
@Hi-Im-David Hi-Im-David changed the title [WIP] MSPI_DW DMA and Async support MSPI_DW DMA and Async support Aug 13, 2025
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch 2 times, most recently from ce8a013 to c095bba Compare August 15, 2025 16:14
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch 4 times, most recently from 266a237 to aa46e61 Compare August 20, 2025 14:48
@Hi-Im-David Hi-Im-David marked this pull request as ready for review August 20, 2025 14:53
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch 3 times, most recently from 3b17e2e to 3c55ba4 Compare August 27, 2025 10:26
@zephyrbot zephyrbot requested a review from decsny August 27, 2025 10:27
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch from 694e6ab to 523f677 Compare October 14, 2025 10:51
The nrf-qspi-v2 peripheral is similar to EXMIF on nrf54h20
but supports DMA and slave-mode. The wrapper around
the SSI IP is also different with DMA features.

Signed-off-by: David Jewsbury <[email protected]>
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch from 523f677 to 6875795 Compare October 15, 2025 17:30
@Hi-Im-David Hi-Im-David requested a review from anangl October 15, 2025 17:30
Support for new MSPI peripheral where there is no PSEL
so pins are setup through CTRLSEL.

Signed-off-by: David Jewsbury <[email protected]>
This is a new callback option that drivers can use for when a request
or xfer has timed out. E.g if an Async RX request never received
anything, this callback can be used so a user can clean up their
application.

Signed-off-by: David Jewsbury <[email protected]>
enum mspi_op_mode in mspi.h has different syntax to this binding.
Aligning these will allow for cleaner code in the implmented drivers.

Signed-off-by: David Jewsbury <[email protected]>
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch from 6875795 to 6b94a2d Compare October 21, 2025 16:20
@Hi-Im-David Hi-Im-David requested a review from anangl October 21, 2025 16:22
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch from 6b94a2d to 8fcf1ed Compare October 21, 2025 16:27
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch 2 times, most recently from ec2db33 to 01f4523 Compare October 23, 2025 11:22
@Hi-Im-David Hi-Im-David requested a review from anangl October 23, 2025 11:24
Handling of asynchronous transfers uses the system workqueue,
hence they are not available when multithreading is disabled.

Also add missing dependency on multithreading in the
MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE Kconfig option.

Signed-off-by: David Jewsbury <[email protected]>
Signed-off-by: Andrzej Głąbek <[email protected]>
MSPI slave mode is selected through devicetree using the
op-mode property. Mode selected by SSIISMST bit in the
CTRLR0 register. EXMIF can only be Master (controller).

Signed-off-by: David Jewsbury <[email protected]>
@carlescufi
Copy link
Member

@swift-tk could you please take another look?

Comment on lines 268 to 277
} else {
/* Sending command or address while configured as target isn't supported */
tmod = QSPI_TMOD_RX_ONLY;
transfer_list->rx_job = &joblist[0];
joblist[0] = EVDMA_JOB(packet->data_buf, packet->num_bytes,
EVDMA_ATTRIBUTE);
joblist[1] = EVDMA_NULL_JOB();
transfer_list->tx_job = &joblist[1];
}
Copy link
Member

Choose a reason for hiding this comment

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

Why not put this in if (config->op_mode == MSPI_OP_MODE_PERIPHERAL) and handle in a separate path from the one for the controller. Right now it is a bit confusing that the joblist is first filled with the command and address entries and then discarded.

Copy link
Contributor Author

@Hi-Im-David Hi-Im-David Oct 23, 2025

Choose a reason for hiding this comment

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

This code section is common for both Peripheral mode and Controller mode (when not sending addr and cmd). Also MSPI_TX is common for both. Having separate paths for peripheral and controller mode would mean a lot of code duplication in both paths. I could avoid setting the joblist with address and command for peripheral RX but it would require more logic which I think would be less clean?

if (packet->dir == MSPI_RX && (config->op_mode == MSPI_OP_MODE_PERIPHERAL ||
	   (xfer.cmd_length <= 0 && xfer.addr_length <= 0))) {
		preg->CONFIG.RXTRANSFERLENGTH = ((packet->num_bytes) >>
						dev_data->bytes_per_frame_exp) - 1;
                tmod = QSPI_TMOD_RX_ONLY;
		...
	}
	} else {
		if (dev_data->xfer.cmd_length > 0) {
			joblist[job_idx++] = EVDMA_JOB(&packet->cmd, 4, EVDMA_ATTRIBUTE);
		}
		if (dev_data->xfer.addr_length > 0) {
			joblist[job_idx++] = EVDMA_JOB(&packet->address, 4, EVDMA_ATTRIBUTE);
		}

		if (packet->dir == MSPI_TX) {
                        tmod = QSPI_TMOD_TX_ONLY;
			...
		} else {
			preg->CONFIG.RXTRANSFERLENGTH = ((packet->num_bytes + dev_data->xfer.addr_length +
						dev_data->xfer.cmd_length) >>
						dev_data->bytes_per_frame_exp) - 1;
                      tmod = QSPI_TMOD_TX_AND_RX;
			...
		}

	}

@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch from 01f4523 to 085acb0 Compare October 23, 2025 12:32
Initial DMA support. DMA supports implementation of SSI IP but using vendor
specific DMA in the wrapper. The setup of the DMA is done in
mspi_dw_vendor_specific.h.

Signed-off-by: David Jewsbury <[email protected]>
@Hi-Im-David Hi-Im-David force-pushed the mspi-dw-dma-async-support branch from 085acb0 to 052c3f9 Compare October 23, 2025 13:55
@Hi-Im-David Hi-Im-David requested a review from anangl October 23, 2025 14:01
@sonarqubecloud
Copy link

@@ -55,6 +55,12 @@ config MSPI_TIMING
Enables mspi_timing_config calls in device drivers for those
controllers that need this to proper function at high frequencies.

config MSPI_DMA
Copy link
Contributor

Choose a reason for hiding this comment

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

needs to be mentioned in release notes please

@kartben kartben merged commit d9677bb into zephyrproject-rtos:main Oct 23, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants