summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2022-05-15 07:33:14 +0300
committerStafford Horne <shorne@gmail.com>2022-05-23 11:15:49 +0300
commit29bbb2a90fcdd46d9f12746deac4718082df325a (patch)
tree31e3282531fa595c92ce910b2db3f918b355f490
parente449759c246e1594307760f7203debf6038a42ea (diff)
downloadlinux-29bbb2a90fcdd46d9f12746deac4718082df325a.tar.xz
openrisc: Add support for liteuart emergency printing
This patch adds support for sending emergency print output, such as unhandled exception details, to a liteuart serial device. This is the default device available on litex platforms. If a developer want to use this they should update UART_BASE_ADD to the address of liteuart. Signed-off-by: Stafford Horne <shorne@gmail.com>
-rw-r--r--arch/openrisc/kernel/head.S13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
index 7bfa6e4b60c5..21db50563f97 100644
--- a/arch/openrisc/kernel/head.S
+++ b/arch/openrisc/kernel/head.S
@@ -1555,7 +1555,18 @@ ENTRY(_emergency_putc)
l.movhi r4,hi(UART_BASE_ADD)
l.ori r4,r4,lo(UART_BASE_ADD)
-#if defined(CONFIG_SERIAL_8250)
+#if defined(CONFIG_SERIAL_LITEUART)
+ /* Check OFF_TXFULL status */
+1: l.lwz r5,4(r4)
+ l.andi r5,r5,0xff
+ l.sfnei r5,0
+ l.bf 1b
+ l.nop
+
+ /* Write character */
+ l.andi r7,r7,0xff
+ l.sw 0(r4),r7
+#elif defined(CONFIG_SERIAL_8250)
/* Check UART LSR THRE (hold) bit */
l.addi r6,r0,0x20
1: l.lbz r5,5(r4)