1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include "mcp_rdn1e1_mmap.h"
9 #include "system_clock.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_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[] = {
23 [0] = { .name = "REFCLK",
24 .data = &((struct mod_gtimer_dev_config){
25 .hw_timer = MCP_REFCLK_CNTBASE0_BASE,
26 .hw_counter = MCP_REFCLK_CNTCTL_BASE,
27 .control = MCP_REFCLK_CNTCONTROL_BASE,
28 .frequency = CLOCK_RATE_REFCLK,
29 .clock_id = FWK_ID_NONE_INIT,
30 .skip_cntcontrol_init = true
31 }),
32 },
33 [1] = { 0 },
34 };
35
36 const struct fwk_module_config config_gtimer = {
37 .elements = FWK_MODULE_STATIC_ELEMENTS_PTR(gtimer_dev_table),
38 };
39
fmw_time_driver(const void ** ctx)40 struct fwk_time_driver fmw_time_driver(const void **ctx)
41 {
42 return mod_gtimer_driver(ctx, config_gtimer.elements.table[0].data);
43 }
44