summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuodong Xu <[email protected]>2026-05-26 22:45:43 -0400
committerTim Ouyang <[email protected]>2026-07-21 16:31:10 +0800
commit5b3959e2d6f2ecf2006917d65eb48edb4f6b2d92 (patch)
treeb0087674dfafdc76067a3ae18a0117a292d0a736
parentdaa9b916a603e72b377b66dba435b8a01dec0f83 (diff)
clk: spacemit: k1: spawn reset device from per-syscon clock drivers
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 <[email protected]>
-rw-r--r--drivers/clk/spacemit/clk-k1.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/clk/spacemit/clk-k1.c b/drivers/clk/spacemit/clk-k1.c
index a6be285c1a4..6175cf09500 100644
--- a/drivers/clk/spacemit/clk-k1.c
+++ b/drivers/clk/spacemit/clk-k1.c
@@ -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"
@@ -1661,6 +1662,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 },
@@ -1673,6 +1694,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,
@@ -1690,6 +1712,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,
@@ -1707,7 +1730,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,
+};