diff options
author | Amit Daniel Kachhap <amit.kachhap@arm.com> | 2018-07-20 17:50:27 +0530 |
---|---|---|
committer | ronald-cron-arm <39518861+ronald-cron-arm@users.noreply.github.com> | 2018-10-18 17:22:34 +0000 |
commit | c7065eedb2110ae1350d64586d7836a38cc889a2 (patch) | |
tree | 169b02194a3cca67bbd08eb484c253455d2339fd /product/sgi575 | |
parent | c384b54bab5f24aa5ce4eba3583d479eae2d66e6 (diff) |
sgi575/scp_ramfw: Add timer and gtimer support
Change-Id: If994d8ea2fb2199756526beed14cca00e78ae601
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Diffstat (limited to 'product/sgi575')
-rw-r--r-- | product/sgi575/scp_ramfw/config_timer.c | 64 | ||||
-rw-r--r-- | product/sgi575/scp_ramfw/firmware.mk | 10 |
2 files changed, 70 insertions, 4 deletions
diff --git a/product/sgi575/scp_ramfw/config_timer.c b/product/sgi575/scp_ramfw/config_timer.c new file mode 100644 index 00000000..ae959e30 --- /dev/null +++ b/product/sgi575/scp_ramfw/config_timer.c @@ -0,0 +1,64 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <fwk_id.h> +#include <fwk_module.h> +#include <fwk_module_idx.h> +#include <mod_gtimer.h> +#include <mod_timer.h> +#include <scp_sgi575_irq.h> +#include <scp_sgi575_mmap.h> +#include <system_clock.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, + }) + }, + [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 = { + .get_element_table = 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 = { + .get_element_table = timer_get_dev_table, +}; diff --git a/product/sgi575/scp_ramfw/firmware.mk b/product/sgi575/scp_ramfw/firmware.mk index 43ccb7fb..24057994 100644 --- a/product/sgi575/scp_ramfw/firmware.mk +++ b/product/sgi575/scp_ramfw/firmware.mk @@ -9,17 +9,19 @@ BS_FIRMWARE_CPU := cortex-m7 BS_FIRMWARE_HAS_MULTITHREADING := yes BS_FIRMWARE_HAS_NOTIFICATION := yes BS_FIRMWARE_MODULE_HEADERS_ONLY := \ - power_domain \ - timer + power_domain BS_FIRMWARE_MODULES := \ pl011 \ log \ - clock + clock \ + gtimer \ + timer BS_FIRMWARE_SOURCES := \ rtx_config.c \ config_log.c \ - config_clock.c + config_clock.c \ + config_timer.c include $(BS_DIR)/firmware.mk |