From 97ca02cb170f870d5a47f92d5b9a79fe4664dca4 Mon Sep 17 00:00:00 2001 From: Jonathan Neuschäfer Date: Mon, 29 Oct 2018 14:32:49 +0100 Subject: soc/sifive/fu540: Add helper function to get tlclk frequency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tlclk is not specific to the UART block in the FU540, so let's calculate its frequency in clock.c. Change-Id: I270920027f1132253e413a1bf9feb4fe279b651a Signed-off-by: Jonathan Neuschäfer Reviewed-on: https://review.coreboot.org/c/29335 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Philipp Hug --- src/soc/sifive/fu540/clock.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/soc/sifive/fu540/clock.c') diff --git a/src/soc/sifive/fu540/clock.c b/src/soc/sifive/fu540/clock.c index 8aaba35d6c..597b2069db 100644 --- a/src/soc/sifive/fu540/clock.c +++ b/src/soc/sifive/fu540/clock.c @@ -250,3 +250,14 @@ int clock_get_coreclk_khz(void) / (divr + 1) / (1ul << divq); } + +/* Get the TileLink clock's frequency, in KHz */ +int clock_get_tlclk_khz(void) +{ + /* + * The TileLink bus and most peripherals use tlclk, which is coreclk/2, + * as input. + */ + + return clock_get_coreclk_khz() / 2; +} -- cgit v1.2.3