X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=board%2Fgdsys%2Fmpc8308%2Fsdram.c;h=47b880435210da5576baeeeada5c181020e67fd6;hb=b8e09898919e23c5d7f1934be7bf9a3a6f0deb0e;hp=0fce8cfbab6002c967bd4b1e72d4f41ac60fd7e6;hpb=85bafb6da4dddfffa78479aa49a72ae48578a4ce;p=platform%2Fkernel%2Fu-boot.git diff --git a/board/gdsys/mpc8308/sdram.c b/board/gdsys/mpc8308/sdram.c index 0fce8cf..47b8804 100644 --- a/board/gdsys/mpc8308/sdram.c +++ b/board/gdsys/mpc8308/sdram.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2007 Freescale Semiconductor, Inc. * Copyright (C) 2010 Ilya Yanok, Emcraft Systems, yanok@emcraft.com @@ -8,15 +9,17 @@ * * This files is mostly identical to the original from * board\freescale\mpc8315erdb\sdram.c - * - * SPDX-License-Identifier: GPL-2.0+ */ +#ifndef CONFIG_MPC83XX_SDRAM + #include +#include #include #include #include +#include #include #include @@ -31,11 +34,11 @@ DECLARE_GLOBAL_DATA_PTR; static long fixed_sdram(void) { immap_t *im = (immap_t *)CONFIG_SYS_IMMR; - u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024; + u32 msize = CONFIG_SYS_SDRAM_SIZE; u32 msize_log2 = __ilog2(msize); out_be32(&im->sysconf.ddrlaw[0].bar, - CONFIG_SYS_DDR_SDRAM_BASE & 0xfffff000); + CONFIG_SYS_SDRAM_BASE & 0xfffff000); out_be32(&im->sysconf.ddrlaw[0].ar, LBLAWAR_EN | (msize_log2 - 1)); out_be32(&im->sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE); @@ -63,20 +66,24 @@ static long fixed_sdram(void) setbits_be32(&im->ddr.sdram_cfg, SDRAM_CFG_MEM_EN); sync(); - return get_ram_size(CONFIG_SYS_DDR_SDRAM_BASE, msize); + return get_ram_size(CONFIG_SYS_SDRAM_BASE, msize); } -phys_size_t initdram(int board_type) +int dram_init(void) { immap_t *im = (immap_t *)CONFIG_SYS_IMMR; u32 msize; if ((in_be32(&im->sysconf.immrbar) & IMMRBAR_BASE_ADDR) != (u32)im) - return -1; + return -ENXIO; /* DDR SDRAM */ msize = fixed_sdram(); /* return total bus SDRAM size(bytes) -- DDR */ - return msize; + gd->ram_size = msize; + + return 0; } + +#endif /* !CONFIG_MPC83XX_SDRAM */