diff options
author | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2014-04-02 15:51:19 +0100 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2014-04-07 17:44:17 +0100 |
commit | a809fd9468af4ea572e338805883dcc599b56868 (patch) | |
tree | 57be3dbbd7b7a808220aeb954a729f61453c6dc4 | |
parent | a5355358f34a6b0a37753fbe03d94ddb05f43e57 (diff) | |
download | trusted-firmware-a-0.3-Juno-0.2.tar.gz |
juno: Implement plat_get_syscnt_freq() functionv0.3-Juno-0.2
In the Juno port, this function returns the first entry of the
frequency modes table from the memory mapped generic timer.
-rw-r--r-- | plat/juno/aarch64/plat_common.c | 15 | ||||
-rw-r--r-- | plat/juno/bl1_plat_setup.c | 2 | ||||
-rw-r--r-- | plat/juno/platform.h | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/plat/juno/aarch64/plat_common.c b/plat/juno/aarch64/plat_common.c index 0011cb7aad..a3ecb005fc 100644 --- a/plat/juno/aarch64/plat_common.c +++ b/plat/juno/aarch64/plat_common.c @@ -31,7 +31,7 @@ #include <arch_helpers.h> #include <platform.h> #include <xlat_tables.h> - +#include <assert.h> unsigned char platform_normal_stacks[PLATFORM_STACK_SIZE][PLATFORM_CORE_COUNT] __attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE), @@ -133,3 +133,16 @@ unsigned long plat_get_ns_image_entrypoint(void) { return NS_IMAGE_OFFSET; } + +uint64_t plat_get_syscnt_freq(void) +{ + uint64_t counter_base_frequency; + + /* Read the frequency from Frequency modes table */ + counter_base_frequency = mmio_read_32(SYS_CNTCTL_BASE + CNTFID_OFF); + + /* The first entry of the frequency modes table must not be 0 */ + assert(counter_base_frequency != 0); + + return counter_base_frequency; +} diff --git a/plat/juno/bl1_plat_setup.c b/plat/juno/bl1_plat_setup.c index 7fe96f2bb4..91c0caf984 100644 --- a/plat/juno/bl1_plat_setup.c +++ b/plat/juno/bl1_plat_setup.c @@ -208,7 +208,7 @@ void bl1_platform_setup(void) io_setup(); /* Enable and initialize the System level generic timer */ - mmio_write_32(SYS_CNTCTL_BASE + CNTCR_OFF, CNTCR_EN); + mmio_write_32(SYS_CNTCTL_BASE + CNTCR_OFF, CNTCR_FCREQ(0) | CNTCR_EN); } diff --git a/plat/juno/platform.h b/plat/juno/platform.h index dfcffff926..fcf63b7ce7 100644 --- a/plat/juno/platform.h +++ b/plat/juno/platform.h @@ -335,6 +335,7 @@ extern void configure_mmu(meminfo *, extern void plat_report_exception(unsigned long); extern unsigned long plat_get_ns_image_entrypoint(void); extern unsigned long platform_get_stack(unsigned long mpidr); +extern uint64_t plat_get_syscnt_freq(void); /* Declarations for fvp_gic.c */ extern void gic_cpuif_deactivate(unsigned int); |