From: Andre Przywara Subject: [PATCH v2 2/5] arm/early-printk: allow skipping of UART init Date: Fri, 24 May 2013 15:47:27 +0200 Message-ID: <1369403250-9132-3-git-send-email-andre.przywara@calxeda.com> References: <1369403250-9132-1-git-send-email-andre.przywara@calxeda.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1369403250-9132-1-git-send-email-andre.przywara@calxeda.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: stefano.stabellini@eu.citrix.com, Ian.Campbell@citrix.com Cc: Andre Przywara , julien.grall@linaro.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org While it seems obvious to initialize the UART before using it, chances are that some firmware code or the bootloader already did this. So it may actually be a good idea to skip the initialization, in fact this fixes early printk on my TC2 Versatile Express. So provide an option in xen/arch/arm/Rules.mk to only initialize the UART when needed. Signed-off-by: Andre Przywara --- docs/misc/arm/early-printk.txt | 4 ++++ xen/arch/arm/Rules.mk | 2 ++ xen/arch/arm/arm32/head.S | 2 ++ xen/arch/arm/arm64/head.S | 2 ++ 4 files changed, 10 insertions(+) diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt index 10c3053..965add5 100644 --- a/docs/misc/arm/early-printk.txt +++ b/docs/misc/arm/early-printk.txt @@ -14,5 +14,9 @@ where mach is the name of the machine: The baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines. +If not explicitly requested with "EARLY_PRINTK_INIT_UART := y" in Rules.mk, +the code will not try to initialize the UART, so that bootloader or +firmware settings can be used for maximum compatibility. The baud rate +parameter is ignored in this case. By default early printk is disabled. diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index b4d6907..fdcf73e 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -49,6 +49,7 @@ EARLY_PRINTK_BAUD := 38400 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 +EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 endif @@ -57,6 +58,7 @@ EARLY_PRINTK := y endif CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK +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) endif diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index ec7f640..0588d54 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -369,7 +369,9 @@ fail: PRINT("- Boot failed -\r\n") * r11: Early UART base address * Clobbers r0-r2 */ init_uart: +#ifdef EARLY_PRINTK_INIT_UART early_uart_init r11, r1, r2 +#endif adr r0, 1f b puts /* Jump to puts */ 1: .asciz "- UART enabled -\r\n" diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 8955946..21b7e4d 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -116,7 +116,9 @@ boot_cpu: #ifdef EARLY_PRINTK ldr x23, =EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ cbnz x22, 1f +#ifdef EARLY_PRINTK_INIT_UART bl init_uart /* CPU 0 sets up the UART too */ +#endif 1: PRINT("- CPU ") mov x0, x22 bl putn -- 1.7.12.1