<p>Jonathan Neuschäfer has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/29335">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/sifive/fu540: Add helper function to get tlclk frequency<br><br>tlclk is not specific to the UART block in the FU540, so let's calculate<br>its frequency in clock.c.<br><br>Change-Id: I270920027f1132253e413a1bf9feb4fe279b651a<br>Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net><br>---<br>M src/soc/sifive/fu540/clock.c<br>M src/soc/sifive/fu540/include/soc/clock.h<br>M src/soc/sifive/fu540/uart.c<br>3 files changed, 13 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/29335/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/sifive/fu540/clock.c b/src/soc/sifive/fu540/clock.c</span><br><span>index a8b61f1..edebe42 100644</span><br><span>--- a/src/soc/sifive/fu540/clock.c</span><br><span>+++ b/src/soc/sifive/fu540/clock.c</span><br><span>@@ -262,3 +262,14 @@</span><br><span>               / (divr + 1)</span><br><span>                 / (1ul << divq);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Get the TileLink clock's frequency, in KHz */</span><br><span style="color: hsl(120, 100%, 40%);">+int clock_get_tlclk_khz(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * The TileLink bus and most peripherals use tlclk, which is coreclk/2,</span><br><span style="color: hsl(120, 100%, 40%);">+        * as input.</span><br><span style="color: hsl(120, 100%, 40%);">+   */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return clock_get_coreclk_khz() / 2;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/soc/sifive/fu540/include/soc/clock.h b/src/soc/sifive/fu540/include/soc/clock.h</span><br><span>index d54c666..706c9c0 100644</span><br><span>--- a/src/soc/sifive/fu540/include/soc/clock.h</span><br><span>+++ b/src/soc/sifive/fu540/include/soc/clock.h</span><br><span>@@ -18,5 +18,6 @@</span><br><span> </span><br><span> void clock_init(void);</span><br><span> int clock_get_coreclk_khz(void);</span><br><span style="color: hsl(120, 100%, 40%);">+int clock_get_tlclk_khz(void);</span><br><span> </span><br><span> #endif /* __SOC_SIFIVE_HIFIFE_U_CLOCK_H__ */</span><br><span>diff --git a/src/soc/sifive/fu540/uart.c b/src/soc/sifive/fu540/uart.c</span><br><span>index 454b13d..b59b789 100644</span><br><span>--- a/src/soc/sifive/fu540/uart.c</span><br><span>+++ b/src/soc/sifive/fu540/uart.c</span><br><span>@@ -29,9 +29,5 @@</span><br><span> </span><br><span> unsigned int uart_platform_refclk(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-  /*</span><br><span style="color: hsl(0, 100%, 40%);">-       * The SiFive UART uses tlclk, which is coreclk/2, as input</span><br><span style="color: hsl(0, 100%, 40%);">-      */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     return clock_get_coreclk_khz() * KHz / 2;</span><br><span style="color: hsl(120, 100%, 40%);">+     return clock_get_tlclk_khz() * KHz;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/29335">change 29335</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/29335"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I270920027f1132253e413a1bf9feb4fe279b651a </div>
<div style="display:none"> Gerrit-Change-Number: 29335 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer@gmx.net> </div>