Skip to content

RFC: Introduce new mailbox API mbox_send_then_poll_rx and use it in TISCI for AM243x EVM platform#108491

Open
natto1784 wants to merge 5 commits into
zephyrproject-rtos:mainfrom
natto1784:early-tisci-2
Open

RFC: Introduce new mailbox API mbox_send_then_poll_rx and use it in TISCI for AM243x EVM platform#108491
natto1784 wants to merge 5 commits into
zephyrproject-rtos:mainfrom
natto1784:early-tisci-2

Conversation

@natto1784
Copy link
Copy Markdown
Contributor

@natto1784 natto1784 commented May 5, 2026

NOTE: This patchset is an alternative to the existing PR - #105343

Proposal

Add a new API that allows polling on a response instead of waiting for an interrupt to call a registered callback function. This is useful in two particular situations -

  1. when mailbox does not support interrupt
  2. during PRE_KERNEL where things like semaphores are not yet initialized.

Potential improvemets

  • Can add timeouts since it is a blocking call

Example

Added an implementation for ti_secproxy mailbox and a call for it in tisci firmware driver.

natto1784 added 5 commits May 5, 2026 15:13
Add a new API that allows polling for a response instead of the usual way
of waiting for an interrupt service routine to use a callback. This is
useful for -

1. Mailboxes that do not have interrupts
2. PRE_KERNEL access since using callbacks implies using semaphores and the
   like, which are not available at that stage.

Also include a *_dt definition that allows passing struct mbox_dt_spec
instead of raw channel IDs.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
TISCI uses ti_secproxy as the mailbox for communicating with the DM for
things as power management, clock management and more. We currently use a
semaphore as a notification for the received reply/message from the DM
after we send a message. However, since kernel services are not initialized
during PRE_KERNEL stages, we cannot rely on this.

To overcome this, add a polling API that first sends a message on a
specified tx_channel and then poll for a reply on a specified rx_channel.
This is also similarly, a blocking call.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
TISCI uses ti_secproxy as the mailbox for communicating with the DM for
things as power management, clock management and more. We currently use a
semaphore as a notification for the received reply/message from the DM
after we send a message. However, since kernel services are not initialized
during PRE_KERNEL stages, we cannot rely on this.

To solve this, use the new mbox_send_then_poll_rx mailbox API to wait on a
message if it's PRE_KERNEL.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add the clock controller node for TISCI and also add power-domains and
clocks properties for supported general peripherals in the files.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
Enable Kconfig options for TISCI, clock control, power domains and power
management for the R5FSS0_0 core.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
@natto1784 natto1784 changed the title RFC: Introduce new mailbox API mbox_send_then_poll_rx RFC: Introduce new mailbox API mbox_send_then_poll_rx and use it in TISCI for AM243x EVM platform May 5, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@LaurentiuM1234
Copy link
Copy Markdown
Contributor

  1. PRE_KERNEL access since using callbacks implies using semaphores and the
    like, which are not available at that stage.

can you not achieve this by adding a k_is_pre_kernel check in the implementation of the MBOX send function? If the function returns true then do polling. Otherwise, use IRQs.

  1. Mailboxes that do not have interrupts

unconditionally poll in the MBOX send function

is the MBOX send function supposed to be ISR-safe? didn't see any mentions in https://docs.zephyrproject.org/latest/doxygen/html/group__mbox__interface.html#gaf4d02fb3a3ed788ba28a58783209d359

@natto1784
Copy link
Copy Markdown
Contributor Author

natto1784 commented May 5, 2026

  1. PRE_KERNEL access since using callbacks implies using semaphores and the
    like, which are not available at that stage.

can you not achieve this by adding a k_is_pre_kernel check in the implementation of the MBOX send function? If the function returns true then do polling. Otherwise, use IRQs.

mbox_send does not know the RX channel ID which we require to poll for response

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants