xen/arm: add 8250 compatible UART support for early_printk
authorChen Baozi <baozich@gmail.com>
Tue, 13 Aug 2013 11:14:22 +0000 (19:14 +0800)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 22 Aug 2013 12:17:19 +0000 (13:17 +0100)
Both OMAP5 and sun6i/sun7i SoCs share this UART driver for early_printk.

Signed-off-by: Chen Baozi <baozich@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
docs/misc/arm/early-printk.txt
xen/arch/arm/Rules.mk
xen/arch/arm/arm32/debug-8250.inc [new file with mode: 0644]

index fbc32087d88ce6a6f6c74ce392557046def2795d..14317519ffb25ffaf48eb6957b7c7ff8489caa0f 100644 (file)
@@ -13,6 +13,9 @@ where mach is the name of the machine:
   - exynos5250: printk with the second UART
   - midway: printk with the pl011 on Calxeda Midway processors
   - fastmodel: printk on ARM Fastmodel software emulators
+  - omap5432: printk with UART3 on TI OMAP5432 processors
+  - sun6i: printk with 8250 on Allwinner A31 processors
+  - sun7i: printk with 8250 on Allwinner A20 processors
 
 The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk,
 see there when adding support for new machines.
index d80dfce584419ebaee5d87feeab8493d0ca78fc1..bd79b269aff88276343de1e891d0384ca106d4c3 100644 (file)
@@ -62,6 +62,21 @@ EARLY_PRINTK_INC := pl011
 EARLY_PRINTK_BAUD := 115200
 EARLY_UART_BASE_ADDRESS := 0xfff36000
 endif
+ifeq ($(CONFIG_EARLY_PRINTK), omap5432)
+EARLY_PRINTK_INC := 8250
+EARLY_UART_BASE_ADDRESS := 0x48020000
+EARLY_UART_REG_SHIFT := 2
+endif
+ifeq ($(CONFIG_EARLY_PRINTK), sun6i)
+EARLY_PRINTK_INC := 8250
+EARLY_UART_BASE_ADDRESS := 0x01c28000
+EARLY_UART_REG_SHIFT := 2
+endif
+ifeq ($(CONFIG_EARLY_PRINTK), sun7i)
+EARLY_PRINTK_INC := 8250
+EARLY_UART_BASE_ADDRESS := 0x01c28000
+EARLY_UART_REG_SHIFT := 2
+endif
 
 ifneq ($(EARLY_PRINTK_INC),)
 EARLY_PRINTK := y
@@ -72,4 +87,5 @@ CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART
 CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"
 CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
 CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
+CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
 endif
diff --git a/xen/arch/arm/arm32/debug-8250.inc b/xen/arch/arm/arm32/debug-8250.inc
new file mode 100644 (file)
index 0000000..eb25882
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * xen/arch/arm/arm32/debug-8250.inc
+ *
+ * 8250 specific debug code
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <xen/8250-uart.h>
+
+/* 8250 UART wait UART to be ready to transmit
+ * rb: register which contains the UART base address
+ * rc: scratch register */
+.macro early_uart_ready rb rc
+1:
+       ldr     \rc, [\rb, #(UART_LSR << EARLY_UART_REG_SHIFT)] /* Read LSR */
+       tst     \rc, #UART_LSR_THRE     /* Check Xmit holding register flag */
+       beq     1b                         /* Wait for the UART to be ready */
+.endm
+
+/* 8250 UART transmit character
+ * rb: register which contains the UART base address
+ * rt: register which contains the character to transmit */
+.macro early_uart_transmit rb rt
+        str   \rt, [\rb, #UART_THR]      /* Write Transmit buffer */
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */