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