[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xen/arm: add OMAP5432 UART support for early_printk



To enable it, add "CONFIG_EARLY_PRINTK := omap5432" to Config.mk

Signed-off-by: Chen Baozi <baozich@xxxxxxxxx>
---
 docs/misc/arm/early-printk.txt    |  1 +
 xen/arch/arm/Rules.mk             |  6 ++++
 xen/arch/arm/arm32/debug-omap.inc | 74 +++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/omap-uart.h   | 62 ++++++++++++++++++++++++++++++++
 4 files changed, 143 insertions(+)
 create mode 100644 xen/arch/arm/arm32/debug-omap.inc
 create mode 100644 xen/include/asm-arm/omap-uart.h

diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
index fbc3208..874488f 100644
--- a/docs/misc/arm/early-printk.txt
+++ b/docs/misc/arm/early-printk.txt
@@ -13,6 +13,7 @@ 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
 
 The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk,
 see there when adding support for new machines.
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index 422ed04..6eac20a 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -64,6 +64,12 @@ EARLY_PRINTK_INC := pl011
 EARLY_PRINTK_BAUD := 115200
 EARLY_UART_BASE_ADDRESS := 0xfff36000
 endif
+ifeq ($(CONFIG_EARLY_PRINTK), omap5432)
+EARLY_PRINTK_INC := omap
+EARLY_PRINTK_INIT_UART := y
+EARLY_PRINTK_BAUD := 115200
+EARLY_UART_BASE_ADDRESS := 0x48020000
+endif
 
 ifneq ($(EARLY_PRINTK_INC),)
 EARLY_PRINTK := y
diff --git a/xen/arch/arm/arm32/debug-omap.inc 
b/xen/arch/arm/arm32/debug-omap.inc
new file mode 100644
index 0000000..1fcf6ba
--- /dev/null
+++ b/xen/arch/arm/arm32/debug-omap.inc
@@ -0,0 +1,74 @@
+/*
+ * xen/arch/arm/arm32/debug-omap.inc
+ *
+ * OMAP 5 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 <asm/omap-uart.h>
+
+/* OMAP UART initialization
+ * rb: register which contains the UART base address
+ * rc: scratch register 1
+ * rd: scratch register 2 */
+.macro early_uart_init rb rc rd
+       mov     \rc, #0
+       str     \rc, [\rb, #UART_IER]
+       mov     \rc, #0x07
+       str     \rc, [\rb, #UART_OMAP_MDR1]
+       mov     \rc, #(UART_LCR_BKSE|UART_LCRVAL)
+       str     \rc, [\rb, #UART_LCR]
+       mov     \rc, #0
+       str     \rc, [\rb, #UART_DLL]
+       str     \rc, [\rb, #UART_DLM]
+       mov     \rc, #(UART_LCRVAL)
+       str     \rc, [\rb, #UART_LCR]
+       mov     \rc, #(UART_MCRVAL)
+       str     \rc, [\rb, #UART_MCR]
+       mov     \rc, #(UART_FCRVAL)
+       str     \rc, [\rb, #UART_FCR]
+       mov     \rc, #(UART_LCR_BKSE|UART_LCRVAL)
+       str     \rc, [\rb, #UART_LCR]
+       /* 115200 baud rate setting: DLL <- 0x1a, DLM <- 0 */
+       mov     \rc, #0x1a
+       str     \rc, [\rb, #UART_DLL]
+       mov     \rc, #0
+       str     \rc, [\rb, #UART_DLM]
+       mov     \rc, #(UART_LCRVAL)
+       str     \rc, [\rb, #UART_LCR]
+       mov     \rc, #0
+       str     \rc, [\rb, #UART_OMAP_MDR1]
+.endm
+
+/* OMAP 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] /* Read line status register */
+       tst     \rc, #UART_LSR_THRE   /* Check Xmit holding register flag */
+       beq     1b                    /* Wait for the UART to be ready */
+.endm
+
+/* OMAP 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_TX]      /* Write Transmit buffer */
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/asm-arm/omap-uart.h b/xen/include/asm-arm/omap-uart.h
new file mode 100644
index 0000000..30f0e74
--- /dev/null
+++ b/xen/include/asm-arm/omap-uart.h
@@ -0,0 +1,62 @@
+/*
+ * xen/include/asm-arm/omap-uart.h
+ *
+ * Common constant definition between early printk and the UART driver
+ * for the OMAP 5432 UART
+ *
+ * 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.
+ */
+
+#ifndef __ASM_ARM_OMAP5432_H
+#define __ASM_ARM_OMAP5432_H
+
+#define UART_RX           (0x00<<2)    /*  In:  Receive buffer */
+#define UART_TX           (0x00<<2)    /*  Out: Transmit buffer */
+
+#define UART_IER          (0x01<<2)    /* Out: Interrupt Enable Register */
+#define UART_IIR          (0x02<<2)    /* In:  Interrupt ID Register */
+#define UART_FCR          (0x02<<2)    /* Out: FIFO Control Register */
+#define UART_LCR          (0x03<<2)    /* Out: Line Control Register */
+#define UART_MCR          (0x04<<2)    /* Out: Modem Control Register */
+#define UART_LSR          (0x05<<2)    /* In:  Line Status Register */
+#define UART_MSR          (0x06<<2)    /* In:  Modem Status Register */
+#define UART_SPR          (0x07<<2)    /* I/O: Scratchpad Register */
+
+#define UART_OMAP_MDR1    (0x08<<2)    /* Mode definition register */
+#define UART_OMAP_MDR2    (0x09<<2)    /* Mode definition register 2 */
+#define UART_OMAP_SCR     (0x10<<2)    /* Supplementary control register */
+#define UART_OMAP_SSR     (0x11<<2)    /* Supplementary status register */
+#define UART_OMAP_EBLR    (0x12<<2)    /* BOF length register */
+#define UART_OMAP_MVR     (0x14<<2)    /* Module version register */
+#define UART_OMAP_SYSC    (0x15<<2)    /* System configuration register */
+#define UART_OMAP_SYSS    (0x16<<2)    /* System status register */
+#define UART_OMAP_WER     (0x17<<2)    /* Wake-up enable register */
+
+#define UART_DLL          (0x00<<2)    /* Out: Divisor Latch Low */
+#define UART_DLM          (0x01<<2)    /* Out: Divisor Latch High */
+
+#define UART_LCR_BKSE     0x80         /* Bank select enable */
+#define UART_LCRVAL       0x03         /* 8 data, 1 stop, no parity */
+#define UART_MCRVAL       0x03         /* RTS|DTR */
+#define UART_FCRVAL       0x07         /* Clear & enable FIFOs */
+
+#define UART_LSR_THRE     0x20         /* Xmit holding register empty */
+
+#endif /* __ASM_ARM_OMAP543_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
1.8.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.