b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [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 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <asm/io.h> |
| 11 | #include <asm/arch/imx-regs.h> |
| 12 | #include <asm/gpio.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | int board_init(void) |
| 17 | { |
| 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 |
| 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 |
| 27 | mx27_uart1_init_pins(); |
| 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)); |
| 32 | gpio_set_value(GPIO_PORTC | 31, 1); |
| 33 | #endif |
| 34 | #ifdef CONFIG_MXC_MMC |
| 35 | #if defined(CONFIG_MAGNESIUM) |
| 36 | mx27_sd1_init_pins(); |
| 37 | #else |
| 38 | mx27_sd2_init_pins(); |
| 39 | #endif |
| 40 | #endif |
| 41 | |
| 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 |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | int dram_init(void) |
| 53 | { |
| 54 | /* dram_init must store complete ramsize in gd->ram_size */ |
| 55 | gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, |
| 56 | PHYS_SDRAM_1_SIZE); |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | void dram_init_banksize(void) |
| 61 | { |
| 62 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
| 63 | gd->bd->bi_dram[0].size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, |
| 64 | PHYS_SDRAM_1_SIZE); |
| 65 | #if CONFIG_NR_DRAM_BANKS > 1 |
| 66 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 67 | gd->bd->bi_dram[1].size = get_ram_size((void *)PHYS_SDRAM_2, |
| 68 | PHYS_SDRAM_2_SIZE); |
| 69 | #endif |
| 70 | } |
| 71 | |
| 72 | int checkboard(void) |
| 73 | { |
| 74 | puts("Board: "); |
| 75 | puts(CONFIG_BOARDNAME); |
| 76 | return 0; |
| 77 | } |