<p>Julius Werner has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25813">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">HACK: sdm845: Implement bitbang UART for bootblock<br><br>Work in progress, not ready for review. We'll need to get the <gpio.h><br>API working for SDM845 first and then change this code to use it.<br><br>Change-Id: I0c252ec83a7993edce5c4debc687f1fdd0d7b36d<br>Signed-off-by: Julius Werner <jwerner@chromium.org><br>---<br>M src/soc/qualcomm/sdm845/Makefile.inc<br>A src/soc/qualcomm/sdm845/uart_bitbang.c<br>2 files changed, 48 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/13/25813/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/qualcomm/sdm845/Makefile.inc b/src/soc/qualcomm/sdm845/Makefile.inc</span><br><span>index bb27ef3..144bbf8 100644</span><br><span>--- a/src/soc/qualcomm/sdm845/Makefile.inc</span><br><span>+++ b/src/soc/qualcomm/sdm845/Makefile.inc</span><br><span>@@ -6,6 +6,7 @@</span><br><span> bootblock-y += timer.c</span><br><span> bootblock-y += spi.c</span><br><span> bootblock-y += mmu.c</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-$(CONFIG_DRIVERS_UART) += uart_bitbang.c</span><br><span> </span><br><span> ################################################################################</span><br><span> verstage-y += timer.c</span><br><span>diff --git a/src/soc/qualcomm/sdm845/uart_bitbang.c b/src/soc/qualcomm/sdm845/uart_bitbang.c</span><br><span>new file mode 100644</span><br><span>index 0000000..5bc29ea</span><br><span>--- /dev/null</span><br><span>+++ b/src/soc/qualcomm/sdm845/uart_bitbang.c</span><br><span>@@ -0,0 +1,47 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018 Google LLC</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License version 2 and</span><br><span style="color: hsl(120, 100%, 40%);">+ * only version 2 as published by the Free Software Foundation.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</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%);">+#include <arch/io.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/uart.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <types.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static u32 *uart_tx_tlmm_cfg = (void *)0x03904000;</span><br><span style="color: hsl(120, 100%, 40%);">+static u32 *uart_tx_tlmm_in_out = (void *)0x03904004;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void set_tx(int line_state)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       write32(uart_tx_tlmm_in_out, line_state ? 0x2 : 0);</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%);">+void uart_init(int idx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  set_tx(1);</span><br><span style="color: hsl(120, 100%, 40%);">+    write32(uart_tx_tlmm_cfg, 0x203);</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%);">+void uart_tx_byte(int idx, unsigned char data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     uart_bitbang_tx_byte(data, set_tx);</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%);">+void uart_tx_flush(int idx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      /* unnecessary, PIO Tx means transaction is over when tx_byte returns */</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%);">+unsigned char uart_rx_byte(int idx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;       /* not implemented */</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25813">change 25813</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/25813"/><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: I0c252ec83a7993edce5c4debc687f1fdd0d7b36d </div>
<div style="display:none"> Gerrit-Change-Number: 25813 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Julius Werner <jwerner@chromium.org> </div>