From: Julien Grall <julien.grall@linaro.org>
To: Andre Przywara <andre.przywara@calxeda.com>
Cc: xen-devel@lists.xen.org, Ian.Campbell@citrix.com,
stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v2 1/5] arm/early-printk: calculate baud rate divisor from user provided value
Date: Fri, 24 May 2013 15:01:33 +0100 [thread overview]
Message-ID: <519F72BD.5040600@linaro.org> (raw)
In-Reply-To: <1369403250-9132-2-git-send-email-andre.przywara@calxeda.com>
On 05/24/2013 02:47 PM, 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>
> ---
> docs/misc/arm/early-printk.txt | 3 +++
> 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 ++--
> 5 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
> index d5cae85..10c3053 100644
> --- a/docs/misc/arm/early-printk.txt
> +++ b/docs/misc/arm/early-printk.txt
> @@ -12,4 +12,7 @@ where mach is the name of the machine:
> - vexpress: printk with pl011 for versatile express
> - exynos5250: printk with the second UART
>
> +The baud rate is hardcoded in xen/arch/arm/Rules.mk,
> +see there when adding support for new machines.
> +
> By default early printk is disabled.
> 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) */
next prev parent reply other threads:[~2013-05-24 14:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 13:47 [PATCH v2 0/5] arm/early-printk: Improve reusability and add Calxeda support Andre Przywara
2013-05-24 13:47 ` [PATCH v2 1/5] arm/early-printk: calculate baud rate divisor from user provided value Andre Przywara
2013-05-24 14:01 ` Julien Grall [this message]
2013-05-24 13:47 ` [PATCH v2 2/5] arm/early-printk: allow skipping of UART init Andre Przywara
2013-05-24 14:02 ` Julien Grall
2013-05-24 13:47 ` [PATCH v2 3/5] arm/early-printk: move UART base address to Rules.mk Andre Przywara
2013-05-24 14:02 ` Julien Grall
2013-05-24 13:47 ` [PATCH v2 4/5] arm/early-printk: add support for ARM Fastmodel Andre Przywara
2013-05-24 14:03 ` Julien Grall
2013-05-24 13:47 ` [PATCH v2 5/5] arm/early-printk: add Calxeda Midway UART support Andre Przywara
2013-05-24 14:03 ` Julien Grall
2013-05-30 8:59 ` [PATCH v2 0/5] arm/early-printk: Improve reusability and add Calxeda support Ian Campbell
2013-05-30 9:14 ` Andre Przywara
2013-05-30 9:22 ` 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=519F72BD.5040600@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=andre.przywara@calxeda.com \
--cc=stefano.stabellini@eu.citrix.com \
--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).