blob: f7e5ebfa6343dc79b542700a80816c0e6365de1d [file] [log] [blame]
Michal Simek04b7e622015-01-15 10:01:51 +01001/*
2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
Michal Simek0ca55572015-04-15 14:59:19 +02009#include <asm/arch/clk.h>
Michal Simek04b7e622015-01-15 10:01:51 +010010#include <asm/arch/hardware.h>
11#include <asm/arch/sys_proto.h>
12
13DECLARE_GLOBAL_DATA_PTR;
14
Michal Simekc23d3f82015-11-05 08:34:35 +010015unsigned long zynqmp_get_system_timer_freq(void)
16{
17 u32 ver = zynqmp_get_silicon_version();
18
19 switch (ver) {
20 case ZYNQMP_CSU_VERSION_VELOCE:
21 return 10000;
22 case ZYNQMP_CSU_VERSION_EP108:
23 return 4000000;
24 case ZYNQMP_CSU_VERSION_QEMU:
25 return 50000000;
26 }
27
28 return 100000000;
29}
30
Michal Simek04b7e622015-01-15 10:01:51 +010031#ifdef CONFIG_CLOCKS
32/**
33 * set_cpu_clk_info() - Initialize clock framework
34 * Always returns zero.
35 *
36 * This function is called from common code after relocation and sets up the
37 * clock framework. The framework must not be used before this function had been
38 * called.
39 */
40int set_cpu_clk_info(void)
41{
42 gd->cpu_clk = get_tbclk();
43
44 /* Support Veloce to show at least 1MHz via bdi */
45 if (gd->cpu_clk > 1000000)
46 gd->bd->bi_arm_freq = gd->cpu_clk / 1000000;
47 else
48 gd->bd->bi_arm_freq = 1;
49
50 gd->bd->bi_dsp_freq = 0;
51
52 return 0;
53}
54#endif