blob: 07b07a07f69529c7650b632e75c29b841303ad41 [file] [log] [blame]
Ilya Yanok016b7022009-08-11 02:32:09 +04001/*
2 * Copyright (C) 2007 Sascha Hauer, Pengutronix
3 * Copyright (C) 2008,2009 Eric Jarrige <jorasse@users.sourceforge.net>
4 * Copyright (C) 2009 Ilya Yanok <yanok@emcraft.com>
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Ilya Yanok016b7022009-08-11 02:32:09 +04007 */
8
9#include <common.h>
10#include <asm/io.h>
11#include <asm/arch/imx-regs.h>
tremf6315ed2012-08-25 05:30:34 +000012#include <asm/gpio.h>
Ilya Yanok016b7022009-08-11 02:32:09 +040013
14DECLARE_GLOBAL_DATA_PTR;
15
Fabio Estevamf231efb2011-10-13 05:34:59 +000016int board_init(void)
Ilya Yanok016b7022009-08-11 02:32:09 +040017{
Heiko Schocherc8f51122010-03-05 07:36:33 +010018#if defined(CONFIG_SYS_NAND_LARGEPAGE)
19 struct system_control_regs *sc_regs =
20 (struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
21#endif
Ilya Yanok016b7022009-08-11 02:32:09 +040022
23 gd->bd->bi_arch_number = MACH_TYPE_IMX27LITE;
24 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
25
26#ifdef CONFIG_MXC_UART
Fabio Estevamaf905dd2011-07-01 07:15:52 +000027 mx27_uart1_init_pins();
Ilya Yanok016b7022009-08-11 02:32:09 +040028#endif
29#ifdef CONFIG_FEC_MXC
30 mx27_fec_init_pins();
31 imx_gpio_mode((GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31));
tremf6315ed2012-08-25 05:30:34 +000032 gpio_set_value(GPIO_PORTC | 31, 1);
Ilya Yanok016b7022009-08-11 02:32:09 +040033#endif
34#ifdef CONFIG_MXC_MMC
Heiko Schocherc8f51122010-03-05 07:36:33 +010035#if defined(CONFIG_MAGNESIUM)
36 mx27_sd1_init_pins();
37#else
Ilya Yanok016b7022009-08-11 02:32:09 +040038 mx27_sd2_init_pins();
39#endif
Heiko Schocherc8f51122010-03-05 07:36:33 +010040#endif
Ilya Yanok016b7022009-08-11 02:32:09 +040041
Heiko Schocherc8f51122010-03-05 07:36:33 +010042#if defined(CONFIG_SYS_NAND_LARGEPAGE)
43 /*
44 * set in FMCR NF_FMS Bit(5) to 1
45 * (NAND Flash with 2 Kbyte page size)
46 */
47 writel(readl(&sc_regs->fmcr) | (1 << 5), &sc_regs->fmcr);
48#endif
Ilya Yanok016b7022009-08-11 02:32:09 +040049 return 0;
50}
51
Fabio Estevamf231efb2011-10-13 05:34:59 +000052int dram_init(void)
Ilya Yanok016b7022009-08-11 02:32:09 +040053{
Heiko Schocher0e2412a2010-09-17 13:10:42 +020054 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa9606732011-07-03 05:55:33 +000055 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
Heiko Schocher0e2412a2010-09-17 13:10:42 +020056 PHYS_SDRAM_1_SIZE);
57 return 0;
58}
Ilya Yanok016b7022009-08-11 02:32:09 +040059
Heiko Schocher0e2412a2010-09-17 13:10:42 +020060void dram_init_banksize(void)
61{
62 gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
Albert ARIBAUDa9606732011-07-03 05:55:33 +000063 gd->bd->bi_dram[0].size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
Ilya Yanok016b7022009-08-11 02:32:09 +040064 PHYS_SDRAM_1_SIZE);
Ilya Yanok016b7022009-08-11 02:32:09 +040065#if CONFIG_NR_DRAM_BANKS > 1
66 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
Albert ARIBAUDa9606732011-07-03 05:55:33 +000067 gd->bd->bi_dram[1].size = get_ram_size((void *)PHYS_SDRAM_2,
Ilya Yanok016b7022009-08-11 02:32:09 +040068 PHYS_SDRAM_2_SIZE);
69#endif
Ilya Yanok016b7022009-08-11 02:32:09 +040070}
71
72int checkboard(void)
73{
Fabio Estevamf231efb2011-10-13 05:34:59 +000074 puts("Board: ");
Heiko Schocherc8f51122010-03-05 07:36:33 +010075 puts(CONFIG_BOARDNAME);
Ilya Yanok016b7022009-08-11 02:32:09 +040076 return 0;
77}