summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Mao <[email protected]>2026-06-30 09:19:08 +0800
committerTim Ouyang <[email protected]>2026-07-21 16:57:13 +0800
commitcc4f363cc7ee3e367ae05b5b6698c9dfa5ca14ed (patch)
treee76bb251f3115f1e6670858bf306a39426d6c3d0
parent70cee8ab03c3252d17cb0c10bfe80cbda7ef4bb9 (diff)
board: k1: initialize clock and serial devices in SPL
Initialize clock and serial devices in SPL. Otherwise, the device driver won't be loaded in SPL. Signed-off-by: Raymond Mao <[email protected]> Signed-off-by: Guodong Xu <[email protected]> Tested-by: Songsong Zhang <[email protected]>
-rw-r--r--board/spacemit/k1/spl.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/board/spacemit/k1/spl.c b/board/spacemit/k1/spl.c
index e15cf5f1abf..78f26616347 100644
--- a/board/spacemit/k1/spl.c
+++ b/board/spacemit/k1/spl.c
@@ -3,8 +3,45 @@
* Copyright (c) 2025-2026, RISCstar Ltd.
*/
+#include <dm/device.h>
+#include <dm/uclass.h>
+#include <log.h>
#include <spl.h>
+static void clk_early_init(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device_by_name(UCLASS_CLK, "clock-controller@d4090000", &dev);
+ if (ret)
+ panic("Fail to detect clock-controller@d4090000\n");
+ ret = uclass_get_device_by_name(UCLASS_CLK, "system-controller@d4050000", &dev);
+ if (ret)
+ panic("Fail to detect system-controller@d4050000\n");
+ ret = uclass_get_device_by_name(UCLASS_CLK, "system-controller@d4282800", &dev);
+ if (ret)
+ panic("Fail to detect system-controller@d4282800\n");
+ ret = uclass_get_device_by_name(UCLASS_CLK, "system-controller@d4015000", &dev);
+ if (ret)
+ panic("Fail to detect system-controller@d4015000\n");
+
+ if (device_active(dev))
+ log_debug("clk: device is active\n");
+ else
+ log_debug("clk: device not active, probing...\n");
+}
+
+void serial_early_init(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device(UCLASS_SERIAL, 0, &dev);
+ if (ret)
+ panic("Serial uclass init failed: %d\n", ret);
+}
+
void board_init_f(ulong dummy)
{
int ret;
@@ -15,6 +52,8 @@ void board_init_f(ulong dummy)
riscv_cpu_setup();
+ clk_early_init();
+ serial_early_init();
preloader_console_init();
}