From: Bamvor Jian Zhang <bjzhang@suse.com>
To: xen-devel@lists.xen.org
Cc: andre.przywara@calxeda.com, ian.campbell@citrix.com,
Stefano.Stabellini@eu.citrix.com, julien.grall@linaro.org,
bjzhang@suse.com, baozich@gmail.com
Subject: [PATCH V2 2/2] xen: arm: implement early prink for 8250 uart
Date: Tue, 2 Jul 2013 21:11:54 +0800 [thread overview]
Message-ID: <1372770714-1657-3-git-send-email-bjzhang@suse.com> (raw)
In-Reply-To: <1372770714-1657-1-git-send-email-bjzhang@suse.com>
implement early printk for 8250 uart which is used by lots of arm SOC, such as
Allwinner A31(sun6i) and OMAP5432.
Signed-off-by: Bamvor Jian Zhang <bjzhang@suse.com>
---
docs/misc/arm/early-printk.txt | 1 +
xen/arch/arm/Rules.mk | 5 ++++
xen/arch/arm/arm32/debug-8250.inc | 48 +++++++++++++++++++++++++++++++++++++++
3 files changed, 54 insertions(+)
create mode 100644 xen/arch/arm/arm32/debug-8250.inc
diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
index fbc3208..eaa66a1 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
+ - sun6i: printk with 8250 on Allwinner A31 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..51e823d 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -64,6 +64,11 @@ EARLY_PRINTK_INC := pl011
EARLY_PRINTK_BAUD := 115200
EARLY_UART_BASE_ADDRESS := 0xfff36000
endif
+ifeq ($(CONFIG_EARLY_PRINTK), sun6i)
+# uart configured at 115200 by bootloader
+EARLY_PRINTK_INC := 8250
+EARLY_UART_BASE_ADDRESS := 0x01c28000
+endif
ifneq ($(EARLY_PRINTK_INC),)
EARLY_PRINTK := y
diff --git a/xen/arch/arm/arm32/debug-8250.inc b/xen/arch/arm/arm32/debug-8250.inc
new file mode 100644
index 0000000..c11357d
--- /dev/null
+++ b/xen/arch/arm/arm32/debug-8250.inc
@@ -0,0 +1,48 @@
+/*
+ * xen/arch/arm/arm32/debug-8250.inc
+ *
+ * 8250 specific debug code
+ *
+ * Bamvor Jian Zhang <bjzhang@suse.com>
+ * Copyright (c) 2013 SUSE
+ *
+ * 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.
+ */
+
+
+#define UART_TX (0x00<<2) /* Out: Transmit buffer */
+#define UART_LSR (0x05<<2) /* In: Line Status Register */
+
+#define UART_LSR_THRE 0x20 /* Xmit holding register empty */
+
+/* 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] /* <- UART_LSR (Line Status Register) */
+ tst \rc, #UART_LSR_THRE /* Check BUSY bit */
+ 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_TX] /* -> UART_TX */
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
--
1.8.1.4
next prev parent reply other threads:[~2013-07-02 13:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 13:11 [PATCH V2 0/2] xen: arm: assemble support for Allwinner A31 Bamvor Jian Zhang
2013-07-02 13:11 ` [PATCH V2 1/2] xen: arm: introduce Cortex-A7 support Bamvor Jian Zhang
2013-07-03 11:05 ` Ian Campbell
2013-07-03 12:43 ` Bamvor Jian Zhang
2013-07-03 13:09 ` Ian Campbell
2013-07-03 13:09 ` Tim Deegan
2013-07-03 13:20 ` Ian Campbell
2013-07-02 13:11 ` Bamvor Jian Zhang [this message]
2013-07-03 11:09 ` [PATCH V2 2/2] xen: arm: implement early prink for 8250 uart Ian Campbell
2013-07-03 11:25 ` Chen Baozi
2013-07-03 11:38 ` Chen Baozi
2013-07-03 11:50 ` Chen Baozi
2013-07-03 11:54 ` Ian Campbell
2013-07-03 13:39 ` Bamvor Jian Zhang
2013-07-03 13:42 ` Chen Baozi
2013-07-03 13:38 ` Bamvor Jian Zhang
2013-07-03 13:44 ` Ian Campbell
2013-07-03 13:48 ` Chen Baozi
2013-07-03 13:50 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372770714-1657-3-git-send-email-bjzhang@suse.com \
--to=bjzhang@suse.com \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=andre.przywara@calxeda.com \
--cc=baozich@gmail.com \
--cc=ian.campbell@citrix.com \
--cc=julien.grall@linaro.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).