Skip to content

soc: alif: add HE_DMA_SEL LPSPI mux config to soc_init#453

Open
sudhir-alifsemi wants to merge 1 commit intoalifsemi:mainfrom
sudhir-alifsemi:soc_he_dma_selection
Open

soc: alif: add HE_DMA_SEL LPSPI mux config to soc_init#453
sudhir-alifsemi wants to merge 1 commit intoalifsemi:mainfrom
sudhir-alifsemi:soc_he_dma_selection

Conversation

@sudhir-alifsemi
Copy link
Copy Markdown
Contributor

Configure the HE_DMA_SEL register for LPSPI during SoC initialization for both ensemble and balletto families. The DMA controller selection is derived at build time from the DTS dmas property of the LP-SPI node.

E1C and B1 always use DMA2, with the register value determined by the DMA group. E3/E5/E7/E4/E6/E8 support both DMA2 and DMA0, detected via the event router phandle in the dmas specifier.

Configure the HE_DMA_SEL register for LPSPI during SoC initialization
for both ensemble and balletto families. The DMA controller selection
is derived at build time from the DTS dmas property of the LP-SPI node.

E1C and B1 always use DMA2, with the register value determined by the
DMA group. E3/E5/E7/E4/E6/E8 support both DMA2 and DMA0, detected via
the event router phandle in the dmas specifier.

Signed-off-by: Sudhir Sreedharan <sudhir@alifsemi.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Configure the HE DMA controller selection (HE_DMA_SEL) for LP-SPI during SoC init by deriving the correct mux value from the devicetree dmas specifier for Ensemble and Balletto families.

Changes:

  • Add HE_DMA_SEL LPSPI bitfield definitions to SoC common headers.
  • Add devicetree-driven HE_DMA_SEL programming for LPSPI during soc_init() on Ensemble (E1C + E-series) and Balletto (B1).
  • Detect DMA0 vs DMA2 on supported Ensemble E-series parts via the event-router phandle in dmas.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
soc/alif/ensemble/common/soc_common.h Adds HE_DMA_SEL LPSPI bit position/mask definitions.
soc/alif/ensemble/common/soc_common.c Adds devicetree-driven HE_DMA_SEL configuration during SoC init for Ensemble variants.
soc/alif/balletto/common/soc_common.h Adds HE_DMA_SEL LPSPI bit position/mask definitions.
soc/alif/balletto/common/soc_common.c Adds devicetree-driven HE_DMA_SEL configuration during SoC init for Balletto B1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +129 to +132
/* Configure HE_DMA_SEL mux for LP-SPI */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi0), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(lpspi0), dmas)
soc_configure_he_dma_sel_lpspi();
#endif
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Unlike the Ensemble implementation, the Balletto call path is not guarded by CONFIG_RTSS_HE, yet it writes M55HE_CFG_HE_DMA_SEL (an HE register). If RTSS_HE is disabled in a build, this can still compile and attempt to touch HE config registers during soc_init(). Wrap both the helper definition and the call site with the same IS_ENABLED(CONFIG_RTSS_HE) guard (or an equivalent existing SoC/RTSS guard used elsewhere in this file) so the HE register access cannot occur when HE/RTSS is not present/enabled.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For Balletto we have only RTSS_HE which is implicit.

Comment on lines +131 to +136
#if DT_SAME_NODE(DT_PHANDLE_BY_IDX(DT_NODELABEL(spi4), dmas, 0), DT_NODELABEL(evtrtr2))
sel_val = 0x0U; /* DMA2 selected */
#else
/* DMA0 selected — determine group */
uint32_t dma_group = ALIF_DMA_DECODE_GROUP(
DT_PHA_BY_IDX(DT_NODELABEL(spi4), dmas, 0, channel));
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This hard-codes DT_NODELABEL(evtrtr2). If a board/SoC DTS variant enables spi4 with dmas, but uses a different event-router node label (or lacks evtrtr2), referencing DT_NODELABEL(evtrtr2) can cause a devicetree compile failure. Prefer guarding the comparison with DT_NODE_EXISTS(DT_NODELABEL(evtrtr2)) (e.g., combine it into the #if), or avoid the fixed label by detecting DMA2 vs DMA0 purely from the dmas controller node in a way that doesn’t require a specific node label.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since the EVTRTR2 node is always present in RTSS_HE (enabled or otherwise), no compilation errors will occur

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants