-
Notifications
You must be signed in to change notification settings - Fork 8k
NXP Add SCMI P2A workflow and BBNSM protocol #93305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
ee512b4
749274f
7ab7a84
a3233c5
bcba9ec
8821a9f
bf9d35d
e0679ec
7fb6b89
d876137
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,22 @@ | |
|
||
LOG_MODULE_REGISTER(scmi_mbox); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/callbak/callback/ in the commit subject. |
||
|
||
static void scmi_mbox_cb(const struct device *mbox, | ||
mbox_channel_id_t channel_id, | ||
void *user_data, | ||
struct mbox_msg *data) | ||
static void scmi_mbox_tx_reply_cb(const struct device *mbox, | ||
mbox_channel_id_t channel_id, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please split this into 2 patches:
Much easier to review the transition like this. |
||
void *user_data, | ||
struct mbox_msg *data) | ||
{ | ||
struct scmi_channel *scmi_chan = user_data; | ||
|
||
if (scmi_chan->cb) { | ||
scmi_chan->cb(scmi_chan); | ||
} | ||
} | ||
|
||
static void scmi_mbox_notify_cb(const struct device *mbox, | ||
mbox_channel_id_t channel_id, | ||
void *user_data, | ||
struct mbox_msg *data) | ||
{ | ||
struct scmi_channel *scmi_chan = user_data; | ||
|
||
|
@@ -71,29 +83,34 @@ static int scmi_mbox_setup_chan(const struct device *transport, | |
{ | ||
int ret; | ||
struct scmi_mbox_channel *mbox_chan; | ||
struct mbox_dt_spec *tx_reply; | ||
struct mbox_dt_spec *mbox_spec; | ||
|
||
mbox_chan = chan->data; | ||
|
||
if (!tx) { | ||
return -ENOTSUP; | ||
} | ||
|
||
if (mbox_chan->tx_reply.dev) { | ||
tx_reply = &mbox_chan->tx_reply; | ||
if (tx) { | ||
mbox_spec = mbox_chan->tx_reply.dev ? &mbox_chan->tx_reply : &mbox_chan->tx; | ||
ret = mbox_register_callback_dt(mbox_spec, scmi_mbox_tx_reply_cb, chan); | ||
if (ret < 0) { | ||
LOG_ERR("failed to register reply cb on %s", | ||
mbox_chan->tx_reply.dev ? "tx_reply" : "tx"); | ||
return ret; | ||
} | ||
} else { | ||
tx_reply = &mbox_chan->tx; | ||
} | ||
|
||
ret = mbox_register_callback_dt(tx_reply, scmi_mbox_cb, chan); | ||
if (ret < 0) { | ||
LOG_ERR("failed to register tx reply cb"); | ||
return ret; | ||
if (!mbox_chan->rx.dev) { | ||
LOG_ERR("RX channel not defined"); | ||
return -ENOTSUP; | ||
} | ||
mbox_spec = &mbox_chan->rx; | ||
ret = mbox_register_callback_dt(&mbox_chan->rx, scmi_mbox_notify_cb, chan); | ||
if (ret < 0) { | ||
LOG_ERR("failed to register notify cb on rx"); | ||
return ret; | ||
} | ||
} | ||
|
||
ret = mbox_set_enabled_dt(tx_reply, true); | ||
ret = mbox_set_enabled_dt(mbox_spec, true); | ||
if (ret < 0) { | ||
LOG_ERR("failed to enable tx reply dbell"); | ||
LOG_ERR("failed to enable %s dbell", tx ? "tx" : "rx"); | ||
} | ||
|
||
/* enable interrupt-based communication */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ | |
#define SCMI_TRANSPORT_CHAN_NAME(proto, idx) CONCAT(scmi_channel_, proto, _, idx) | ||
|
||
/** | ||
* @brief Declare a TX SCMI channel | ||
* @brief Declare TX/RX SCMI channel | ||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't merge commments like this. Add a similar comment at the top of RX Channel declaration. |
||
* Given a node_id for a protocol, this macro declares the SCMI | ||
* TX channel statically bound to said protocol via the "extern" | ||
|
@@ -70,6 +70,15 @@ | |
(extern struct scmi_channel \ | ||
SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 0);)) \ | ||
|
||
#define DT_SCMI_TRANSPORT_RX_CHAN_DECLARE(node_id) \ | ||
COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 1), \ | ||
(extern struct scmi_channel \ | ||
SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR_RAW(node_id), 1);), \ | ||
(COND_CODE_1(DT_PROP_HAS_IDX(DT_PARENT(node_id), shmem, 1),\ | ||
(extern struct scmi_channel \ | ||
SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 1);), \ | ||
(/* no decl when NULL */)))) | ||
|
||
/** | ||
* @brief Declare SCMI TX/RX channels | ||
* | ||
|
@@ -84,6 +93,7 @@ | |
*/ | ||
#define DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \ | ||
DT_SCMI_TRANSPORT_TX_CHAN_DECLARE(node_id) \ | ||
DT_SCMI_TRANSPORT_RX_CHAN_DECLARE(node_id) \ | ||
|
||
/** | ||
* @brief Declare SCMI TX/RX channels using node instance number | ||
|
@@ -97,22 +107,28 @@ | |
DT_SCMI_TRANSPORT_CHANNELS_DECLARE(DT_INST(inst, DT_DRV_COMPAT)) | ||
|
||
/** | ||
* @brief Get a reference to a protocol's SCMI TX channel | ||
* @brief Get a reference to a protocol's SCMI TX/RX channel | ||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dont merge the comments like this. Add a similar comment for RX channel. |
||
* Given a node_id for a protocol, this macro returns a | ||
* reference to an SCMI TX channel statically bound to said | ||
* protocol. | ||
* | ||
* @param node_id protocol node identifier | ||
* | ||
* @return reference to the struct scmi_channel of the TX channel | ||
* @return reference to the struct scmi_channel of the TX/RX channel | ||
* bound to the protocol identifier by node_id | ||
*/ | ||
#define DT_SCMI_TRANSPORT_TX_CHAN(node_id) \ | ||
COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 0), \ | ||
(&SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR_RAW(node_id), 0)), \ | ||
(&SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 0))) | ||
|
||
#define DT_SCMI_TRANSPORT_RX_CHAN(node_id) \ | ||
COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 1), \ | ||
(&SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR_RAW(node_id), 1)), \ | ||
(COND_CODE_1(DT_PROP_HAS_IDX(DT_PARENT(node_id), shmem, 1), \ | ||
(&SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 1)), \ | ||
(NULL)))) | ||
/** | ||
* @brief Define an SCMI channel for a protocol | ||
* | ||
|
@@ -151,6 +167,7 @@ | |
{ \ | ||
.id = proto, \ | ||
.tx = DT_SCMI_TRANSPORT_TX_CHAN(node_id), \ | ||
.rx = DT_SCMI_TRANSPORT_RX_CHAN(node_id), \ | ||
.data = pdata, \ | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.