Skip to content

Commit fe2807b

Browse files
committed
drivers: scmi: disable peer core interrupt when use pre kernel process
in pre kernel scmi send message process, it should use poll to receive system manager core notification, add disable and re-enable completion interrupt in this flow. Signed-off-by: Yongxu Wang <[email protected]>
1 parent aaa465d commit fe2807b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/firmware/scmi/core.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <zephyr/logging/log.h>
1010
#include <zephyr/device.h>
1111
#include <kthread.h>
12+
#include "mailbox.h"
1213

1314
LOG_MODULE_REGISTER(scmi_core);
1415

@@ -88,12 +89,34 @@ static int scmi_core_setup_chan(const struct device *transport,
8889
return 0;
8990
}
9091

92+
static int scmi_interrupt_enable(struct scmi_channel *chan, bool enable)
93+
{
94+
struct scmi_mbox_channel *mbox_chan;
95+
struct mbox_dt_spec *tx_reply;
96+
bool compInt;
97+
98+
mbox_chan = chan->data;
99+
compInt = enable ? SCMI_SHMEM_CHAN_FLAG_IRQ_BIT : 0;
100+
101+
if (mbox_chan->tx_reply.dev) {
102+
tx_reply = &mbox_chan->tx_reply;
103+
} else {
104+
tx_reply = &mbox_chan->tx;
105+
}
106+
107+
/* re-set completion interrupt */
108+
scmi_shmem_update_flags(mbox_chan->shmem, SCMI_SHMEM_CHAN_FLAG_IRQ_BIT, compInt);
109+
110+
return mbox_set_enabled_dt(tx_reply, enable);
111+
}
112+
91113
static int scmi_send_message_pre_kernel(struct scmi_protocol *proto,
92114
struct scmi_message *msg,
93115
struct scmi_message *reply)
94116
{
95117
int ret;
96118

119+
scmi_interrupt_enable(proto->tx, false);
97120
ret = scmi_transport_send_message(proto->transport, proto->tx, msg);
98121
if (ret < 0) {
99122
return ret;
@@ -114,6 +137,7 @@ static int scmi_send_message_pre_kernel(struct scmi_protocol *proto,
114137
return ret;
115138
}
116139

140+
scmi_interrupt_enable(proto->tx, true);
117141
return ret;
118142
}
119143

0 commit comments

Comments
 (0)