]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/tqm5200/tqm5200.c
TQM5200: fix bug in SDRAM initialization code
[karo-tx-uboot.git] / board / tqm5200 / tqm5200.c
index 51f4aebc06e0b46a990ab14003d4a75554f766fe..8c3f701d5eaaa0812e240127e9cf5dec784cef5a 100644 (file)
 #include <mpc5xxx.h>
 #include <pci.h>
 #include <asm/processor.h>
-
-#if defined(CONFIG_OF_FLAT_TREE)
-#include <ft_build.h>
-#endif
+#include <libfdt.h>
 
 #ifdef CONFIG_VIDEO_SM501
 #include <sm501.h>
@@ -46,6 +43,8 @@
 #include "mt48lc16m16a2-75.h"
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifdef CONFIG_PS2MULT
 void ps2mult_early_init(void);
 #endif
@@ -156,10 +155,13 @@ long int initdram (int board_type)
        *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
 
        /* find RAM size using SDRAM CS1 only */
-       sdram_start(0);
-       test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
-       sdram_start(1);
-       test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+       if (!dramsize)
+               sdram_start(0);
+       test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+       if (!dramsize) {
+               sdram_start(1);
+               test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+       }
        if (test1 > test2) {
                sdram_start(0);
                dramsize2 = test1;
@@ -442,15 +444,24 @@ ulong post_word_load (void)
 }
 #endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
 
-#ifdef CONFIG_PS2MULT
 #ifdef CONFIG_BOARD_EARLY_INIT_R
 int board_early_init_r (void)
 {
+
+       extern int usb_cpu_init(void);
+
+#ifdef CONFIG_PS2MULT
        ps2mult_early_init();
+#endif /* CONFIG_PS2MULT */
+
+#if defined(CONFIG_USB_OHCI_NEW) && defined(CFG_USB_OHCI_CPU_INIT)
+       /* Low level USB init, required for proper kernel operation */
+       usb_cpu_init();
+#endif
+
        return (0);
 }
 #endif
-#endif /* CONFIG_PS2MULT */
 
 #ifdef CONFIG_FO300
 int silent_boot (void)
@@ -480,8 +491,6 @@ int silent_boot (void)
 
 int board_early_init_f (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        if (silent_boot())
                gd->flags |= GD_FLG_SILENT;
 
@@ -546,6 +555,7 @@ int last_stage_init (void)
                __asm__ volatile ("sync");
        }
 
+#ifndef CONFIG_TQM5200S        /* The TQM5200S has no SM501 grafic controller */
        /*
         * Check for Grafic Controller
         */
@@ -587,6 +597,7 @@ int last_stage_init (void)
                disable_ctrlc(1);
        }
 #endif
+#endif /* !CONFIG_TQM5200S */
 
        return 0;
 }
@@ -780,9 +791,9 @@ int board_get_height (void)
 
 #endif /* CONFIG_VIDEO_SM501 */
 
-#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 void ft_board_setup(void *blob, bd_t *bd)
 {
        ft_cpu_setup(blob, bd);
 }
-#endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */