]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - arch/powerpc/cpu/ppc4xx/sdram.c
drivers, block: remove sil680 driver
[people/ms/u-boot.git] / arch / powerpc / cpu / ppc4xx / sdram.c
index 2d95bc53c2599aaf2d1268e220e21b162bb58dfc..c416bcebf6aa91d32685051bcc2531f3bdd11be5 100644 (file)
@@ -8,7 +8,7 @@
  * (C) Copyright 2002-2004
  * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
  *
- * SPDX-License-Identifier:    GPL-2.0+ 
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -17,6 +17,8 @@
 #include "sdram.h"
 #include "ecc.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifdef CONFIG_SDRAM_BANK0
 
 #ifndef CONFIG_440
@@ -33,7 +35,7 @@ sdram_conf_t mb0cf[] = {
 sdram_conf_t mb0cf[] = CONFIG_SYS_SDRAM_TABLE;
 #endif
 
-#define N_MB0CF (sizeof(mb0cf) / sizeof(mb0cf[0]))
+#define N_MB0CF (ARRAY_SIZE(mb0cf))
 
 #ifdef CONFIG_SYS_SDRAM_CASL
 static ulong ns2clks(ulong ns)
@@ -148,7 +150,7 @@ static ulong compute_rtr(ulong speed, ulong rows, ulong refresh)
 /*
  * Autodetect onboard SDRAM on 405 platforms
  */
-phys_size_t initdram(int board_type)
+int dram_init(void)
 {
        ulong speed;
        ulong sdtr1;
@@ -226,11 +228,13 @@ phys_size_t initdram(int board_type)
                        /*
                         * OK, size detected -> all done
                         */
-                       return size;
+                       gd->ram_size = size;
+
+                       return 0;
                }
        }
 
-       return 0;
+       return -ENXIO;
 }
 
 #else /* CONFIG_440 */
@@ -266,7 +270,7 @@ sdram_conf_t mb0cf[] = CONFIG_SYS_SDRAM_TABLE;
 #define CONFIG_SYS_SDRAM0_CFG0         0x82000000 /* DCEN=1, PMUD=0, 64-bit */
 #endif
 
-#define N_MB0CF (sizeof(mb0cf) / sizeof(mb0cf[0]))
+#define N_MB0CF (ARRAY_SIZE(mb0cf))
 
 #define NUM_TRIES 64
 #define NUM_READS 10
@@ -349,7 +353,7 @@ static void sdram_tr1_set(int ram_address, int* tr1_value)
  *      so this should be extended for other future boards
  *      using this routine!
  */
-phys_size_t initdram(int board_type)
+int dram_init(void)
 {
        int i;
        int tr1_bank1;
@@ -440,11 +444,13 @@ phys_size_t initdram(int board_type)
                        /*
                         * OK, size detected -> all done
                         */
-                       return size;
+                       gd->ram_size = size;
+
+                       return 0;
                }
        }
 
-       return 0;                               /* nothing found !              */
+       return -ENXIO;                  /* nothing found !              */
 }
 
 #endif /* CONFIG_440 */