2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/arch/clock.h>
27 #include <asm/arch/funcmux.h>
28 #include <asm/arch/tegra.h>
29 #include <asm/arch-tegra/board.h>
30 #include <asm/arch-tegra/pmc.h>
31 #include <asm/arch-tegra/sys_proto.h>
32 #include <asm/arch-tegra/warmboot.h>
34 DECLARE_GLOBAL_DATA_PTR;
37 /* UARTs which we can enable */
45 * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0,
46 * so we are using this value to identify memory size.
49 unsigned int query_sdram_size(void)
51 struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
54 reg = readl(&pmc->pmc_scratch20);
55 debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg);
57 #if defined(CONFIG_TEGRA20)
58 /* bits 30:28 in OdmData are used for RAM size on T20 */
61 switch ((reg) >> 28) {
63 return 0x10000000; /* 256 MB */
67 return 0x20000000; /* 512 MB */
69 return 0x40000000; /* 1GB */
72 /* bits 31:28 in OdmData are used for RAM size on T30 */
73 switch ((reg) >> 28) {
77 return 0x10000000; /* 256 MB */
79 return 0x20000000; /* 512 MB */
81 return 0x30000000; /* 768 MB */
83 return 0x40000000; /* 1GB */
85 return 0x7ff00000; /* 2GB - 1MB */
92 /* We do not initialise DRAM here. We just query the size */
93 gd->ram_size = query_sdram_size();
97 #ifdef CONFIG_DISPLAY_BOARDINFO
100 printf("Board: %s\n", sysinfo.board_string);
103 #endif /* CONFIG_DISPLAY_BOARDINFO */
105 static int uart_configs[] = {
106 #if defined(CONFIG_TEGRA20)
107 #if defined(CONFIG_TEGRA_UARTA_UAA_UAB)
108 FUNCMUX_UART1_UAA_UAB,
109 #elif defined(CONFIG_TEGRA_UARTA_GPU)
111 #elif defined(CONFIG_TEGRA_UARTA_SDIO1)
114 FUNCMUX_UART1_IRRX_IRTX,
121 FUNCMUX_UART1_ULPI, /* UARTA */
130 * Set up the specified uarts
132 * @param uarts_ids Mask containing UARTs to init (UARTx)
134 static void setup_uarts(int uart_ids)
136 static enum periph_id id_for_uart[] = {
144 for (i = 0; i < UART_COUNT; i++) {
145 if (uart_ids & (1 << i)) {
146 enum periph_id id = id_for_uart[i];
148 funcmux_select(id, uart_configs[i]);
149 clock_ll_start_uart(id);
154 void board_init_uart_f(void)
156 int uart_ids = 0; /* bit mask of which UART ids to enable */
158 #ifdef CONFIG_TEGRA_ENABLE_UARTA
161 #ifdef CONFIG_TEGRA_ENABLE_UARTB
164 #ifdef CONFIG_TEGRA_ENABLE_UARTD
167 setup_uarts(uart_ids);
170 #ifndef CONFIG_SYS_DCACHE_OFF
171 void enable_caches(void)
173 /* Enable D-cache. I-cache is already enabled in start.S */