xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Chen Baozi <baozich@gmail.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Xen Developer List <xen-devel@lists.xen.org>
Subject: Re: [PATCH v6 2/6] xen/arm: add 8250 compatible UART support for early_printk
Date: Mon, 12 Aug 2013 16:16:19 +0100	[thread overview]
Message-ID: <5208FC43.804@linaro.org> (raw)
In-Reply-To: <1376014823-28657-3-git-send-email-baozich@gmail.com>

On 08/09/2013 03:20 AM, Chen Baozi wrote:
> Both OMAP5 and sun6i/sun7i SoCs share this UART driver for early_printk.
> 
> Signed-off-by: Chen Baozi <baozich@gmail.com>
> ---
>  docs/misc/arm/early-printk.txt    |  3 +++
>  xen/arch/arm/Rules.mk             | 16 +++++++++++++++
>  xen/arch/arm/arm32/debug-8250.inc | 41 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 60 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..1431751 100644
> --- a/docs/misc/arm/early-printk.txt
> +++ b/docs/misc/arm/early-printk.txt
> @@ -13,6 +13,9 @@ 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
> +  - sun6i: printk with 8250 on Allwinner A31 processors
> +  - sun7i: printk with 8250 on Allwinner A20 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 a18e7fd..c5720fe 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -64,6 +64,21 @@ EARLY_PRINTK_INC := pl011
>  EARLY_PRINTK_BAUD := 115200
>  EARLY_UART_BASE_ADDRESS := 0xfff36000
>  endif
> +ifeq ($(CONFIG_EARLY_PRINTK), omap5432)
> +EARLY_PRINTK_INC := 8250
> +EARLY_UART_BASE_ADDRESS := 0x48020000
> +EARLY_UART_REG_SHIFT := 2
> +endif
> +ifeq ($(CONFIG_EARLY_PRINTK), sun6i)
> +EARLY_PRINTK_INC := 8250
> +EARLY_UART_BASE_ADDRESS := 0x01c28000
> +EARLY_UART_REG_SHIFT := 2
> +endif
> +ifeq ($(CONFIG_EARLY_PRINTK), sun7i)
> +EARLY_PRINTK_INC := 8250
> +EARLY_UART_BASE_ADDRESS := 0x01c28000
> +EARLY_UART_REG_SHIFT := 2
> +endif

If the shift is the same for all UART based on 8250, you can simply
define EARLY_UART_... in debug-8250.inc.

>  ifneq ($(EARLY_PRINTK_INC),)
>  EARLY_PRINTK := y
> @@ -74,4 +89,5 @@ 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)
> +CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
>  endif
> diff --git a/xen/arch/arm/arm32/debug-8250.inc b/xen/arch/arm/arm32/debug-8250.inc
> new file mode 100644
> index 0000000..eb25882
> --- /dev/null
> +++ b/xen/arch/arm/arm32/debug-8250.inc
> @@ -0,0 +1,41 @@
> +/*
> + * xen/arch/arm/arm32/debug-8250.inc
> + *
> + * 8250 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 <xen/8250-uart.h>
> +
> +/* 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 << EARLY_UART_REG_SHIFT)] /* Read LSR */
> +	tst	\rc, #UART_LSR_THRE     /* Check Xmit holding register flag */
> +	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_THR]      /* Write Transmit buffer */
> +.endm
> +
> +/*
> + * Local variables:
> + * mode: ASM
> + * indent-tabs-mode: nil
> + * End:
> + */
> 


-- 
Julien Grall

  reply	other threads:[~2013-08-12 15:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  2:20 [PATCH v6 0/5] Add UART support and arch timer initialization for OMAP5 Chen Baozi
2013-08-09  2:20 ` [PATCH v6 1/6] xen: rename ns16550-uart.h to 8250-uart.h and fix some typos Chen Baozi
2013-08-09  2:20 ` [PATCH v6 2/6] xen/arm: add 8250 compatible UART support for early_printk Chen Baozi
2013-08-12 15:16   ` Julien Grall [this message]
2013-08-13  1:50     ` Chen Baozi
2013-08-09  2:20 ` [PATCH v6 3/6] xen: Introduce a helper to read a u32 property in device tree Chen Baozi
2013-08-12 15:19   ` Julien Grall
2013-08-12 22:19     ` Julien Grall
2013-08-13  1:32       ` Chen Baozi
2013-08-09  2:20 ` [PATCH v6 4/6] xen/arm: Add the new OMAP UART driver Chen Baozi
2013-08-12 22:21   ` Julien Grall
2013-08-13  2:35     ` Chen Baozi
2013-08-13  9:39       ` Julien Grall
2013-08-13  3:37     ` Chen Baozi
2013-08-13  7:07       ` Chen Baozi
2013-08-09  2:20 ` [PATCH v6 5/6] xen/arm: Add support for device tree specified arch_timer clock frequency Chen Baozi
2013-08-09  2:20 ` [PATCH v6 6/6] xen/arm: Platform recognition and initialize arch_timer for the OMAP5 Chen Baozi

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=5208FC43.804@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=baozich@gmail.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).