-
Notifications
You must be signed in to change notification settings - Fork 7k
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
drivers: firmware: scmi: add more protocols and APIs #77437
Conversation
a38a026
to
d99a945
Compare
@LaurentiuM1234 Thanks. Actually I will send NETC support PR, which needs this to set clock and power up NETCMIX domain. That will include,
So, not sure if the PR will be huge making all changes together with this in one PR. THanks. |
Hi @LaurentiuM1234, @yangbolu1991 First of all I'd like to thank you for your tremendous work adding SCMI support in Zephyr. Regarding this PR - it's probably would be better to split it. At least patch which fixes code formatting. Below is just FYI. [1] xen-troops#124 |
great to see more platforms using the SCMI support! Do you plan on also upstreaming the patches to Zephyr? I think it would be good to have another upstream platform using SCMI so we could have more coverage. Also, IMO, the sample is a very good idea since we're lacking in that department. |
@LaurentiuM1234 Hope to have smth this week. I was able to port on top of current code, need to look at it one more time. Current state in https://github.com/GrygiriiS/zephyr/commits/zm_rpi5_dev_scmi/ |
d99a945
to
2b21c18
Compare
Since I had create PR for i.MX95 NETC feature support, which depends on this PR, I updated this to v2. Changes,
Thank you very much. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the (very) long review time. Some comments below. Also, is there a particular reason you didn't implement the clock_control_set_rate()
function? Should be useful for #81113.
reply.len = sizeof(status); | ||
reply.content = &status; | ||
|
||
ret = scmi_send_message(proto, &msg, &reply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is synchronous so if someone sets the ASYNC bit it will come in contradiction with it. For now, since we don't support ASYNC messages, maybe we can return an error if someone attempts to call this function with that bit set? Or perhaps force it to 0 and print a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scmi driver should be standard. I think it's not good to limit only SYNC flag here.
Actually, if ASYNC is used, I think the reply from system manager will be error, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're limited to SYNC because that's the only option the support allows. Allowing people to set the ASYNC flag and still using SYNC messaging behind the scenes is not the way IMO. This deserves a comment at least.
EDIT: could add a comment to the flags
field of the affected structures. People will have to look up their definitions anyways when using them, thus making sure that they know the ASYNC flag will be ignored.
#include <zephyr/drivers/firmware/scmi/power.h> | ||
#include <string.h> | ||
|
||
DT_SCMI_PROTOCOL_DEFINE_NODEV(DT_INST(0, arm_scmi_power), NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note on this: not exactly ideal to put this here as we'd normally have a generic power domain driver using this, but since Zephyr doesn't really support DT nodes providing multiple PDs it becomes a bit tricky. For now, I'd say it's fine to go with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks:)
reply.len = sizeof(status); | ||
reply.content = &status; | ||
|
||
ret = scmi_send_message(proto, &msg, &reply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as for scmi_power_state_set().
drivers/firmware/scmi/clk.c
Outdated
return 0; | ||
} | ||
|
||
int scmi_clock_parent_set(struct scmi_protocol *proto, struct scmi_clock_parent_config *cfg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems kinda odd to encase clock ID and parent ID in a structure here and not in scmi_clock_parent_get()
? I'd suggest going with the same approach as scmi_clock_parent_get()
(i.e: don't encase the parameters in a structure unless we have > 2?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I can't understand why I encased the parameters too.
Thanks.
I think the common clock control driver is missing function like set_parent. |
BTW, could you please also add the PD protocol to the list of supported protocols in https://github.com/zephyrproject-rtos/zephyr/blob/main/doc/hardware/arch/arm-scmi.rst? Thanks! |
Added more APIs for ARM SCMI clock management protocol. - scmi_clock_rate_set - scmi_clock_parent_get - scmi_clock_parent_set Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Added helpers for ARM SCMI power dmomain protocol. Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2b21c18
to
adb6606
Compare
Updated to v3. Changes include,
Thanks a lot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good with me @dleach02
@LaurentiuM1234 , would you like to add a change PR to make yourself the maintainer for ARM SCMI? |
This patch-set is to add more SCMI clock protocol APIs and power domain protocol driver.
These are essential for platform to configure clock and control power domain.
These had been verified on NXP i.MX95 platforms.
Thank you very much.