@@ -13,6 +13,7 @@
#include <dm/lists.h>
#include <regmap.h>
#include <linux/clk-provider.h>
+#include <soc/spacemit/k1-reset.h>
#include <soc/spacemit/k1-syscon.h>
#include "clk_common.h"
@@ -1670,6 +1671,26 @@ U_BOOT_DRIVER(k1_pll_clk) = {
.flags = DM_FLAG_PRE_RELOC,
};
+static int k1_mpmu_clk_bind(struct udevice *dev)
+{
+ return spacemit_k1_reset_bind(dev, SPACEMIT_K1_RESET_MPMU);
+}
+
+static int k1_apbc_clk_bind(struct udevice *dev)
+{
+ return spacemit_k1_reset_bind(dev, SPACEMIT_K1_RESET_APBC);
+}
+
+static int k1_apmu_clk_bind(struct udevice *dev)
+{
+ return spacemit_k1_reset_bind(dev, SPACEMIT_K1_RESET_APMU);
+}
+
+static int k1_apbc2_clk_bind(struct udevice *dev)
+{
+ return spacemit_k1_reset_bind(dev, SPACEMIT_K1_RESET_APBC2);
+}
+
static const struct udevice_id k1_mpmu_clk_match[] = {
{ .compatible = "spacemit,k1-syscon-mpmu",
.data = (ulong)&k1_ccu_mpmu_data },
@@ -1682,6 +1703,7 @@ U_BOOT_DRIVER(k1_mpmu_clk) = {
.name = "k1_mpmu_clk",
.id = UCLASS_CLK,
.of_match = k1_mpmu_clk_match,
+ .bind = k1_mpmu_clk_bind,
.probe = k1_mpmu_clk_probe,
.ops = &k1_mpmu_clk_ops,
.flags = DM_FLAG_PRE_RELOC,
@@ -1699,6 +1721,7 @@ U_BOOT_DRIVER(k1_apbc_clk) = {
.name = "k1_apbc_clk",
.id = UCLASS_CLK,
.of_match = k1_apbc_clk_match,
+ .bind = k1_apbc_clk_bind,
.probe = k1_apbc_clk_probe,
.ops = &k1_apbc_clk_ops,
.flags = DM_FLAG_PRE_RELOC,
@@ -1716,7 +1739,21 @@ U_BOOT_DRIVER(k1_apmu_clk) = {
.name = "k1_apmu_clk",
.id = UCLASS_CLK,
.of_match = k1_apmu_clk_match,
+ .bind = k1_apmu_clk_bind,
.probe = k1_apmu_clk_probe,
.ops = &k1_apmu_clk_ops,
.flags = DM_FLAG_PRE_RELOC,
};
+
+static const struct udevice_id k1_apbc2_clk_match[] = {
+ { .compatible = "spacemit,k1-syscon-apbc2" },
+ { /* sentinel */ },
+};
+
+U_BOOT_DRIVER(k1_apbc2_clk) = {
+ .name = "k1_apbc2_clk",
+ .id = UCLASS_CLK,
+ .of_match = k1_apbc2_clk_match,
+ .bind = k1_apbc2_clk_bind,
+ .flags = DM_FLAG_PRE_RELOC,
+};
The K1 reset driver in drivers/reset/spacemit/ binds by name (no DT of_match), so the per-syscon clock drivers must spawn it. Add a .bind hook to k1_mpmu_clk, k1_apbc_clk and k1_apmu_clk that calls spacemit_k1_reset_bind() to instantiate a UCLASS_RESET sibling on the same ofnode. Also introduce k1_apbc2_clk here. Its kernel DT node has #reset-cells but no #clock-cells, so the driver exists only as the binding hook for the apbc2 reset spawn. With this in place, references such as resets = <&syscon_apbc RESET_TWSI0>; in the kernel-mainline DT resolve correctly. Signed-off-by: Guodong Xu <guodong@riscstar.com> --- drivers/clk/spacemit/clk-k1.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)