Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2014 - 2015 Xilinx, Inc. |
| 4 | * Michal Simek <michal.simek@xilinx.com> |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 691d719 | 2020-05-10 11:40:02 -0600 | [diff] [blame^] | 8 | #include <init.h> |
Simon Glass | 049f8d6 | 2019-12-28 10:44:59 -0700 | [diff] [blame] | 9 | #include <time.h> |
Michal Simek | 16247d2 | 2015-04-15 14:59:19 +0200 | [diff] [blame] | 10 | #include <asm/arch/clk.h> |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 11 | #include <asm/arch/hardware.h> |
| 12 | #include <asm/arch/sys_proto.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
Michal Simek | 0785dfd | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 16 | unsigned long zynqmp_get_system_timer_freq(void) |
| 17 | { |
| 18 | u32 ver = zynqmp_get_silicon_version(); |
| 19 | |
| 20 | switch (ver) { |
Michal Simek | 0785dfd | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 21 | case ZYNQMP_CSU_VERSION_QEMU: |
| 22 | return 50000000; |
| 23 | } |
| 24 | |
| 25 | return 100000000; |
| 26 | } |
| 27 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 28 | #ifdef CONFIG_CLOCKS |
| 29 | /** |
| 30 | * set_cpu_clk_info() - Initialize clock framework |
| 31 | * Always returns zero. |
| 32 | * |
| 33 | * This function is called from common code after relocation and sets up the |
| 34 | * clock framework. The framework must not be used before this function had been |
| 35 | * called. |
| 36 | */ |
| 37 | int set_cpu_clk_info(void) |
| 38 | { |
| 39 | gd->cpu_clk = get_tbclk(); |
| 40 | |
Michal Simek | 8dd94a8 | 2018-05-14 15:33:22 +0200 | [diff] [blame] | 41 | gd->bd->bi_arm_freq = gd->cpu_clk / 1000000; |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 42 | |
| 43 | gd->bd->bi_dsp_freq = 0; |
| 44 | |
| 45 | return 0; |
| 46 | } |
| 47 | #endif |