1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * (C) Copyright 2000-2003 4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 5 * 6 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. 7 * TsiChung Liew (Tsi-Chung.Liew@freescale.com) 8 */ 9 10 #include <config.h> 11 #include <common.h> 12 #include <asm/immap.h> 13 #include <asm/io.h> 14 15 DECLARE_GLOBAL_DATA_PTR; 16 17 int checkboard(void) 18 { 19 puts("Board: "); 20 puts("Freescale FireEngine 5329 EVB\n"); 21 return 0; 22 }; 23 24 int dram_init(void) 25 { 26 sdram_t *sdram = (sdram_t *)(MMAP_SDRAM); 27 u32 dramsize, i; 28 29 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000; 30 31 for (i = 0x13; i < 0x20; i++) { 32 if (dramsize == (1 << i)) 33 break; 34 } 35 i--; 36 37 out_be32(&sdram->cs0, CONFIG_SYS_SDRAM_BASE | i); 38 out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1); 39 out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2); 40 41 /* Issue PALL */ 42 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2); 43 44 /* Issue LEMR */ 45 out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD); 46 out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000); 47 48 udelay(500); 49 50 /* Issue PALL */ 51 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2); 52 53 /* Perform two refresh cycles */ 54 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4); 55 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4); 56 57 out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE); 58 59 out_be32(&sdram->ctrl, 60 (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000c00); 61 62 udelay(100); 63 64 gd->ram_size = dramsize; 65 66 return 0; 67 }; 68 69 int testdram(void) 70 { 71 /* TODO: XXX XXX XXX */ 72 printf("DRAM test not implemented!\n"); 73 74 return (0); 75 } 76