From patchwork Thu Nov 17 10:10:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 126174 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 47BC5B71ED for ; Thu, 17 Nov 2011 21:11:19 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 95E7D28903; Thu, 17 Nov 2011 11:11:14 +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 b9ReHFSyMYUk; Thu, 17 Nov 2011 11:11:14 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A6780288EA; Thu, 17 Nov 2011 11:11:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 96DFF288EA for ; Thu, 17 Nov 2011 11:11:06 +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 SRUKolMPRxMz for ; Thu, 17 Nov 2011 11:11:06 +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 moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by theia.denx.de (Postfix) with ESMTP id E0AF028902 for ; Thu, 17 Nov 2011 11:10:56 +0100 (CET) Received: from benhur.adnet.avionic-design.de (p548E12B2.dip0.t-ipconnect.de [84.142.18.178]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LqrfL-1Qwr3024It-00duuE; Thu, 17 Nov 2011 11:10:53 +0100 Received: from mailbox.adnet.avionic-design.de (add-virt-zarafa.adnet.avionic-design.de [172.20.129.9]) by benhur.adnet.avionic-design.de (Postfix) with ESMTP id AD41D2C411D; Thu, 17 Nov 2011 11:10:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mailbox.adnet.avionic-design.de (Postfix) with ESMTP id 1B4B72A281B4; Thu, 17 Nov 2011 11:10:53 +0100 (CET) X-Virus-Scanned: amavisd-new at avionic-design.de Received: from mailbox.adnet.avionic-design.de ([127.0.0.1]) by localhost (mailbox.avionic-design.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8cib3Fe-HoJm; Thu, 17 Nov 2011 11:10:40 +0100 (CET) Received: from localhost (avionic-0098.adnet.avionic-design.de [172.20.31.233]) (Authenticated sender: thierry.reding) by mailbox.adnet.avionic-design.de (Postfix) with ESMTPA id 1E13A2A281CD; Thu, 17 Nov 2011 11:10:28 +0100 (CET) From: Thierry Reding To: Tom Warren , Simon Glass Date: Thu, 17 Nov 2011 11:10:24 +0100 Message-Id: <1321524626-6000-3-git-send-email-thierry.reding@avionic-design.de> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1321524626-6000-1-git-send-email-thierry.reding@avionic-design.de> References: <1321524626-6000-1-git-send-email-thierry.reding@avionic-design.de> X-Provags-ID: V02:K0:7QjhY7Ca+5PexSWHn8dqeAunHMCOtIQ4qX8KxOMggny d7O5zaPbIENtDy6CnKy+ktj89OrDwNWabk3JHsrUZ6MAoI8YFF 075HOHDMMSRoz4YD7KCgvb626bfvONfYujYPaJ9bXHy+CkUFCe zuY8NoPCrcMfNFNNksBIIzenQjR2HFDNyjE3GuQ/zZYPPYeera W3EEu4eexJpjuhyFK+WFFpEBzV+lxu8rtJCan2jBcnWc0Pp2I3 xwaXyJPrOLURGMioYKoqSO8fEAPQ4HDoATTxmPT0ChpA0gHzex sQZbaXLQlBDeXhGPBl43gJjO47KDjyWfZJw8CT+X3dV/DVyD83 EZoYlh31jNET9nhMnJ9ohA361wLjiwqzWI0D+Xv9vb5fv/Cf0E nXLO8OftRwvWwNvExWmJD1EIFiEHkJsHj1rGA8wfJXhiw7IbnL uZMWS Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 2/4] tegra2: Add common Avionic Design Tamonten support. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Tamonten is an NVIDIA Tegra2-based SO-DIMM processor module that is derived from the Harmony reference design. Changes in v3: * Remove unused gpio_config_uart(). * Remove call to tegra2_start(). * Use new tegra2_mmc_init(). Signed-off-by: Thierry Reding Acked-by: Simon Glass --- board/avionic-design/common/tamonten.c | 160 ++++++++++++++++++++++++++++++++ board/avionic-design/common/tamonten.h | 32 +++++++ 2 files changed, 192 insertions(+), 0 deletions(-) create mode 100644 board/avionic-design/common/tamonten.c create mode 100644 board/avionic-design/common/tamonten.h diff --git a/board/avionic-design/common/tamonten.c b/board/avionic-design/common/tamonten.c new file mode 100644 index 0000000..98aa0f8 --- /dev/null +++ b/board/avionic-design/common/tamonten.c @@ -0,0 +1,160 @@ +/* + * (C) Copyright 2010,2011 + * NVIDIA Corporation + * (C) Copyright 2011 + * Avionic Design GmbH + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tamonten.h" + +#ifdef CONFIG_TEGRA2_MMC +#include +#endif + +DECLARE_GLOBAL_DATA_PTR; + +const struct tegra2_sysinfo sysinfo = { + CONFIG_TEGRA2_BOARD_STRING +}; + +/* + * Routine: timer_init + * Description: init the timestamp and lastinc value + */ +int timer_init(void) +{ + return 0; +} + +static void enable_uart(enum periph_id pid) +{ + /* Assert UART reset and enable clock */ + reset_set_enable(pid, 1); + clock_enable(pid); + clock_ll_set_source(pid, 0); /* UARTx_CLK_SRC = 00, PLLP_OUT0 */ + + /* wait for 2us */ + udelay(2); + + /* De-assert reset to UART */ + reset_set_enable(pid, 0); +} + +/* + * Routine: clock_init_uart + * Description: init the PLL and clock for the UART(s) + */ +static void clock_init_uart(void) +{ +#if defined(CONFIG_TEGRA2_ENABLE_UARTD) + enable_uart(PERIPH_ID_UART4); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +/* + * Routine: pin_mux_uart + * Description: setup the pin muxes/tristate values for the UART(s) + */ +static void pin_mux_uart(void) +{ +#if defined(CONFIG_TEGRA2_ENABLE_UARTD) + pinmux_set_func(PINGRP_GMC, PMUX_FUNC_UARTD); + + pinmux_tristate_disable(PINGRP_GMC); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +#ifdef CONFIG_TEGRA2_MMC +/* + * Routine: pin_mux_mmc + * Description: setup the pin muxes/tristate values for the SDMMC(s) + */ +static void pin_mux_mmc(void) +{ + /* SDMMC4: config 3, x8 on 2nd set of pins */ + pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4); + pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4); + pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4); + + pinmux_tristate_disable(PINGRP_ATB); + pinmux_tristate_disable(PINGRP_GMA); + pinmux_tristate_disable(PINGRP_GME); +} +#endif + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + clock_init(); + clock_verify(); + + /* boot param addr */ + gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100); + + return 0; +} + +#ifdef CONFIG_TEGRA2_MMC +/* this is a weak define that we are overriding */ +int board_mmc_init(bd_t *bd) +{ + debug("board_mmc_init called\n"); + /* Enable muxes, etc. for SDMMC controllers */ + pin_mux_mmc(); + gpio_config_mmc(); + + debug("board_mmc_init: init eMMC\n"); + /* init dev 0, eMMC chip, with 4-bit bus */ + tegra2_mmc_init(0, 4, -1, GPIO_PH2); + + return 0; +} +#endif + +#ifdef CONFIG_BOARD_EARLY_INIT_F +int board_early_init_f(void) +{ + /* Initialize essential common plls */ + clock_early_init(); + + /* Initialize UART clocks */ + clock_init_uart(); + + /* Initialize periph pinmuxes */ + pin_mux_uart(); + + return 0; +} +#endif /* EARLY_INIT */ diff --git a/board/avionic-design/common/tamonten.h b/board/avionic-design/common/tamonten.h new file mode 100644 index 0000000..0e60b0f --- /dev/null +++ b/board/avionic-design/common/tamonten.h @@ -0,0 +1,32 @@ +/* + * (C) Copyright 2010,2011 + * NVIDIA Corporation + * (C) Copyright 2011 + * Avionic Design GmbH + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _TAMONTEN_H_ +#define _TAMONTEN_H_ + +void tegra2_start(void); +void gpio_config_mmc(void); + +#endif /* TAMONTEN_H */