From: Guodong Xu Date: Wed, 27 May 2026 02:45:43 +0000 (-0400) Subject: clk: spacemit: k1: spawn reset device from per-syscon clock drivers X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b3959e2d6f2ecf2006917d65eb48edb4f6b2d92;p=thirdparty%2Fu-boot.git 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 --- 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 #include #include +#include #include #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, +};