1 // SPDX-License-Identifier: BSD-3-Clause
2 //
3 // Copyright(c) 2020 Google Inc. All rights reserved.
4 //
5 // Author: Curtis Malainey <cujomalainey@chromium.org>
6 
7 #include <sof/sof.h>
8 #include <sof/ipc/driver.h>
9 #include <sof/drivers/timer.h>
10 #include <sof/lib/agent.h>
11 #include <sof/schedule/edf_schedule.h>
12 #include <sof/schedule/ll_schedule_domain.h>
13 #include <sof/lib/mailbox.h>
14 #include <sof/lib/dai.h>
15 
16 SHARED_DATA struct timer timer = {};
17 
18 static uint8_t mailbox[MAILBOX_DSPBOX_SIZE +
19 		       MAILBOX_HOSTBOX_SIZE +
20 		       MAILBOX_EXCEPTION_SIZE +
21 		       MAILBOX_DEBUG_SIZE +
22 		       MAILBOX_STREAM_SIZE +
23 		       MAILBOX_TRACE_SIZE];
24 
get_library_mailbox()25 uint8_t *get_library_mailbox()
26 {
27 	return mailbox;
28 }
29 
platform_clock_init(struct sof * sof)30 static void platform_clock_init(struct sof *sof) {}
31 
dmac_init(struct sof * sof)32 int dmac_init(struct sof *sof)
33 {
34 	return 0;
35 }
36 
platform_init(struct sof * sof)37 int platform_init(struct sof *sof)
38 {
39 	sof->platform_timer = &timer;
40 	sof->cpu_timers = &timer;
41 
42 	platform_clock_init(sof);
43 
44 	scheduler_init_edf();
45 
46 	/* init low latency timer domain and scheduler */
47 	/* sof->platform_timer_domain = */
48 	/* timer_domain_init(sof->platform_timer, PLATFORM_DEFAULT_CLOCK, */
49 	/* CONFIG_SYSTICK_PERIOD); */
50 
51 	/* init the system agent */
52 	sa_init(sof, CONFIG_SYSTICK_PERIOD);
53 
54 	/* init DMACs */
55 	dmac_init(sof);
56 
57 	/* initialise the host IPC mechanisms */
58 	ipc_init(sof);
59 
60 	dai_init(sof);
61 
62 	return 0;
63 }
64 
platform_context_save(struct sof * sof)65 int platform_context_save(struct sof *sof)
66 {
67 	return 0;
68 }
69 
70 #ifdef __ZEPHYR__
71 /* Stubs for unsupported architectures */
72 
73 /* Platform */
platform_boot_complete(uint32_t boot_message)74 int platform_boot_complete(uint32_t boot_message)
75 {
76 	return 0;
77 }
78 
79 /* Logging */
80 LOG_MODULE_REGISTER(sof);
81 
82 #endif
83