2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
8 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/immap.h>
16 DECLARE_GLOBAL_DATA_PTR;
22 * Check serial flash size. if 2mb evb, else 8mb demo
25 puts("Freescale M54451 EVB\n");
29 phys_size_t initdram(int board_type)
34 * Serial Boot: The dram is already initialized in start.S
35 * only require to return DRAM size
37 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
39 sdramc_t *sdram = (sdramc_t *)(MMAP_SDRAM);
40 gpio_t *gpio = (gpio_t *)(MMAP_GPIO);
43 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
45 if ((in_be32(&sdram->sdcfg1) == CONFIG_SYS_SDRAM_CFG1) &&
46 (in_be32(&sdram->sdcfg2) == CONFIG_SYS_SDRAM_CFG2))
49 for (i = 0x13; i < 0x20; i++) {
50 if (dramsize == (1 << i))
55 out_8(&gpio->mscr_sdram, CONFIG_SYS_SDRAM_DRV_STRENGTH);
57 out_be32(&sdram->sdcs0, CONFIG_SYS_SDRAM_BASE | i);
59 out_be32(&sdram->sdcfg1, CONFIG_SYS_SDRAM_CFG1);
60 out_be32(&sdram->sdcfg2, CONFIG_SYS_SDRAM_CFG2);
65 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 2);
68 /* Perform two refresh cycles */
69 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 4);
71 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 4);
75 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_MODE);
77 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_MODE);
80 out_be32(&sdram->sdcr,
81 (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000000);
90 /* TODO: XXX XXX XXX */
91 printf("DRAM test not implemented!\n");