[RFC PATCH] clk: scmi: Provide channel information to every clock

Michal Simek michal.simek at amd.com
Thu Oct 5 13:49:21 CEST 2023


When assigned-clocks/assigned-clock-rates is defined U-Boot DM core finds
out leaf which is registered via clk_register().
But new clock doesn't have information about channel which is stored in
private data. That's why copy parents private data (channel only now) to
all childs.
It will fix the issue when there is reference to clk child and operations
with it.

Signed-off-by: Michal Simek <michal.simek at amd.com>
---

I am not really sure that this is the right way how to solve this problem.
I had another patch which is pretty much written in a way if current device
doesn't have private data it looks at parents private data.
Anyway I am sending it as RFC to start to have discussion about it.
---
 drivers/clk/clk_scmi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index d172fed24c9d..98a779fdc81b 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -12,6 +12,7 @@
 #include <scmi_protocols.h>
 #include <asm/types.h>
 #include <linux/clk-provider.h>
+#include <dm/device-internal.h>
 
 /**
  * struct scmi_clk_priv - Private data for SCMI clocks
@@ -186,6 +187,7 @@ static int scmi_clk_probe(struct udevice *dev)
 				return ret;
 			}
 
+			dev_set_priv(clk->dev, dev_get_priv(dev));
 			clk_dm(i, clk);
 		}
 	}
-- 
2.36.1



More information about the U-Boot mailing list