[coreboot-gerrit] Change in coreboot[master]: HACK: sdm845: Implement bitbang UART for bootblock

Julius Werner (Code Review) gerrit at coreboot.org
Wed Apr 25 01:42:58 CEST 2018


Julius Werner has uploaded this change for review. ( https://review.coreboot.org/25813


Change subject: HACK: sdm845: Implement bitbang UART for bootblock
......................................................................

HACK: sdm845: Implement bitbang UART for bootblock

Work in progress, not ready for review. We'll need to get the <gpio.h>
API working for SDM845 first and then change this code to use it.

Change-Id: I0c252ec83a7993edce5c4debc687f1fdd0d7b36d
Signed-off-by: Julius Werner <jwerner at chromium.org>
---
M src/soc/qualcomm/sdm845/Makefile.inc
A src/soc/qualcomm/sdm845/uart_bitbang.c
2 files changed, 48 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/25813/1

diff --git a/src/soc/qualcomm/sdm845/Makefile.inc b/src/soc/qualcomm/sdm845/Makefile.inc
index bb27ef3..144bbf8 100644
--- a/src/soc/qualcomm/sdm845/Makefile.inc
+++ b/src/soc/qualcomm/sdm845/Makefile.inc
@@ -6,6 +6,7 @@
 bootblock-y += timer.c
 bootblock-y += spi.c
 bootblock-y += mmu.c
+bootblock-$(CONFIG_DRIVERS_UART) += uart_bitbang.c
 
 ################################################################################
 verstage-y += timer.c
diff --git a/src/soc/qualcomm/sdm845/uart_bitbang.c b/src/soc/qualcomm/sdm845/uart_bitbang.c
new file mode 100644
index 0000000..5bc29ea
--- /dev/null
+++ b/src/soc/qualcomm/sdm845/uart_bitbang.c
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <arch/io.h>
+#include <console/uart.h>
+#include <types.h>
+
+static u32 *uart_tx_tlmm_cfg = (void *)0x03904000;
+static u32 *uart_tx_tlmm_in_out = (void *)0x03904004;
+
+static void set_tx(int line_state)
+{
+	write32(uart_tx_tlmm_in_out, line_state ? 0x2 : 0);
+}
+
+void uart_init(int idx)
+{
+	set_tx(1);
+	write32(uart_tx_tlmm_cfg, 0x203);
+}
+
+void uart_tx_byte(int idx, unsigned char data)
+{
+	uart_bitbang_tx_byte(data, set_tx);
+}
+
+void uart_tx_flush(int idx)
+{
+	/* unnecessary, PIO Tx means transaction is over when tx_byte returns */
+}
+
+unsigned char uart_rx_byte(int idx)
+{
+	return 0;	/* not implemented */
+}

-- 
To view, visit https://review.coreboot.org/25813
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: I0c252ec83a7993edce5c4debc687f1fdd0d7b36d
Gerrit-Change-Number: 25813
Gerrit-PatchSet: 1
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180424/1dd90c5e/attachment-0001.html>


More information about the coreboot-gerrit mailing list