Răsfoiți Sursa

[dm][core] Set default CLK config for platform device probe

Signed-off-by: GuEe-GUI <2991707448@qq.com>
GuEe-GUI 1 lună în urmă
părinte
comite
6270b2f97c
1 a modificat fișierele cu 10 adăugiri și 0 ștergeri
  1. 10 0
      components/drivers/core/platform.c

+ 10 - 0
components/drivers/core/platform.c

@@ -15,6 +15,9 @@
 #define DBG_LVL DBG_INFO
 #include <rtdbg.h>
 
+#ifdef RT_USING_CLK
+#include <drivers/clk.h>
+#endif
 #include <drivers/platform.h>
 #include <drivers/core/bus.h>
 #include <drivers/core/dm.h>
@@ -119,6 +122,13 @@ static rt_err_t platform_probe(rt_device_t dev)
     struct rt_ofw_node *np = dev->ofw_node;
 #endif
 
+#ifdef RT_USING_CLK
+    if ((err = rt_ofw_clk_set_defaults(dev->ofw_node)))
+    {
+        return err;
+    }
+#endif
+
     err = rt_dm_power_domain_attach(dev, RT_TRUE);
 
     if (err && err != -RT_EEMPTY)