<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25382">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/cavium: Apply additional devicetree fixups<br><br>Depends on Change-Id: I0f27b92a5e074966f893399eb401eb97d784850d<br><br>Apply additional devicetree fixes:<br>* Update SCLK from boot fuses<br>* Updated REFCLKUAA from UART ref clock divider settings<br><br>Fixes Linux console wrong baud rate once the PL011 driver is started.<br>Tested on Cavium SoC.<br><br>Change-Id: I7e8eefd913915a879dad28dfb7801a2018ed2985<br>Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com><br>---<br>M src/soc/cavium/cn81xx/soc.c<br>1 file changed, 31 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/25382/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/cavium/cn81xx/soc.c b/src/soc/cavium/cn81xx/soc.c</span><br><span>index 83ee118..2e331f70 100644</span><br><span>--- a/src/soc/cavium/cn81xx/soc.c</span><br><span>+++ b/src/soc/cavium/cn81xx/soc.c</span><br><span>@@ -27,9 +27,40 @@</span><br><span> #include <stdlib.h></span><br><span> #include <string.h></span><br><span> #include <symbols.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/uart.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <fit.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* FIXME(dhendrix): Need TZRAM_* definitions from ATF for Cavium */</span><br><span> //#include <arm-trusted-firmware/plat/rockchip/ck3399/include/shared/bl31_param.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Do additional devicetree modifications. */</span><br><span style="color: hsl(120, 100%, 40%);">+void fit_platform_fixup(struct DeviceTree *tree)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     DeviceTreeNode *dt_node;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Set the sclk clock rate. */</span><br><span style="color: hsl(120, 100%, 40%);">+        dt_node = dt_find_node_by_path(tree->root, "soc@0/sclk", NULL, NULL, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (dt_node) {</span><br><span style="color: hsl(120, 100%, 40%);">+                const u32 freq = thunderx_get_io_clock();</span><br><span style="color: hsl(120, 100%, 40%);">+             printk(BIOS_INFO, "%s: Set SCLK to %u Hz\n", __func__, freq);</span><br><span style="color: hsl(120, 100%, 40%);">+               dt_add_u32_prop(dt_node, "clock-frequency", freq);</span><br><span style="color: hsl(120, 100%, 40%);">+  } else</span><br><span style="color: hsl(120, 100%, 40%);">+                printk(BIOS_ERR, "%s: Node not found. OS might miss-behave !\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                   __func__);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Set refclkuaa clock rate. */</span><br><span style="color: hsl(120, 100%, 40%);">+       dt_node = dt_find_node_by_path(tree->root, "soc@0/refclkuaa", NULL,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     NULL, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+      if (dt_node) {</span><br><span style="color: hsl(120, 100%, 40%);">+                const u32 freq = uart_platform_refclk();</span><br><span style="color: hsl(120, 100%, 40%);">+              printk(BIOS_INFO, "%s: Set REFCLKUAA to %u Hz\n", __func__,</span><br><span style="color: hsl(120, 100%, 40%);">+                freq);</span><br><span style="color: hsl(120, 100%, 40%);">+         dt_add_u32_prop(dt_node, "clock-frequency", freq);</span><br><span style="color: hsl(120, 100%, 40%);">+  } else</span><br><span style="color: hsl(120, 100%, 40%);">+                printk(BIOS_ERR, "%s: Node not found. OS might miss-behave !\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                   __func__);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void soc_read_resources(device_t dev)</span><br><span> {</span><br><span>  ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size_mb() * KiB);</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25382">change 25382</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/25382"/><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: I7e8eefd913915a879dad28dfb7801a2018ed2985 </div>
<div style="display:none"> Gerrit-Change-Number: 25382 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com> </div>