aboutsummaryrefslogtreecommitdiffstats
path: root/plat
diff options
context:
space:
mode:
authorOliver Swede <oli.swede@arm.com>2019-12-02 13:33:40 +0000
committerOliver Swede <oli.swede@arm.com>2020-03-26 20:40:50 +0000
commit2d696d1811a370c742b69cf6442144d906a91d8c (patch)
treeb5a955547342b2608456438fdfd716bab3ee185b /plat
parent7ee4db6e4720ebb45a7c20da06c06091ee95c298 (diff)
downloadplatform_external_arm-trusted-firmware-2d696d1811a370c742b69cf6442144d906a91d8c.tar.gz
platform_external_arm-trusted-firmware-2d696d1811a370c742b69cf6442144d906a91d8c.tar.bz2
platform_external_arm-trusted-firmware-2d696d1811a370c742b69cf6442144d906a91d8c.zip
plat/arm/board/arm_fpga: Initialize the System Counter
This sets the frequency of the system counter so that the Delay Timer driver programs the correct value to CNTCRL. This value depends on the FPGA image being used, and is 10MHz for the initial test image. Once configured, the BL31 platform setup sequence then enables the system counter. Signed-off-by: Oliver Swede <oli.swede@arm.com> Change-Id: Ieb036a36fd990f350b5953357424a255b8ac5d5a
Diffstat (limited to 'plat')
-rw-r--r--plat/arm/board/arm_fpga/fpga_bl31_setup.c14
-rw-r--r--plat/arm/board/arm_fpga/fpga_def.h3
2 files changed, 11 insertions, 6 deletions
diff --git a/plat/arm/board/arm_fpga/fpga_bl31_setup.c b/plat/arm/board/arm_fpga/fpga_bl31_setup.c
index b641ad194..26228f69e 100644
--- a/plat/arm/board/arm_fpga/fpga_bl31_setup.c
+++ b/plat/arm/board/arm_fpga/fpga_bl31_setup.c
@@ -5,6 +5,8 @@
*/
#include <assert.h>
+#include <lib/mmio.h>
+#include <drivers/generic_delay_timer.h>
#include <plat/common/platform.h>
#include <platform_def.h>
@@ -49,7 +51,11 @@ void bl31_plat_arch_setup(void)
void bl31_platform_setup(void)
{
- /* TODO: initialize GIC and timer using the specifications of the FPGA image */
+ /* Write frequency to CNTCRL and initialize timer */
+ generic_delay_timer_init();
+ mmio_write_32(FPGA_TIMER_BASE, ((1 << 8) | 1UL));
+
+ /* TODO: initialize GIC using the specifications of the FPGA image */
}
entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
@@ -70,11 +76,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
unsigned int plat_get_syscnt_freq2(void)
{
- /*
- * TODO: return the frequency of the System Counter as configured by the
- * FPGA image
- */
- return 0;
+ return FPGA_TIMER_FREQUENCY;
}
void bl31_plat_enable_mmu(uint32_t flags)
diff --git a/plat/arm/board/arm_fpga/fpga_def.h b/plat/arm/board/arm_fpga/fpga_def.h
index 8c542e095..0f817fe9d 100644
--- a/plat/arm/board/arm_fpga/fpga_def.h
+++ b/plat/arm/board/arm_fpga/fpga_def.h
@@ -30,4 +30,7 @@
#define PLAT_FPGA_CRASH_UART_BASE PLAT_FPGA_BOOT_UART_BASE
#define PLAT_FPGA_CRASH_UART_CLK_IN_HZ PLAT_FPGA_BOOT_UART_CLK_IN_HZ
+#define FPGA_TIMER_FREQUENCY 10000000
+#define FPGA_TIMER_BASE 0x2a830000
+
#endif