1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include "clock_soc.h"
9 #include "scp_mmap.h"
10
11 #include <mod_gtimer.h>
12 #include <mod_timer.h>
13
14 #include <fwk_id.h>
15 #include <fwk_module.h>
16 #include <fwk_module_idx.h>
17 #include <fwk_time.h>
18
19 /*
20 * Generic timer driver config
21 */
22 static const struct fwk_element gtimer_dev_table[2] = {
23 [0] = { .name = "REFCLK",
24 .data = &((struct mod_gtimer_dev_config){
25 .hw_timer = SCP_REFCLK_CNTBASE0_BASE,
26 .hw_counter = SCP_REFCLK_CNTCTL_BASE,
27 .control = SCP_REFCLK_CNTCONTROL_BASE,
28 .frequency = CLOCK_RATE_REFCLK,
29 .clock_id = FWK_ID_ELEMENT_INIT(
30 FWK_MODULE_IDX_CLOCK,
31 CLOCK_IDX_CPU_GROUP_HAYES),
32 }),
33 },
34 [1] = { 0 },
35 };
36
37 const struct fwk_module_config config_gtimer = {
38 .elements = FWK_MODULE_STATIC_ELEMENTS_PTR(gtimer_dev_table),
39 };
40
fmw_time_driver(const void ** ctx)41 struct fwk_time_driver fmw_time_driver(const void **ctx)
42 {
43 return mod_gtimer_driver(ctx, config_gtimer.elements.table[0].data);
44 }
45