diff options
author | Anurag Koul <anurag.koul@arm.com> | 2020-06-08 03:56:56 +0100 |
---|---|---|
committer | jimqui01 <54316584+jimqui01@users.noreply.github.com> | 2020-09-15 17:03:53 +0100 |
commit | f272566e57edface6133d26afc304cf28e3f1a3b (patch) | |
tree | 1fbee713b2c6f587e4ef90e3ad213c329ea1da59 /product/morello | |
parent | 3b16a79cf68b1e8ab00bad17990df3f8c10b9ecc (diff) |
morello/scp_ramfw_fvp: add timer and gtimer configs
Change-Id: I5018c5d2edc5fe546525668fbd2eba30cbf59107
Signed-off-by: Anurag Koul <anurag.koul@arm.com>
Diffstat (limited to 'product/morello')
-rw-r--r-- | product/morello/scp_ramfw_fvp/config_timer.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/product/morello/scp_ramfw_fvp/config_timer.c b/product/morello/scp_ramfw_fvp/config_timer.c new file mode 100644 index 00000000..9c93f470 --- /dev/null +++ b/product/morello/scp_ramfw_fvp/config_timer.c @@ -0,0 +1,70 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config_clock.h" +#include "morello_scp_mmap.h" +#include "morello_system_clock.h" + +#include <mod_gtimer.h> +#include <mod_timer.h> + +#include <fwk_element.h> +#include <fwk_id.h> +#include <fwk_module.h> +#include <fwk_module_idx.h> + +#include <fmw_cmsis.h> + +/* + * Generic timer driver config + */ +static const struct fwk_element gtimer_dev_table[] = { + [0] = { .name = "REFCLK", + .data = &((struct mod_gtimer_dev_config){ + .hw_timer = SCP_REFCLK_CNTBASE0_BASE, + .hw_counter = SCP_REFCLK_CNTCTL_BASE, + .control = SCP_REFCLK_CNTCONTROL_BASE, + .frequency = CLOCK_RATE_REFCLK, + .clock_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_CLOCK, + CLOCK_IDX_INTERCONNECT) }) }, + [1] = { 0 }, +}; + +static const struct fwk_element *gtimer_get_dev_table(fwk_id_t module_id) +{ + return gtimer_dev_table; +} + +const struct fwk_module_config config_gtimer = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(gtimer_get_dev_table), +}; + +/* + * Timer HAL config + */ +static const struct fwk_element timer_dev_table[] = { + [0] = + { + .name = "REFCLK", + .data = &((struct mod_timer_dev_config){ + .id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_GTIMER, 0), + .timer_irq = TIMREFCLK_IRQ, + }), + .sub_element_count = 8, /* Number of alarms */ + }, + [1] = { 0 }, +}; + +static const struct fwk_element *timer_get_dev_table(fwk_id_t module_id) +{ + return timer_dev_table; +} + +const struct fwk_module_config config_timer = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(timer_get_dev_table), +}; |