1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include "system_clock.h"
9 #include "system_mmap.h"
10
11 #include <mod_gtimer.h>
12
13 #include <fwk_element.h>
14 #include <fwk_id.h>
15 #include <fwk_module.h>
16 #include <fwk_time.h>
17
18 static const struct fwk_element element_table[] = {
19 [0] = {
20 .name = "REFCLK",
21 .data = &(struct mod_gtimer_dev_config) {
22 .hw_timer = REFCLK_CNTBASE0_BASE,
23 .hw_counter = REFCLK_CNTCTL_BASE,
24 .control = REFCLK_CNTCONTROL_BASE,
25 .frequency = CLOCK_RATE_REFCLK,
26 .clock_id = FWK_ID_NONE_INIT,
27 }
28 },
29 [1] = { 0 },
30 };
31
32 struct fwk_module_config config_gtimer = {
33 .elements = FWK_MODULE_STATIC_ELEMENTS_PTR(element_table),
34 };
35
fmw_time_driver(const void ** ctx)36 struct fwk_time_driver fmw_time_driver(const void **ctx)
37 {
38 return mod_gtimer_driver(ctx, config_gtimer.elements.table[0].data);
39 }
40