* [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support
@ 2013-05-24 10:42 Andre Przywara
2013-05-24 10:42 ` [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value Andre Przywara
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Andre Przywara @ 2013-05-24 10:42 UTC (permalink / raw)
To: stefano.stabellini, Ian.Campbell; +Cc: Andre Przywara, xen-devel
The current early-printk support for ARM is rather hard-coded, making
it hard to add machines or tweak settings.
This series slightly moves some code to gather UART settings in
xen/arch/arm/Rules.mk instead of the actual .c files. Also it allows
two different machines with different settings to share the same
driver, which the last patch exploits to add support the Calxeda
Midway hardware.
This haven't been extensively tested, but I looked at the generated
assembly and did some quick checks on Versatile Express.
Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
Andre Przywara (4):
arm/early-printk: calculate baud rate divisor from user provided
value
arm/early-printk: allow skipping of UART init
arm/early-printk: move UART base address to Rules.mk
arm/early-printk: add Calxeda Midway UART support
xen/arch/arm/Rules.mk | 13 +++++++++++++
xen/arch/arm/arm32/debug-exynos4210.inc | 6 ++----
xen/arch/arm/arm32/debug-pl011.inc | 6 ++----
xen/arch/arm/arm32/head.S | 2 ++
xen/arch/arm/arm64/debug-pl011.inc | 6 ++----
xen/arch/arm/arm64/head.S | 2 ++
6 files changed, 23 insertions(+), 12 deletions(-)
--
1.7.12.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value
2013-05-24 10:42 [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Andre Przywara
@ 2013-05-24 10:42 ` Andre Przywara
2013-05-24 12:15 ` Julien Grall
2013-05-24 10:42 ` [PATCH 2/4] arm/early-printk: allow skipping of UART init Andre Przywara
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Andre Przywara @ 2013-05-24 10:42 UTC (permalink / raw)
To: stefano.stabellini, Ian.Campbell; +Cc: Andre Przywara, xen-devel
For early-printk the used baud rate was hardcoded in the code, using
precalculated divisor values.
Let the calculation of these values be done by the preprocessor and
use a human readable value in xen/arch/arm/Rules.mk to drive this.
Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
---
xen/arch/arm/Rules.mk | 3 +++
xen/arch/arm/arm32/debug-exynos4210.inc | 4 ++--
xen/arch/arm/arm32/debug-pl011.inc | 4 ++--
xen/arch/arm/arm64/debug-pl011.inc | 4 ++--
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index b6a6890..b4d6907 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -45,9 +45,11 @@ ifeq ($(debug),y)
# TODO handle UART base address from make command line
ifeq ($(CONFIG_EARLY_PRINTK), vexpress)
EARLY_PRINTK_INC := pl011
+EARLY_PRINTK_BAUD := 38400
endif
ifeq ($(CONFIG_EARLY_PRINTK), exynos5250)
EARLY_PRINTK_INC := exynos4210
+EARLY_PRINTK_BAUD := 115200
endif
ifneq ($(EARLY_PRINTK_INC),)
@@ -56,4 +58,5 @@ endif
CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK
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/debug-exynos4210.inc b/xen/arch/arm/arm32/debug-exynos4210.inc
index 4241640..4922148 100644
--- a/xen/arch/arm/arm32/debug-exynos4210.inc
+++ b/xen/arch/arm/arm32/debug-exynos4210.inc
@@ -38,9 +38,9 @@
orr \rd, \rd, #(0x7<<8)
str \rd, [\rc, #0x558]
- mov \rc, #4
+ mov \rc, #(100000000 / EARLY_PRINTK_BAUD % 16)
str \rc, [\rb, #UFRACVAL] /* -> UFRACVAL (Baud divisor fraction) */
- mov \rc, #53
+ mov \rc, #(100000000 / EARLY_PRINTK_BAUD / 16 - 1)
str \rc, [\rb, #UBRDIV] /* -> UBRDIV (Baud divisor integer) */
mov \rc, #3 /* 8n1 */
str \rc, [\rb, #ULCON] /* -> (Line control) */
diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-pl011.inc
index 6954aeb..2d970ea 100644
--- a/xen/arch/arm/arm32/debug-pl011.inc
+++ b/xen/arch/arm/arm32/debug-pl011.inc
@@ -23,9 +23,9 @@
* rc: scratch register 1
* rd: scratch register 2 (unused here) */
.macro early_uart_init rb, rc, rd
- mov \rc, #0x0
+ mov \rc, #(7372800 / EARLY_PRINTK_BAUD % 16)
str \rc, [\rb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */
- mov \rc, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */
+ mov \rc, #(7372800 / EARLY_PRINTK_BAUD / 16)
str \rc, [\rb, #0x24] /* -> UARTIBRD (Baud divisor integer) */
mov \rc, #0x60 /* 8n1 */
str \rc, [\rb, #0x2C] /* -> UARTLCR_H (Line control) */
diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
index ee6e0e0..7220940 100644
--- a/xen/arch/arm/arm64/debug-pl011.inc
+++ b/xen/arch/arm/arm64/debug-pl011.inc
@@ -24,9 +24,9 @@
* xb: register which containts the UART base address
* c: scratch register number */
.macro early_uart_init xb, c
- mov x\c, #0x0
+ mov x\c, #(7372800 / EARLY_PRINTK_BAUD % 16)
strh w\c, [\xb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */
- mov x\c, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */
+ mov x\c, #(7372800 / EARLY_PRINTK_BAUD / 16)
strh w\c, [\xb, #0x24] /* -> UARTIBRD (Baud divisor integer) */
mov x\c, #0x60 /* 8n1 */
str w\c, [\xb, #0x2C] /* -> UARTLCR_H (Line control) */
--
1.7.12.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] arm/early-printk: allow skipping of UART init
2013-05-24 10:42 [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Andre Przywara
2013-05-24 10:42 ` [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value Andre Przywara
@ 2013-05-24 10:42 ` Andre Przywara
2013-05-24 12:30 ` Julien Grall
2013-05-24 10:42 ` [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk Andre Przywara
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Andre Przywara @ 2013-05-24 10:42 UTC (permalink / raw)
To: stefano.stabellini, Ian.Campbell; +Cc: Andre Przywara, xen-devel
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 <andre.przywara@calxeda.com>
---
xen/arch/arm/Rules.mk | 2 ++
xen/arch/arm/arm32/head.S | 2 ++
xen/arch/arm/arm64/head.S | 2 ++
3 files changed, 6 insertions(+)
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk
2013-05-24 10:42 [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Andre Przywara
2013-05-24 10:42 ` [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value Andre Przywara
2013-05-24 10:42 ` [PATCH 2/4] arm/early-printk: allow skipping of UART init Andre Przywara
@ 2013-05-24 10:42 ` Andre Przywara
2013-05-24 12:36 ` Julien Grall
2013-05-24 10:42 ` [PATCH 4/4] arm/early-printk: add Calxeda Midway UART support Andre Przywara
2013-05-24 12:40 ` [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Julien Grall
4 siblings, 1 reply; 11+ messages in thread
From: Andre Przywara @ 2013-05-24 10:42 UTC (permalink / raw)
To: stefano.stabellini, Ian.Campbell; +Cc: Andre Przywara, xen-devel
The UART memory mapped base address is currently hardcoded in the
early-printk UART driver, which denies the driver to be used by
two machines with a different mapping.
Move this definition out to xen/arch/arm/Rules.mk, allowing easier
user access and later sharing of the driver.
Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
---
xen/arch/arm/Rules.mk | 3 +++
xen/arch/arm/arm32/debug-exynos4210.inc | 2 --
xen/arch/arm/arm32/debug-pl011.inc | 2 --
xen/arch/arm/arm64/debug-pl011.inc | 2 --
4 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index fdcf73e..37a8271 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -46,11 +46,13 @@ ifeq ($(debug),y)
ifeq ($(CONFIG_EARLY_PRINTK), vexpress)
EARLY_PRINTK_INC := pl011
EARLY_PRINTK_BAUD := 38400
+EARLY_UART_BASE_ADDRESS := 0x1c090000
endif
ifeq ($(CONFIG_EARLY_PRINTK), exynos5250)
EARLY_PRINTK_INC := exynos4210
EARLY_PRINTK_INIT_UART := y
EARLY_PRINTK_BAUD := 115200
+EARLY_UART_BASE_ADDRESS := 0x12c20000
endif
ifneq ($(EARLY_PRINTK_INC),)
@@ -61,4 +63,5 @@ 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)
+CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
endif
diff --git a/xen/arch/arm/arm32/debug-exynos4210.inc b/xen/arch/arm/arm32/debug-exynos4210.inc
index 4922148..d746c35 100644
--- a/xen/arch/arm/arm32/debug-exynos4210.inc
+++ b/xen/arch/arm/arm32/debug-exynos4210.inc
@@ -18,8 +18,6 @@
#include <asm/exynos4210-uart.h>
-#define EARLY_UART_BASE_ADDRESS 0x12c20000
-
/* Exynos 5 UART initialization
* rb: register which contains the UART base address
* rc: scratch register 1
diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-pl011.inc
index 2d970ea..8b085b8 100644
--- a/xen/arch/arm/arm32/debug-pl011.inc
+++ b/xen/arch/arm/arm32/debug-pl011.inc
@@ -16,8 +16,6 @@
* GNU General Public License for more details.
*/
-#define EARLY_UART_BASE_ADDRESS 0x1c090000
-
/* PL011 UART initialization
* rb: register which contains the UART base address
* rc: scratch register 1
diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
index 7220940..b416235 100644
--- a/xen/arch/arm/arm64/debug-pl011.inc
+++ b/xen/arch/arm/arm64/debug-pl011.inc
@@ -18,8 +18,6 @@
#include <asm/asm_defns.h>
-#define EARLY_UART_BASE_ADDRESS 0x1c090000
-
/* PL011 UART initialization
* xb: register which containts the UART base address
* c: scratch register number */
--
1.7.12.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] arm/early-printk: add Calxeda Midway UART support
2013-05-24 10:42 [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Andre Przywara
` (2 preceding siblings ...)
2013-05-24 10:42 ` [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk Andre Przywara
@ 2013-05-24 10:42 ` Andre Przywara
2013-05-24 12:38 ` Julien Grall
2013-05-24 12:40 ` [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Julien Grall
4 siblings, 1 reply; 11+ messages in thread
From: Andre Przywara @ 2013-05-24 10:42 UTC (permalink / raw)
To: stefano.stabellini, Ian.Campbell; +Cc: Andre Przywara, xen-devel
With the help of the last three patches add a stanza to
xen/arch/arm/Rules.mk to specify the UART configuration of the
Calxeda Midway machine.
The information has been taken from the Linux kernel's .dts file.
This can be enabled by adding "CONFIG_EARLY_PRINTK=midway" to
Config.mk.
Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
---
xen/arch/arm/Rules.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index 37a8271..cfc9e4d 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -54,6 +54,11 @@ EARLY_PRINTK_INIT_UART := y
EARLY_PRINTK_BAUD := 115200
EARLY_UART_BASE_ADDRESS := 0x12c20000
endif
+ifeq ($(CONFIG_EARLY_PRINTK), midway)
+EARLY_PRINTK_INC := pl011
+EARLY_PRINTK_BAUD := 115200
+EARLY_UART_BASE_ADDRESS := 0xfff36000
+endif
ifneq ($(EARLY_PRINTK_INC),)
EARLY_PRINTK := y
--
1.7.12.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value
2013-05-24 10:42 ` [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value Andre Przywara
@ 2013-05-24 12:15 ` Julien Grall
0 siblings, 0 replies; 11+ messages in thread
From: Julien Grall @ 2013-05-24 12:15 UTC (permalink / raw)
To: Andre Przywara; +Cc: xen-devel, Ian.Campbell, stefano.stabellini
On 05/24/2013 11:42 AM, Andre Przywara wrote:
> For early-printk the used baud rate was hardcoded in the code, using
> precalculated divisor values.
> Let the calculation of these values be done by the preprocessor and
> use a human readable value in xen/arch/arm/Rules.mk to drive this.
>
> Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
> ---
> xen/arch/arm/Rules.mk | 3 +++
> xen/arch/arm/arm32/debug-exynos4210.inc | 4 ++--
> xen/arch/arm/arm32/debug-pl011.inc | 4 ++--
> xen/arch/arm/arm64/debug-pl011.inc | 4 ++--
> 4 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
> index b6a6890..b4d6907 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -45,9 +45,11 @@ ifeq ($(debug),y)
> # TODO handle UART base address from make command line
> ifeq ($(CONFIG_EARLY_PRINTK), vexpress)
> EARLY_PRINTK_INC := pl011
> +EARLY_PRINTK_BAUD := 38400
> endif
> ifeq ($(CONFIG_EARLY_PRINTK), exynos5250)
> EARLY_PRINTK_INC := exynos4210
> +EARLY_PRINTK_BAUD := 115200
> endif
>
> ifneq ($(EARLY_PRINTK_INC),)
> @@ -56,4 +58,5 @@ endif
>
> CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK
> 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/debug-exynos4210.inc b/xen/arch/arm/arm32/debug-exynos4210.inc
> index 4241640..4922148 100644
> --- a/xen/arch/arm/arm32/debug-exynos4210.inc
> +++ b/xen/arch/arm/arm32/debug-exynos4210.inc
> @@ -38,9 +38,9 @@
> orr \rd, \rd, #(0x7<<8)
> str \rd, [\rc, #0x558]
>
> - mov \rc, #4
> + mov \rc, #(100000000 / EARLY_PRINTK_BAUD % 16)
> str \rc, [\rb, #UFRACVAL] /* -> UFRACVAL (Baud divisor fraction) */
> - mov \rc, #53
> + mov \rc, #(100000000 / EARLY_PRINTK_BAUD / 16 - 1)
> str \rc, [\rb, #UBRDIV] /* -> UBRDIV (Baud divisor integer) */
> mov \rc, #3 /* 8n1 */
> str \rc, [\rb, #ULCON] /* -> (Line control) */
> diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-pl011.inc
> index 6954aeb..2d970ea 100644
> --- a/xen/arch/arm/arm32/debug-pl011.inc
> +++ b/xen/arch/arm/arm32/debug-pl011.inc
> @@ -23,9 +23,9 @@
> * rc: scratch register 1
> * rd: scratch register 2 (unused here) */
> .macro early_uart_init rb, rc, rd
> - mov \rc, #0x0
> + mov \rc, #(7372800 / EARLY_PRINTK_BAUD % 16)
> str \rc, [\rb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */
> - mov \rc, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */
> + mov \rc, #(7372800 / EARLY_PRINTK_BAUD / 16)
> str \rc, [\rb, #0x24] /* -> UARTIBRD (Baud divisor integer) */
> mov \rc, #0x60 /* 8n1 */
> str \rc, [\rb, #0x2C] /* -> UARTLCR_H (Line control) */
> diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
> index ee6e0e0..7220940 100644
> --- a/xen/arch/arm/arm64/debug-pl011.inc
> +++ b/xen/arch/arm/arm64/debug-pl011.inc
> @@ -24,9 +24,9 @@
> * xb: register which containts the UART base address
> * c: scratch register number */
> .macro early_uart_init xb, c
> - mov x\c, #0x0
> + mov x\c, #(7372800 / EARLY_PRINTK_BAUD % 16)
> strh w\c, [\xb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */
> - mov x\c, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */
> + mov x\c, #(7372800 / EARLY_PRINTK_BAUD / 16)
> strh w\c, [\xb, #0x24] /* -> UARTIBRD (Baud divisor integer) */
> mov x\c, #0x60 /* 8n1 */
> str w\c, [\xb, #0x2C] /* -> UARTLCR_H (Line control) */
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] arm/early-printk: allow skipping of UART init
2013-05-24 10:42 ` [PATCH 2/4] arm/early-printk: allow skipping of UART init Andre Przywara
@ 2013-05-24 12:30 ` Julien Grall
0 siblings, 0 replies; 11+ messages in thread
From: Julien Grall @ 2013-05-24 12:30 UTC (permalink / raw)
To: Andre Przywara; +Cc: xen-devel, Ian.Campbell, stefano.stabellini
On 05/24/2013 11:42 AM, Andre Przywara wrote:
> 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.
I'm using the fast model: Fast Models [8.0.60 (Mar 7 2013)] and the
UART initialization is needed.
Could you do one of the following option:
1) add fastmodel early printk (with EARLY_PRINTK_INIT_UART=y)
2) document the behavior in docs/misc/arm/early-printk.txt
> Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
> ---
> xen/arch/arm/Rules.mk | 2 ++
> xen/arch/arm/arm32/head.S | 2 ++
> xen/arch/arm/arm64/head.S | 2 ++
> 3 files changed, 6 insertions(+)
>
> 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
--
Julien
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk
2013-05-24 10:42 ` [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk Andre Przywara
@ 2013-05-24 12:36 ` Julien Grall
2013-05-24 12:51 ` Julien Grall
0 siblings, 1 reply; 11+ messages in thread
From: Julien Grall @ 2013-05-24 12:36 UTC (permalink / raw)
To: Andre Przywara; +Cc: xen-devel, Ian.Campbell, stefano.stabellini
On 05/24/2013 11:42 AM, Andre Przywara wrote:
> The UART memory mapped base address is currently hardcoded in the
> early-printk UART driver, which denies the driver to be used by
> two machines with a different mapping.
> Move this definition out to xen/arch/arm/Rules.mk, allowing easier
> user access and later sharing of the driver.
>
> Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
> ---
> xen/arch/arm/Rules.mk | 3 +++
> xen/arch/arm/arm32/debug-exynos4210.inc | 2 --
> xen/arch/arm/arm32/debug-pl011.inc | 2 --
> xen/arch/arm/arm64/debug-pl011.inc | 2 --
> 4 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
> index fdcf73e..37a8271 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -46,11 +46,13 @@ ifeq ($(debug),y)
> ifeq ($(CONFIG_EARLY_PRINTK), vexpress)
> EARLY_PRINTK_INC := pl011
> EARLY_PRINTK_BAUD := 38400
> +EARLY_UART_BASE_ADDRESS := 0x1c090000
> endif
> ifeq ($(CONFIG_EARLY_PRINTK), exynos5250)
> EARLY_PRINTK_INC := exynos4210
> EARLY_PRINTK_INIT_UART := y
> EARLY_PRINTK_BAUD := 115200
> +EARLY_UART_BASE_ADDRESS := 0x12c20000
> endif
>
> ifneq ($(EARLY_PRINTK_INC),)
> @@ -61,4 +63,5 @@ 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)
> +CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
> endif
> diff --git a/xen/arch/arm/arm32/debug-exynos4210.inc b/xen/arch/arm/arm32/debug-exynos4210.inc
> index 4922148..d746c35 100644
> --- a/xen/arch/arm/arm32/debug-exynos4210.inc
> +++ b/xen/arch/arm/arm32/debug-exynos4210.inc
> @@ -18,8 +18,6 @@
>
> #include <asm/exynos4210-uart.h>
>
> -#define EARLY_UART_BASE_ADDRESS 0x12c20000
> -
> /* Exynos 5 UART initialization
> * rb: register which contains the UART base address
> * rc: scratch register 1
> diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-pl011.inc
> index 2d970ea..8b085b8 100644
> --- a/xen/arch/arm/arm32/debug-pl011.inc
> +++ b/xen/arch/arm/arm32/debug-pl011.inc
> @@ -16,8 +16,6 @@
> * GNU General Public License for more details.
> */
>
> -#define EARLY_UART_BASE_ADDRESS 0x1c090000
> -
> /* PL011 UART initialization
> * rb: register which contains the UART base address
> * rc: scratch register 1
> diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
> index 7220940..b416235 100644
> --- a/xen/arch/arm/arm64/debug-pl011.inc
> +++ b/xen/arch/arm/arm64/debug-pl011.inc
> @@ -18,8 +18,6 @@
>
> #include <asm/asm_defns.h>
>
> -#define EARLY_UART_BASE_ADDRESS 0x1c090000
> -
> /* PL011 UART initialization
> * xb: register which containts the UART base address
> * c: scratch register number */
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] arm/early-printk: add Calxeda Midway UART support
2013-05-24 10:42 ` [PATCH 4/4] arm/early-printk: add Calxeda Midway UART support Andre Przywara
@ 2013-05-24 12:38 ` Julien Grall
0 siblings, 0 replies; 11+ messages in thread
From: Julien Grall @ 2013-05-24 12:38 UTC (permalink / raw)
To: Andre Przywara; +Cc: xen-devel, Ian.Campbell, stefano.stabellini
On 05/24/2013 11:42 AM, Andre Przywara wrote:
> With the help of the last three patches add a stanza to
> xen/arch/arm/Rules.mk to specify the UART configuration of the
> Calxeda Midway machine.
> The information has been taken from the Linux kernel's .dts file.
> This can be enabled by adding "CONFIG_EARLY_PRINTK=midway" to
> Config.mk.
Could add a line in docs/misc/arm/early-printk.txt to document this new
early printk?
Thanks,
Julien
> Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
> ---
> xen/arch/arm/Rules.mk | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
> index 37a8271..cfc9e4d 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -54,6 +54,11 @@ EARLY_PRINTK_INIT_UART := y
> EARLY_PRINTK_BAUD := 115200
> EARLY_UART_BASE_ADDRESS := 0x12c20000
> endif
> +ifeq ($(CONFIG_EARLY_PRINTK), midway)
> +EARLY_PRINTK_INC := pl011
> +EARLY_PRINTK_BAUD := 115200
> +EARLY_UART_BASE_ADDRESS := 0xfff36000
> +endif
>
> ifneq ($(EARLY_PRINTK_INC),)
> EARLY_PRINTK := y
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support
2013-05-24 10:42 [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Andre Przywara
` (3 preceding siblings ...)
2013-05-24 10:42 ` [PATCH 4/4] arm/early-printk: add Calxeda Midway UART support Andre Przywara
@ 2013-05-24 12:40 ` Julien Grall
4 siblings, 0 replies; 11+ messages in thread
From: Julien Grall @ 2013-05-24 12:40 UTC (permalink / raw)
To: Andre Przywara; +Cc: xen-devel, Ian.Campbell, stefano.stabellini
On 05/24/2013 11:42 AM, Andre Przywara wrote:
> The current early-printk support for ARM is rather hard-coded, making
> it hard to add machines or tweak settings.
> This series slightly moves some code to gather UART settings in
> xen/arch/arm/Rules.mk instead of the actual .c files. Also it allows
> two different machines with different settings to share the same
> driver, which the last patch exploits to add support the Calxeda
> Midway hardware.
>
> This haven't been extensively tested, but I looked at the generated
> assembly and did some quick checks on Versatile Express.
Thanks for this patch series, the UART code is now more generic :).
I tried all these patches on the fast model and the arndale board. I
didn't see any specific issue.
Cheers,
Julien
>
> Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
>
> Andre Przywara (4):
> arm/early-printk: calculate baud rate divisor from user provided
> value
> arm/early-printk: allow skipping of UART init
> arm/early-printk: move UART base address to Rules.mk
> arm/early-printk: add Calxeda Midway UART support
>
> xen/arch/arm/Rules.mk | 13 +++++++++++++
> xen/arch/arm/arm32/debug-exynos4210.inc | 6 ++----
> xen/arch/arm/arm32/debug-pl011.inc | 6 ++----
> xen/arch/arm/arm32/head.S | 2 ++
> xen/arch/arm/arm64/debug-pl011.inc | 6 ++----
> xen/arch/arm/arm64/head.S | 2 ++
> 6 files changed, 23 insertions(+), 12 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk
2013-05-24 12:36 ` Julien Grall
@ 2013-05-24 12:51 ` Julien Grall
0 siblings, 0 replies; 11+ messages in thread
From: Julien Grall @ 2013-05-24 12:51 UTC (permalink / raw)
To: Andre Przywara; +Cc: stefano.stabellini, Ian.Campbell, xen-devel
On 05/24/2013 01:36 PM, Julien Grall wrote:
> On 05/24/2013 11:42 AM, Andre Przywara wrote:
>
>> The UART memory mapped base address is currently hardcoded in the
>> early-printk UART driver, which denies the driver to be used by
>> two machines with a different mapping.
>> Move this definition out to xen/arch/arm/Rules.mk, allowing easier
>> user access and later sharing of the driver.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@calxeda.com>
>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>
By the way, could you remove the "# TODO handle UART..." in
arch/arm/Rules.mk as you have implemented it?
Thanks,
Julien
>> ---
>> xen/arch/arm/Rules.mk | 3 +++
>> xen/arch/arm/arm32/debug-exynos4210.inc | 2 --
>> xen/arch/arm/arm32/debug-pl011.inc | 2 --
>> xen/arch/arm/arm64/debug-pl011.inc | 2 --
>> 4 files changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
>> index fdcf73e..37a8271 100644
>> --- a/xen/arch/arm/Rules.mk
>> +++ b/xen/arch/arm/Rules.mk
>> @@ -46,11 +46,13 @@ ifeq ($(debug),y)
>> ifeq ($(CONFIG_EARLY_PRINTK), vexpress)
>> EARLY_PRINTK_INC := pl011
>> EARLY_PRINTK_BAUD := 38400
>> +EARLY_UART_BASE_ADDRESS := 0x1c090000
>> endif
>> ifeq ($(CONFIG_EARLY_PRINTK), exynos5250)
>> EARLY_PRINTK_INC := exynos4210
>> EARLY_PRINTK_INIT_UART := y
>> EARLY_PRINTK_BAUD := 115200
>> +EARLY_UART_BASE_ADDRESS := 0x12c20000
>> endif
>>
>> ifneq ($(EARLY_PRINTK_INC),)
>> @@ -61,4 +63,5 @@ 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)
>> +CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
>> endif
>> diff --git a/xen/arch/arm/arm32/debug-exynos4210.inc b/xen/arch/arm/arm32/debug-exynos4210.inc
>> index 4922148..d746c35 100644
>> --- a/xen/arch/arm/arm32/debug-exynos4210.inc
>> +++ b/xen/arch/arm/arm32/debug-exynos4210.inc
>> @@ -18,8 +18,6 @@
>>
>> #include <asm/exynos4210-uart.h>
>>
>> -#define EARLY_UART_BASE_ADDRESS 0x12c20000
>> -
>> /* Exynos 5 UART initialization
>> * rb: register which contains the UART base address
>> * rc: scratch register 1
>> diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-pl011.inc
>> index 2d970ea..8b085b8 100644
>> --- a/xen/arch/arm/arm32/debug-pl011.inc
>> +++ b/xen/arch/arm/arm32/debug-pl011.inc
>> @@ -16,8 +16,6 @@
>> * GNU General Public License for more details.
>> */
>>
>> -#define EARLY_UART_BASE_ADDRESS 0x1c090000
>> -
>> /* PL011 UART initialization
>> * rb: register which contains the UART base address
>> * rc: scratch register 1
>> diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
>> index 7220940..b416235 100644
>> --- a/xen/arch/arm/arm64/debug-pl011.inc
>> +++ b/xen/arch/arm/arm64/debug-pl011.inc
>> @@ -18,8 +18,6 @@
>>
>> #include <asm/asm_defns.h>
>>
>> -#define EARLY_UART_BASE_ADDRESS 0x1c090000
>> -
>> /* PL011 UART initialization
>> * xb: register which containts the UART base address
>> * c: scratch register number */
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-05-24 12:51 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24 10:42 [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Andre Przywara
2013-05-24 10:42 ` [PATCH 1/4] arm/early-printk: calculate baud rate divisor from user provided value Andre Przywara
2013-05-24 12:15 ` Julien Grall
2013-05-24 10:42 ` [PATCH 2/4] arm/early-printk: allow skipping of UART init Andre Przywara
2013-05-24 12:30 ` Julien Grall
2013-05-24 10:42 ` [PATCH 3/4] arm/early-printk: move UART base address to Rules.mk Andre Przywara
2013-05-24 12:36 ` Julien Grall
2013-05-24 12:51 ` Julien Grall
2013-05-24 10:42 ` [PATCH 4/4] arm/early-printk: add Calxeda Midway UART support Andre Przywara
2013-05-24 12:38 ` Julien Grall
2013-05-24 12:40 ` [PATCH 0/4] ARM/early-printk: Improve reusability and add Calxeda support Julien Grall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.