public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/9] ARM: sunxi: Add support for using R_UART as console
Date: Sat, 11 Oct 2014 17:15:03 +0100	[thread overview]
Message-ID: <1413044103.11505.48.camel@hellion.org.uk> (raw)
In-Reply-To: <1412665917-29731-9-git-send-email-wens@csie.org>

On Tue, 2014-10-07 at 15:11 +0800, Chen-Yu Tsai wrote:
> The A23 only has UART0 muxed with MMC0. Some of the boards we
> encountered expose R_UART as a set of pads.
> 
> Add support for R_UART so we can have a console while using mmc.

I suppose R_UART is the h/w doc name. UARTR would fit the code better
but I suppose sticking with the h/w names is fine.

CONFIG_CONS_INDEX is also getting a bit out of hand, eventually we
should make it a Kconfig choice option.

> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

> ---
>  arch/arm/cpu/armv7/sunxi/board.c       | 4 ++++
>  arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 6 ++++++
>  arch/arm/include/asm/arch-sunxi/cpu.h  | 1 +
>  arch/arm/include/asm/arch-sunxi/gpio.h | 3 +++
>  include/configs/sunxi-common.h         | 1 +
>  5 files changed, 15 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index 61c1ba9..aeb2c2f 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -75,6 +75,10 @@ int gpio_init(void)
>  	sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG3_UART1_TX);
>  	sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG4_UART1_RX);
>  	sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP);
> +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_SUN8I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL2_R_UART_TX);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL3_R_UART_RX);
> +	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
>  #else
>  #error Unsupported console port number. Please fix pin mux settings in board.c
>  #endif
> diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> index 8387b93..1eae976 100644
> --- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> +++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> @@ -13,6 +13,7 @@
>  #include <common.h>
>  #include <asm/io.h>
>  #include <asm/arch/clock.h>
> +#include <asm/arch/prcm.h>
>  #include <asm/arch/sys_proto.h>
>  
>  void clock_init_uart(void)
> @@ -20,6 +21,7 @@ void clock_init_uart(void)
>  	struct sunxi_ccm_reg *const ccm =
>  		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>  
> +#if CONFIG_CONS_INDEX < 5
>  	/* uart clock source is apb2 */
>  	writel(APB2_CLK_SRC_OSC24M|
>  	       APB2_CLK_RATE_N_1|
> @@ -35,6 +37,10 @@ void clock_init_uart(void)
>  	setbits_le32(&ccm->apb2_reset_cfg,
>  		     1 << (APB2_RESET_UART_SHIFT +
>  			   CONFIG_CONS_INDEX - 1));
> +#else
> +	/* enable R_PIO and R_UART clocks, and de-assert resets */
> +	prcm_apb0_enable(PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_UART);
> +#endif
>  
>  	/* Dup with clock_init_safe(), drop once sun6i SPL support lands */
>  	writel(PLL6_CFG_DEFAULT, &ccm->pll6_cfg);
> diff --git a/arch/arm/include/asm/arch-sunxi/cpu.h b/arch/arm/include/asm/arch-sunxi/cpu.h
> index 313e6c8..0de79a0 100644
> --- a/arch/arm/include/asm/arch-sunxi/cpu.h
> +++ b/arch/arm/include/asm/arch-sunxi/cpu.h
> @@ -111,6 +111,7 @@
>  #define SUNXI_AVG_BASE			0x01ea0000
>  
>  #define SUNXI_PRCM_BASE			0x01f01400
> +#define SUNXI_R_UART_BASE		0x01f02800
>  #define SUNXI_R_PIO_BASE		0x01f02c00
>  #define SUNXI_P2WI_BASE			0x01f03400
>  
> diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
> index bbe815a..c216960 100644
> --- a/arch/arm/include/asm/arch-sunxi/gpio.h
> +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
> @@ -164,6 +164,9 @@ enum sunxi_gpio_number {
>  
>  #define SUN4I_GPI4_SDC3		2
>  
> +#define SUN8I_GPL2_R_UART_TX	2
> +#define SUN8I_GPL3_R_UART_RX	2
> +
>  /* GPIO pin pull-up/down config */
>  #define SUNXI_GPIO_PULL_DISABLE	0
>  #define SUNXI_GPIO_PULL_UP	1
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 7857a56..7e54296 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -42,6 +42,7 @@
>  #define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
>  #define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
>  #define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
> +#define CONFIG_SYS_NS16550_COM5		SUNXI_R_UART_BASE
>  
>  /* DRAM Base */
>  #define CONFIG_SYS_SDRAM_BASE		0x40000000

  reply	other threads:[~2014-10-11 16:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07  7:11 [U-Boot] [PATCH 0/9] ARM: sunxi: Add Allwinner A23 (sun8i) support Chen-Yu Tsai
2014-10-07  7:11 ` [U-Boot] [PATCH 1/9] ARM: sunxi: Fix build break when CONFIG_MMC is not defined Chen-Yu Tsai
2014-10-11 15:50   ` Ian Campbell
2014-10-12  8:58     ` Hans de Goede
2014-10-07  7:11 ` [U-Boot] [PATCH 2/9] ARM: sunxi: Add sun8i (A23) UART0 pin mux support Chen-Yu Tsai
2014-10-11 15:51   ` Ian Campbell
2014-10-07  7:11 ` [U-Boot] [PATCH 3/9] ARM: sunxi: Add support for uart0 on port F (mmc0) Chen-Yu Tsai
2014-10-11 15:53   ` Ian Campbell
2014-10-07  7:11 ` [U-Boot] [PATCH 4/9] mmc: sunxi: Add support for sun8i (A23) Chen-Yu Tsai
2014-10-11 15:54   ` Ian Campbell
2014-10-07  7:11 ` [U-Boot] [PATCH 5/9] ARM: sunxi: Add basic A23 support Chen-Yu Tsai
2014-10-11 15:58   ` Ian Campbell
2014-10-12  2:43     ` Chen-Yu Tsai
2014-10-12  9:33       ` Ian Campbell
2014-10-07  7:11 ` [U-Boot] [PATCH 6/9] ARM: sunxi: Add support for R_PIO gpio banks Chen-Yu Tsai
2014-10-11 16:05   ` Ian Campbell
2014-10-12  8:23     ` Chen-Yu Tsai
2014-10-12  9:34       ` Ian Campbell
2014-10-13 12:57       ` Maxime Ripard
2014-10-17 14:48         ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2014-10-21 18:55           ` Ian Campbell
2014-10-07  7:11 ` [U-Boot] [PATCH 7/9] ARM: sunxi: Allow specifying module in prcm apb0 init function Chen-Yu Tsai
2014-10-11 16:11   ` Ian Campbell
2014-10-11 16:13     ` Ian Campbell
2014-10-12  8:15       ` Chen-Yu Tsai
2014-10-07  7:11 ` [U-Boot] [PATCH 8/9] ARM: sunxi: Add support for using R_UART as console Chen-Yu Tsai
2014-10-11 16:15   ` Ian Campbell [this message]
2014-10-07  7:11 ` [U-Boot] [PATCH 9/9] ARM: sunxi: Add Ippo-q8h-v5 A23 tablet board defconfig Chen-Yu Tsai
2014-10-11 16:17   ` Ian Campbell
2014-10-12  8:13     ` Chen-Yu Tsai

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=1413044103.11505.48.camel@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=u-boot@lists.denx.de \
    /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