diff --git a/plat/arm/board/arm_fpga/fpga_bl31_setup.c b/plat/arm/board/arm_fpga/fpga_bl31_setup.c index b641ad1..26228f6 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 +#include +#include #include #include @@ -49,7 +51,11 @@ 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 @@ 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 8c542e0..0f817fe 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