1 /*
2 * Renesas SCP/MCP Software
3 * Copyright (c) 2020-2021, Renesas Electronics Corporation. All rights
4 * reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9 #include "rcar_alarm_idx.h"
10 #include "system_clock.h"
11 #include "rcar_irq.h"
12
13 #include <mod_timer.h>
14 #include <mod_rcar_arch_timer.h>
15
16 #include <fwk_element.h>
17 #include <fwk_id.h>
18 #include <fwk_module.h>
19 #include <fwk_module_idx.h>
20 #include <fwk_time.h>
21
22 static const struct fwk_element rcar_arch_timer_element_table[] = {
23 [0] = {
24 .name = "",
25 .data = &(struct mod_arch_timer_dev_config) {
26 .clock_id = FWK_ID_NONE_INIT,
27 }
28 },
29 [1] = { 0 },
30 };
31
32 struct fwk_module_config config_rcar_arch_timer = {
33 .elements = FWK_MODULE_STATIC_ELEMENTS_PTR(rcar_arch_timer_element_table),
34 };
35
36 static const struct fwk_element timer_element_table[] = {
37 [0] = {
38 .name = "REFCLK",
39 .sub_element_count = RCAR_ALARM_IDX_COUNT,
40 .data = &(struct mod_timer_dev_config) {
41 .id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_RCAR_ARCH_TIMER, 0),
42 .timer_irq = NS_PHYSICAL_TIMER_IRQ,
43 },
44 },
45 [1] = { 0 },
46 };
47
fmw_time_driver(const void ** ctx)48 struct fwk_time_driver fmw_time_driver(const void **ctx)
49 {
50 return mod_arch_timer_driver(ctx, config_rcar_arch_timer.elements.table[0].data);
51 }
52
timer_get_element_table(fwk_id_t module_id)53 static const struct fwk_element *timer_get_element_table(fwk_id_t module_id)
54 {
55 return timer_element_table;
56 }
57
58 struct fwk_module_config config_timer = {
59 .elements = FWK_MODULE_DYNAMIC_ELEMENTS(timer_get_element_table),
60 };
61