[coreboot-gerrit] Change in coreboot[master]: soc/sifive/fu540: Add helper function to get tlclk frequency
Jonathan Neuschäfer (Code Review)
gerrit at coreboot.org
Mon Oct 29 15:19:48 CET 2018
Jonathan Neuschäfer has uploaded this change for review. ( https://review.coreboot.org/29335
Change subject: soc/sifive/fu540: Add helper function to get tlclk frequency
......................................................................
soc/sifive/fu540: Add helper function to get tlclk frequency
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 <j.neuschaefer at gmx.net>
---
M src/soc/sifive/fu540/clock.c
M src/soc/sifive/fu540/include/soc/clock.h
M src/soc/sifive/fu540/uart.c
3 files changed, 13 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/29335/1
diff --git a/src/soc/sifive/fu540/clock.c b/src/soc/sifive/fu540/clock.c
index a8b61f1..edebe42 100644
--- a/src/soc/sifive/fu540/clock.c
+++ b/src/soc/sifive/fu540/clock.c
@@ -262,3 +262,14 @@
/ (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;
+}
diff --git a/src/soc/sifive/fu540/include/soc/clock.h b/src/soc/sifive/fu540/include/soc/clock.h
index d54c666..706c9c0 100644
--- a/src/soc/sifive/fu540/include/soc/clock.h
+++ b/src/soc/sifive/fu540/include/soc/clock.h
@@ -18,5 +18,6 @@
void clock_init(void);
int clock_get_coreclk_khz(void);
+int clock_get_tlclk_khz(void);
#endif /* __SOC_SIFIVE_HIFIFE_U_CLOCK_H__ */
diff --git a/src/soc/sifive/fu540/uart.c b/src/soc/sifive/fu540/uart.c
index 454b13d..b59b789 100644
--- a/src/soc/sifive/fu540/uart.c
+++ b/src/soc/sifive/fu540/uart.c
@@ -29,9 +29,5 @@
unsigned int uart_platform_refclk(void)
{
- /*
- * The SiFive UART uses tlclk, which is coreclk/2, as input
- */
-
- return clock_get_coreclk_khz() * KHz / 2;
+ return clock_get_tlclk_khz() * KHz;
}
--
To view, visit https://review.coreboot.org/29335
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I270920027f1132253e413a1bf9feb4fe279b651a
Gerrit-Change-Number: 29335
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181029/ab532f1e/attachment-0001.html>
More information about the coreboot-gerrit
mailing list