board_f: Drop return value from initdram()
[oweals/u-boot.git] / arch / powerpc / cpu / ppc4xx / denali_spd_ddr2.c
index 3ceab32e4371164d14539bc68911624e4146108a..14d0fd915434b47a84dd175e567f17ad6a9d12af 100644 (file)
  *
  * COPYRIGHT   AMCC   CORPORATION 2004
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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+
  */
 
 /* define DEBUG for debugging output (obviously ;-)) */
@@ -47,6 +30,8 @@
 #include <asm/mmu.h>
 #include <asm/cache.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if defined(CONFIG_SPD_EEPROM) &&                              \
        (defined(CONFIG_440EPX) || defined(CONFIG_440GRX))
 
@@ -1015,7 +1000,7 @@ static void program_ddr0_44(unsigned long dimm_ranks[],
  *              banks appropriately. If Auto Memory Configuration is
  *              not used, it is assumed that no DIMM is plugged
  *-----------------------------------------------------------------------------*/
-phys_size_t initdram(int board_type)
+int initdram(void)
 {
        unsigned char const iic0_dimm_addr[] = SPD_EEPROM_ADDRESS;
        unsigned long dimm_ranks[MAXDIMMS];
@@ -1041,8 +1026,7 @@ phys_size_t initdram(int board_type)
         * before continuing.
         */
        /* switch to correct I2C bus */
-       I2C_SET_BUS(CONFIG_SYS_SPD_BUS_NUM);
-       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM);
 
        /*------------------------------------------------------------------
         * Clear out the serial presence detect buffers.
@@ -1169,7 +1153,7 @@ phys_size_t initdram(int board_type)
        dram_size *= ranks;
        debug("dram_size = %lu\n", dram_size);
 
-       /* Start the SDRAM controler */
+       /* Start the SDRAM controller */
        mtsdram(DDR0_02, DDR0_02_START_ENCODE(1));
        denali_wait_for_dlllock();
 
@@ -1230,7 +1214,9 @@ phys_size_t initdram(int board_type)
 #endif /* defined(CONFIG_ZERO_SDRAM) || defined(CONFIG_DDR_ECC) */
 
        program_tlb(0, CONFIG_SYS_SDRAM_BASE, dram_size, MY_TLB_WORD2_I_ENABLE);
-       return dram_size;
+       gd->ram_size = dram_size;
+
+       return 0;
 }
 
 void board_add_ram_info(int use_default)