Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 1 | /* |
| 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 Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <asm/io.h> |
| 11 | #include <asm/arch/imx-regs.h> |
trem | f6315ed | 2012-08-25 05:30:34 +0000 | [diff] [blame] | 12 | #include <asm/gpio.h> |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
Fabio Estevam | f231efb | 2011-10-13 05:34:59 +0000 | [diff] [blame] | 16 | int board_init(void) |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 17 | { |
Heiko Schocher | c8f5112 | 2010-03-05 07:36:33 +0100 | [diff] [blame] | 18 | #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 Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 22 | |
| 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 Estevam | af905dd | 2011-07-01 07:15:52 +0000 | [diff] [blame] | 27 | mx27_uart1_init_pins(); |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 28 | #endif |
| 29 | #ifdef CONFIG_FEC_MXC |
| 30 | mx27_fec_init_pins(); |
| 31 | imx_gpio_mode((GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31)); |
trem | f6315ed | 2012-08-25 05:30:34 +0000 | [diff] [blame] | 32 | gpio_set_value(GPIO_PORTC | 31, 1); |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 33 | #endif |
| 34 | #ifdef CONFIG_MXC_MMC |
Heiko Schocher | c8f5112 | 2010-03-05 07:36:33 +0100 | [diff] [blame] | 35 | #if defined(CONFIG_MAGNESIUM) |
| 36 | mx27_sd1_init_pins(); |
| 37 | #else |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 38 | mx27_sd2_init_pins(); |
| 39 | #endif |
Heiko Schocher | c8f5112 | 2010-03-05 07:36:33 +0100 | [diff] [blame] | 40 | #endif |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 41 | |
Heiko Schocher | c8f5112 | 2010-03-05 07:36:33 +0100 | [diff] [blame] | 42 | #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 Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 49 | return 0; |
| 50 | } |
| 51 | |
Fabio Estevam | f231efb | 2011-10-13 05:34:59 +0000 | [diff] [blame] | 52 | int dram_init(void) |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 53 | { |
Heiko Schocher | 0e2412a | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 54 | /* dram_init must store complete ramsize in gd->ram_size */ |
Albert ARIBAUD | a960673 | 2011-07-03 05:55:33 +0000 | [diff] [blame] | 55 | gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, |
Heiko Schocher | 0e2412a | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 56 | PHYS_SDRAM_1_SIZE); |
| 57 | return 0; |
| 58 | } |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 59 | |
Heiko Schocher | 0e2412a | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 60 | void dram_init_banksize(void) |
| 61 | { |
| 62 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
Albert ARIBAUD | a960673 | 2011-07-03 05:55:33 +0000 | [diff] [blame] | 63 | gd->bd->bi_dram[0].size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 64 | PHYS_SDRAM_1_SIZE); |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 65 | #if CONFIG_NR_DRAM_BANKS > 1 |
| 66 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
Albert ARIBAUD | a960673 | 2011-07-03 05:55:33 +0000 | [diff] [blame] | 67 | gd->bd->bi_dram[1].size = get_ram_size((void *)PHYS_SDRAM_2, |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 68 | PHYS_SDRAM_2_SIZE); |
| 69 | #endif |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | int checkboard(void) |
| 73 | { |
Fabio Estevam | f231efb | 2011-10-13 05:34:59 +0000 | [diff] [blame] | 74 | puts("Board: "); |
Heiko Schocher | c8f5112 | 2010-03-05 07:36:33 +0100 | [diff] [blame] | 75 | puts(CONFIG_BOARDNAME); |
Ilya Yanok | 016b702 | 2009-08-11 02:32:09 +0400 | [diff] [blame] | 76 | return 0; |
| 77 | } |