Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[platform/kernel/u-boot.git] / arch / arm / cpu / armv7 / omap3 / emif4.c
index da2cd90..6c7330a 100644 (file)
@@ -7,20 +7,7 @@
  * Copyright (C) 2010
  * Texas Instruments Incorporated - http://www.ti.com/
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -29,6 +16,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/emif4.h>
 
+DECLARE_GLOBAL_DATA_PTR;
 extern omap3_sysinfo sysinfo;
 
 static emif4_t *emif4_base = (emif4_t *)OMAP34XX_SDRC_BASE;
@@ -48,10 +36,11 @@ u32 is_mem_sdr(void)
  */
 u32 get_sdr_cs_size(u32 cs)
 {
-       u32 size;
+       u32 size = 0;
 
        /* TODO: Calculate the size based on EMIF4 configuration */
-       size = CONFIG_SYS_CS0_SIZE;
+       if (cs == CS0)
+               size = CONFIG_SYS_CS0_SIZE;
 
        return size;
 }
@@ -136,32 +125,8 @@ void do_emif4_init(void)
  * dram_init -
  *  - Sets uboots idea of sdram size
  */
-#if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
-int dram_init(void)
-{
-       DECLARE_GLOBAL_DATA_PTR;
-       unsigned int size0 = 0, size1 = 0;
-
-       size0 = get_sdr_cs_size(CS0);
-       /*
-        * If a second bank of DDR is attached to CS1 this is
-        * where it can be started.  Early init code will init
-        * memory on CS0.
-        */
-       if ((sysinfo.mtype == DDR_COMBO) || (sysinfo.mtype == DDR_STACKED))
-               size1 = get_sdr_cs_size(CS1);
-
-       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
-       gd->bd->bi_dram[0].size = size0;
-       gd->bd->bi_dram[1].start = PHYS_SDRAM_1 + get_sdr_cs_offset(CS1);
-       gd->bd->bi_dram[1].size = size1;
-
-       return 0;
-}
-#else
 int dram_init(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        unsigned int size0 = 0, size1 = 0;
 
        size0 = get_sdr_cs_size(CS0);
@@ -179,7 +144,6 @@ int dram_init(void)
 
 void dram_init_banksize (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        unsigned int size0 = 0, size1 = 0;
 
        size0 = get_sdr_cs_size(CS0);
@@ -190,7 +154,6 @@ void dram_init_banksize (void)
        gd->bd->bi_dram[1].start = PHYS_SDRAM_1 + get_sdr_cs_offset(CS1);
        gd->bd->bi_dram[1].size = size1;
 }
-#endif
 
 /*
  * mem_init() -