summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPatrick Delaunay <[email protected]>2025-05-27 15:27:51 +0200
committerPatrice Chotard <[email protected]>2025-06-11 09:42:55 +0200
commit51954665a7dac2fd9e4385c0f7a96f3cc959829d (patch)
tree2f12720f4f8ff03ab1cbbe74f21d26bbeb994d99 /drivers
parentaa7bdc1af505c1f69e4c3e4d14afdb5632aed8bc (diff)
phy: stm32-usbphyc: manage properly the clk identifier with CCF
Add private uclass data for "stm32-usbphyc-clk" as it is not done by the driver model. This clk struct is needed by CCF to save the unique id used to identify each clock. Signed-off-by: Patrick Delaunay <[email protected]> Signed-off-by: Patrice Chotard <[email protected]> Cc: Lukasz Majewski <[email protected]> Cc: Sean Anderson <[email protected]> Reviewed-by: Patrick Delaunay <[email protected]> Reviewed-by: Patrice Chotard <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/phy/phy-stm32-usbphyc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 8d643b762f9..fcf8617ee9b 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -16,7 +16,9 @@
#include <syscon.h>
#include <usb.h>
#include <asm/io.h>
+#include <dm/device.h>
#include <dm/device_compat.h>
+#include <dm/device-internal.h>
#include <dm/lists.h>
#include <dm/of_access.h>
#include <linux/bitfield.h>
@@ -633,6 +635,7 @@ U_BOOT_DRIVER(stm32_usb_phyc) = {
struct stm32_usbphyc_clk {
bool enable;
+ struct clk clkp;
};
static ulong stm32_usbphyc_clk48_get_rate(struct clk *clk)
@@ -687,9 +690,25 @@ const struct clk_ops usbphyc_clk48_ops = {
.disable = stm32_usbphyc_clk48_disable,
};
+int usbphyc_clk48_probe(struct udevice *dev)
+{
+ struct stm32_usbphyc_clk *priv = dev_get_priv(dev);
+
+ /* prepare clkp to correctly register clock with CCF */
+ priv->clkp.dev = dev;
+ priv->clkp.id = CLK_ID(dev, 0);
+
+ /* Store back pointer to clk from udevice */
+ /* FIXME: This is not allowed...should be allocated by driver model */
+ dev_set_uclass_priv(dev, &priv->clkp);
+
+ return 0;
+}
+
U_BOOT_DRIVER(stm32_usb_phyc_clk) = {
.name = "stm32-usbphyc-clk",
.id = UCLASS_CLK,
.ops = &usbphyc_clk48_ops,
+ .probe = &usbphyc_clk48_probe,
.priv_auto = sizeof(struct stm32_usbphyc_clk),
};