drivers: timer: move initialization setup to drivers

The weak symbol sys_clock_driver_init has been removed, therefore moving
the init responsability to the drivers themselves. As a result, the init
function has now been made static on all drivers and moved to the
bottom, following the convention used in other areas.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/drivers/timer/esp32c3_sys_timer.c b/drivers/timer/esp32c3_sys_timer.c
index 51416c0..11c398d 100644
--- a/drivers/timer/esp32c3_sys_timer.c
+++ b/drivers/timer/esp32c3_sys_timer.c
@@ -67,26 +67,6 @@
 	sys_clock_announce(IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? dticks : 1);
 }
 
-int sys_clock_driver_init(const struct device *dev)
-{
-	ARG_UNUSED(dev);
-
-	esp_intr_alloc(DT_IRQN(DT_NODELABEL(systimer0)),
-		0,
-		sys_timer_isr,
-		NULL,
-		NULL);
-
-	systimer_hal_init();
-	systimer_hal_connect_alarm_counter(SYSTIMER_ALARM_0, SYSTIMER_COUNTER_1);
-	systimer_hal_enable_counter(SYSTIMER_COUNTER_1);
-	systimer_hal_counter_can_stall_by_cpu(SYSTIMER_COUNTER_1, 0, true);
-	last_count = systimer_alarm();
-	set_systimer_alarm(last_count + CYC_PER_TICK);
-
-	return 0;
-}
-
 void sys_clock_set_timeout(int32_t ticks, bool idle)
 {
 	ARG_UNUSED(idle);
@@ -139,3 +119,26 @@
 {
 	return systimer_alarm();
 }
+
+static int sys_clock_driver_init(const struct device *dev)
+{
+	ARG_UNUSED(dev);
+
+	esp_intr_alloc(DT_IRQN(DT_NODELABEL(systimer0)),
+		0,
+		sys_timer_isr,
+		NULL,
+		NULL);
+
+	systimer_hal_init();
+	systimer_hal_connect_alarm_counter(SYSTIMER_ALARM_0, SYSTIMER_COUNTER_1);
+	systimer_hal_enable_counter(SYSTIMER_COUNTER_1);
+	systimer_hal_counter_can_stall_by_cpu(SYSTIMER_COUNTER_1, 0, true);
+	last_count = systimer_alarm();
+	set_systimer_alarm(last_count + CYC_PER_TICK);
+
+	return 0;
+}
+
+SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2,
+	 CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);