diff options
author | Alice Guo <alice.guo@nxp.com> | 2025-04-28 18:37:24 +0800 |
---|---|---|
committer | Fabio Estevam <festevam@gmail.com> | 2025-05-03 16:55:32 -0300 |
commit | b4f3fab643324d41ff0074ebed49713ddd4009eb (patch) | |
tree | ecf640d24b84461f3c5ab55fb5d315613a8e13a8 /drivers/firmware | |
parent | 0c8a89d252c3db3401ffa572ee2e4dfcb94e2c3b (diff) |
firmware: scmi: support to manage SCMI protocol drivers with a linker-genetated array
U_BOOT_SCMI_PROTO_DRIVER macro is used to add a SCMI protocol driver to
scmi_proto_driver list. scmi_proto_driver_get() function can be used to
match a SCMI protocol id and its driver.
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/scmi/scmi_agent-uclass.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index e6e43ae936a..ea79cfa0cf2 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -352,6 +352,22 @@ static int scmi_fill_base_info(struct udevice *agent, struct udevice *dev) return 0; } +static struct driver *scmi_proto_driver_get(unsigned int proto_id) +{ + struct scmi_proto_driver *start, *entry; + int n_ents; + + start = ll_entry_start(struct scmi_proto_driver, scmi_proto_driver); + n_ents = ll_entry_count(struct scmi_proto_driver, scmi_proto_driver); + + for (entry = start; entry != start + n_ents; entry++) { + if (entry->match->proto_id == proto_id) + return entry->driver; + } + + return NULL; +} + /* * SCMI agent devices binds devices of various uclasses depending on * the FDT description. scmi_bind_protocol() is a generic bind sequence |