2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
8 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/immap.h>
15 DECLARE_GLOBAL_DATA_PTR
;
20 puts("Freescale M52277 EVB\n");
24 phys_size_t
initdram(int board_type
)
30 * Serial Boot: The dram is already initialized in start.S
31 * only require to return DRAM size
33 dramsize
= CONFIG_SYS_SDRAM_SIZE
* 0x100000;
35 sdramc_t
*sdram
= (sdramc_t
*)(MMAP_SDRAM
);
36 gpio_t
*gpio
= (gpio_t
*)(MMAP_GPIO
);
39 dramsize
= CONFIG_SYS_SDRAM_SIZE
* 0x100000;
41 for (i
= 0x13; i
< 0x20; i
++) {
42 if (dramsize
== (1 << i
))
47 out_8(&gpio
->mscr_sdram
, CONFIG_SYS_SDRAM_DRV_STRENGTH
);
49 out_be32(&sdram
->sdcs0
, CONFIG_SYS_SDRAM_BASE
| i
);
51 out_be32(&sdram
->sdcfg1
, CONFIG_SYS_SDRAM_CFG1
);
52 out_be32(&sdram
->sdcfg2
, CONFIG_SYS_SDRAM_CFG2
);
55 out_be32(&sdram
->sdcr
, CONFIG_SYS_SDRAM_CTRL
| 2);
59 out_be32(&sdram
->sdmr
, CONFIG_SYS_SDRAM_MODE
);
61 out_be32(&sdram
->sdmr
, CONFIG_SYS_SDRAM_EMOD
);
67 out_be32(&sdram
->sdcr
, CONFIG_SYS_SDRAM_CTRL
| 2);
70 /* Perform two refresh cycles */
71 out_be32(&sdram
->sdcr
, CONFIG_SYS_SDRAM_CTRL
| 4);
73 out_be32(&sdram
->sdcr
, CONFIG_SYS_SDRAM_CTRL
| 4);
76 out_be32(&sdram
->sdcr
,
77 (CONFIG_SYS_SDRAM_CTRL
& ~0x80000000) | 0x10000c00);
86 /* TODO: XXX XXX XXX */
87 printf("DRAM test not implemented!\n");