/*
- * Copyright 2008, 2010 Freescale Semiconductor, Inc.
+ * Copyright 2008, 2010-2011 Freescale Semiconductor, Inc.
  *
  * 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
                                "Memory controller interleaving disabled.\n");
        }
 }
+
+int fsl_use_spd(void)
+{
+       int use_spd = 0;
+
+#ifdef CONFIG_DDR_SPD
+       /* if hwconfig is not enabled, or "sdram" is not defined, use spd */
+       if (hwconfig_sub("fsl_ddr", "sdram")) {
+               if (hwconfig_subarg_cmp("fsl_ddr", "sdram", "spd"))
+                       use_spd = 1;
+               else if (hwconfig_subarg_cmp("fsl_ddr", "sdram", "fixed"))
+                       use_spd = 0;
+               else
+                       use_spd = 1;
+       } else
+               use_spd = 1;
+#endif
+
+       return use_spd;
+}
 
 /*
- * Copyright 2008-2010 Freescale Semiconductor, Inc.
+ * Copyright 2008-2011 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 } memctl_options_t;
 
 extern phys_size_t fsl_ddr_sdram(void);
+extern int fsl_use_spd(void);
 
 /*
  * The 85xx boards have a common prototype for fixed_sdram so put the
 
 /*
- * Copyright 2009-2010 Freescale Semiconductor, Inc.
+ * Copyright 2009-2011 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 phys_size_t initdram(int board_type)
 {
        phys_size_t dram_size;
-       int use_spd = 0;
 
        puts("Initializing....");
 
-#ifdef CONFIG_DDR_SPD
-       /* if hwconfig is not enabled, or "sdram" is not defined, use spd */
-       if (hwconfig_sub("fsl_ddr", "sdram")) {
-               if (hwconfig_subarg_cmp("fsl_ddr", "sdram", "spd"))
-                       use_spd = 1;
-               else if (hwconfig_subarg_cmp("fsl_ddr", "sdram", "fixed"))
-                       use_spd = 0;
-               else
-                       use_spd = 1;
-       } else
-               use_spd = 1;
-#endif
-
-       if (use_spd) {
+       if (fsl_use_spd()) {
                puts("using SPD\n");
                dram_size = fsl_ddr_sdram();
        } else {