From patchwork Mon Mar 19 20:27:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 147619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id E4AFAB6FC9 for ; Tue, 20 Mar 2012 07:27:56 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 159CC280AA; Mon, 19 Mar 2012 21:27:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ykwpWPeUmFgI; Mon, 19 Mar 2012 21:27:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2A9AB28095; Mon, 19 Mar 2012 21:27:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 84CCB28087 for ; Mon, 19 Mar 2012 21:27:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lTAgS5lN-yd7 for ; Mon, 19 Mar 2012 21:27:29 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-bk0-f74.google.com (mail-bk0-f74.google.com [209.85.214.74]) by theia.denx.de (Postfix) with ESMTPS id 254A328089 for ; Mon, 19 Mar 2012 21:27:27 +0100 (CET) Received: by bkcjm19 with SMTP id jm19so300596bkc.3 for ; Mon, 19 Mar 2012 13:27:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=GCuqfa+jB13/w060N3rZ3Z0dF9IpCc7mrF2s/ObC0Uo=; b=H6rQ8F/EaPQmh577oVh5/VjCt1k/SMTQb/slx8O9BSuJUp5QCfokS/COy1PEhs1P4J OIlsIK215Y3YphETV2nQAs/0HIDnl44Jzz9Da4LB+j2VNLYL1PKNHVwVt42h9V9Ae/gk TFlnrm/rnG+Moo0x3Pjwah7xJtATUQGzgni81ktv9V76Rd2H6E3CimqTIcAAdslVBBks zlbwepvv9lVVvb2WBeLhhovQvZIRJzMpDdIekZJxlhM9eSM4AiaNJPJxXFk6BoIkx3Rf GYnLBHxyoQEifhF6u4kIjX5APXigYd60EbUJ738MT5rNRduWk2uFVAoVjx0E/kg0lkkX 19cw== Received: by 10.213.105.210 with SMTP id u18mr969698ebo.19.1332188846140; Mon, 19 Mar 2012 13:27:26 -0700 (PDT) Received: by 10.213.105.210 with SMTP id u18mr969675ebo.19.1332188845956; Mon, 19 Mar 2012 13:27:25 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id s9si10851487eei.3.2012.03.19.13.27.25 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 19 Mar 2012 13:27:25 -0700 (PDT) Received: from sglass.mtv.corp.google.com (dhcp-172-22-162-38.mtv.corp.google.com [172.22.162.38]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id B2A7E5C0050; Mon, 19 Mar 2012 13:27:25 -0700 (PDT) Received: by sglass.mtv.corp.google.com (Postfix, from userid 121222) id 077331409E7; Mon, 19 Mar 2012 13:27:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 19 Mar 2012 13:27:02 -0700 Message-Id: <1332188824-5447-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1332188824-5447-1-git-send-email-sjg@chromium.org> References: <1332188824-5447-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQmGVN0GPbukw0iYyNjFpvGcm8wynQbmPTYsm4eekE4FQLhhDRnYLtxw0aavlKPrzAP69xB7mVHk6m2R/u+L3lrR+9ErnXKboMhM4w+ecEkT0JGjRp39wj+a/yg5m9OOEIEhUZzEygstrVqY6xAXe0JASEfSSVKTs07kTycSCZXzvhBrp8M= Cc: Stephen Warren , Tom Warren Subject: [U-Boot] [PATCH 3/5] tegra: Export the UART setup function for use by boards X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Allow boards to call the tegra_setup_uarts() function so that they can set up UARTs on demand. The UART selection enum is moved into the board.h header file so that boards can use this for pre-console panic. Signed-off-by: Simon Glass --- arch/arm/cpu/armv7/tegra2/board.c | 26 +++++++------------------- arch/arm/include/asm/arch-tegra2/board.h | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra2/board.c b/arch/arm/cpu/armv7/tegra2/board.c index 77a627d..c9a7520 100644 --- a/arch/arm/cpu/armv7/tegra2/board.c +++ b/arch/arm/cpu/armv7/tegra2/board.c @@ -24,6 +24,7 @@ #include #include #include "ap20.h" +#include #include #include #include @@ -32,14 +33,6 @@ DECLARE_GLOBAL_DATA_PTR; -enum { - /* UARTs which we can enable */ - UARTA = 1 << 0, - UARTB = 1 << 1, - UARTD = 1 << 3, - UART_COUNT = 4, -}; - /* * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0, * so we are using this value to identify memory size. @@ -101,12 +94,7 @@ int arch_cpu_init(void) } #endif -/** - * Set up the specified uarts - * - * @param uarts_ids Mask containing UARTs to init (UARTx) - */ -static void setup_uarts(int uart_ids) +void tegra_setup_uarts(int uart_ids) { static enum periph_id id_for_uart[] = { PERIPH_ID_UART1, @@ -116,7 +104,7 @@ static void setup_uarts(int uart_ids) }; size_t i; - for (i = 0; i < UART_COUNT; i++) { + for (i = 0; i < TEGRA_UART_COUNT; i++) { if (uart_ids & (1 << i)) { enum periph_id id = id_for_uart[i]; @@ -131,15 +119,15 @@ void board_init_uart_f(void) int uart_ids = 0; /* bit mask of which UART ids to enable */ #ifdef CONFIG_TEGRA2_ENABLE_UARTA - uart_ids |= UARTA; + uart_ids |= TEGRA_UARTA; #endif #ifdef CONFIG_TEGRA2_ENABLE_UARTB - uart_ids |= UARTB; + uart_ids |= TEGRA_UARTB; #endif #ifdef CONFIG_TEGRA2_ENABLE_UARTD - uart_ids |= UARTD; + uart_ids |= TEGRA_UARTD; #endif - setup_uarts(uart_ids); + tegra_setup_uarts(uart_ids); } #ifndef CONFIG_SYS_DCACHE_OFF diff --git a/arch/arm/include/asm/arch-tegra2/board.h b/arch/arm/include/asm/arch-tegra2/board.h index a90d36c..fb88517 100644 --- a/arch/arm/include/asm/arch-tegra2/board.h +++ b/arch/arm/include/asm/arch-tegra2/board.h @@ -24,6 +24,23 @@ #ifndef _TEGRA_BOARD_H_ #define _TEGRA_BOARD_H_ +enum { + /* UARTs which we can enable */ + TEGRA_UARTA = 1 << 0, + TEGRA_UARTB = 1 << 1, + TEGRA_UARTD = 1 << 3, + TEGRA_UART_ALL = 0xf, + + TEGRA_UART_COUNT = 4, +}; + +/** + * Set up the specified UARTs (pinmux and clocks) + * + * @param uarts_ids Mask containing UARTs to init (see TEGRA_UARTx) + */ +void tegra_setup_uarts(int uart_ids); + /* Setup UARTs for the board according to the selected config */ void board_init_uart_f(void);