mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-24 02:42:18 +01:00
clk: scmi: Postpone clock name resolution
The clock names are retrived via SCMI_CLOCK_ATTRIBUTES, called for each clock ID. This may take a lot of time to complete and is not strictly necessary. Register each clock as "scmi-%zu" instead, and let the first call of SCMI_CLOCK_ATTRIBUTES fill in the actual clock name. This has a side effect, which can be considered both an upside and also a downside. Unused clock are never renamed and retain their placeholder "scmi-%zu" name, which avoids empty clock names for nameless SCMI clock, and avoids the name resolution and improves boot time. But for those SCMI clock which do have name, that name is not listed until the clock are used. This is a preparatory patch for deferred issue of SCMI_CLOCK_ATTRIBUTES. Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
21bfe6a291
commit
fdb1bffe28
@ -17,6 +17,7 @@
|
||||
|
||||
struct clk_scmi {
|
||||
struct clk clk;
|
||||
char name[SCMI_CLOCK_NAME_LENGTH_MAX];
|
||||
u32 ctrl_flags;
|
||||
};
|
||||
|
||||
@ -325,25 +326,21 @@ static int scmi_clk_probe(struct udevice *dev)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < num_clocks; i++) {
|
||||
char *clock_name;
|
||||
clk_scmi = clk_scmi_bulk + i;
|
||||
char *clock_name = clk_scmi->name;
|
||||
u32 attributes;
|
||||
|
||||
snprintf(clock_name, SCMI_CLOCK_NAME_LENGTH_MAX, "scmi-%zu", i);
|
||||
|
||||
ret = clk_register(&clk_scmi->clk, dev->driver->name,
|
||||
clock_name, dev->name);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_clk_dm(dev, i, &clk_scmi->clk);
|
||||
dev_set_parent_priv(clk_scmi->clk.dev, priv);
|
||||
|
||||
if (!scmi_clk_get_attibute(dev, i, &clock_name, &attributes)) {
|
||||
clk_scmi = clk_scmi_bulk + i;
|
||||
if (!clock_name)
|
||||
ret = -ENOMEM;
|
||||
else
|
||||
ret = clk_register(&clk_scmi->clk, dev->driver->name,
|
||||
clock_name, dev->name);
|
||||
|
||||
if (ret) {
|
||||
free(clock_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_clk_dm(dev, i, &clk_scmi->clk);
|
||||
dev_set_parent_priv(clk_scmi->clk.dev, priv);
|
||||
|
||||
if (CLK_HAS_RESTRICTIONS(attributes)) {
|
||||
u32 perm;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user