1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "scp_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_time.h>
17 
18 /*
19  * Generic timer driver config
20  */
21 static const struct fwk_element gtimer_dev_table[] = {
22     [0] = {
23         .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_NONE_INIT,
30         })
31     },
32     [1] = { 0 },
33 };
34 
35 const struct fwk_module_config config_gtimer = {
36     .elements = FWK_MODULE_STATIC_ELEMENTS_PTR(gtimer_dev_table),
37 };
38 
fmw_time_driver(const void ** ctx)39 struct fwk_time_driver fmw_time_driver(const void **ctx)
40 {
41     return mod_gtimer_driver(ctx, config_gtimer.elements.table[0].data);
42 }
43