<p>nsekar@codeaurora.org has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/c/coreboot/+/29956">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">qcs405: Implement bitbang UART for bootblock<br><br>This patch replaces the UART in the bootblock of QCS405 with a bitbang<br>implementation. Since QCS405 hardware UART needs a firmware blob loaded<br>into it before it becomes usable, it is not really suited for use in the<br>bootblock (since by the time we can read blobs from SPI, the bootblock<br>is essentially over anyway). This solution allows us to still have some<br>console output during early SoC initialization.<br><br>Change-Id: Ib631929f6194d0da8571a930230f0eb460fefaa6<br>Signed-off-by: Sricharan R <sricharan@codeaurora.org><br>Signed-off-by: Nitheesh Sekar <nsekar@codeaurora.org><br>---<br>M src/soc/qualcomm/qcs405/Kconfig<br>M src/soc/qualcomm/qcs405/Makefile.inc<br>A src/soc/qualcomm/qcs405/uart_bitbang.c<br>3 files changed, 47 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/56/29956/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/qualcomm/qcs405/Kconfig b/src/soc/qualcomm/qcs405/Kconfig</span><br><span>index 83c3996..492e80e 100644</span><br><span>--- a/src/soc/qualcomm/qcs405/Kconfig</span><br><span>+++ b/src/soc/qualcomm/qcs405/Kconfig</span><br><span>@@ -11,6 +11,7 @@</span><br><span>   select GENERIC_UDELAY</span><br><span>        select HAVE_MONOTONIC_TIMER</span><br><span>  select ARM64_USE_ARCH_TIMER</span><br><span style="color: hsl(120, 100%, 40%);">+   select HAVE_UART_SPECIAL</span><br><span> </span><br><span> if SOC_QUALCOMM_QCS405</span><br><span> </span><br><span>diff --git a/src/soc/qualcomm/qcs405/Makefile.inc b/src/soc/qualcomm/qcs405/Makefile.inc</span><br><span>index 131f204..f05c987 100644</span><br><span>--- a/src/soc/qualcomm/qcs405/Makefile.inc</span><br><span>+++ b/src/soc/qualcomm/qcs405/Makefile.inc</span><br><span>@@ -7,6 +7,7 @@</span><br><span> bootblock-y += mmu.c</span><br><span> bootblock-y += timer.c</span><br><span> bootblock-y += gpio.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 += spi.c</span><br><span>diff --git a/src/soc/qualcomm/qcs405/uart_bitbang.c b/src/soc/qualcomm/qcs405/uart_bitbang.c</span><br><span>new file mode 100644</span><br><span>index 0000000..8827bc4</span><br><span>--- /dev/null</span><br><span>+++ b/src/soc/qualcomm/qcs405/uart_bitbang.c</span><br><span>@@ -0,0 +1,45 @@</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 <console/uart.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <gpio.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%);">+#define UART_TX_PIN GPIO(17)</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%);">+  gpio_set(UART_TX_PIN, line_state);</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%);">+   gpio_output(UART_TX_PIN, 1);</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/c/coreboot/+/29956">change 29956</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/c/coreboot/+/29956"/><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-Change-Id: Ib631929f6194d0da8571a930230f0eb460fefaa6 </div>
<div style="display:none"> Gerrit-Change-Number: 29956 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: nsekar@codeaurora.org </div>
<div style="display:none"> Gerrit-Reviewer: Martin Roth <martinroth@google.com> </div>
<div style="display:none"> Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com> </div>
<div style="display:none"> Gerrit-Reviewer: nsekar@codeaurora.org </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>