1 // SPDX-License-Identifier: BSD-3-Clause
2 //
3 // Copyright 2021 NXP
4 //
5 // Author: Peng Zhang <peng.zhang_8@nxp.com>
6
7 #include <sof/common.h>
8 #include <sof/lib/clk.h>
9 #include <sof/lib/cpu.h>
10 #include <sof/lib/memory.h>
11 #include <sof/lib/notifier.h>
12 #include <sof/sof.h>
13 #include <sof/spinlock.h>
14
15 const struct freq_table platform_cpu_freq[] = {
16 { 528000000, 528000 },
17 };
18
19 STATIC_ASSERT(NUM_CPU_FREQ == ARRAY_SIZE(platform_cpu_freq),
20 invalid_number_of_cpu_frequencies);
21
22 static SHARED_DATA struct clock_info platform_clocks_info[NUM_CLOCKS];
23
platform_clock_init(struct sof * sof)24 void platform_clock_init(struct sof *sof)
25 {
26 int i;
27
28 sof->clocks = platform_clocks_info;
29
30 for (i = 0; i < CONFIG_CORE_COUNT; i++) {
31 sof->clocks[i] = (struct clock_info) {
32 .freqs_num = NUM_CPU_FREQ,
33 .freqs = platform_cpu_freq,
34 .default_freq_idx = CPU_DEFAULT_IDX,
35 .current_freq_idx = CPU_DEFAULT_IDX,
36 .notification_id = NOTIFIER_ID_CPU_FREQ,
37 .notification_mask = NOTIFIER_TARGET_CORE_MASK(i),
38 .set_freq = NULL,
39 };
40
41 spinlock_init(&sof->clocks[i].lock);
42 }
43
44 platform_shared_commit(sof->clocks, sizeof(*sof->clocks) * NUM_CLOCKS);
45 }
46