]> git.sur5r.net Git - u-boot/commitdiff
TQM85xx: Support for Flat Device Tree
authorWolfgang Grandegger <wg@grandegger.com>
Thu, 5 Jun 2008 11:12:06 +0000 (13:12 +0200)
committerAndrew Fleming-AFLEMING <afleming@freescale.com>
Wed, 11 Jun 2008 05:00:45 +0000 (00:00 -0500)
This patch adds support for Linux kernels using the Flat Device Tree.
It also re-defines the default environment settings for booting Linux
with the FDT blob.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Makefile
board/tqc/tqm85xx/tqm85xx.c
include/configs/TQM85xx.h

index 72456b2089970bc153543521d64592ef497768c2..c0b73e129e4734b5069653210d6bad374d2c7c2a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2238,8 +2238,7 @@ TQM8560_config:           unconfig
        echo "#define CONFIG_MPC$${CTYPE}">>$(obj)include/config.h; \
        echo "#define CONFIG_TQM$${CTYPE}">>$(obj)include/config.h; \
        echo "#define CONFIG_HOSTNAME tqm$${CTYPE}">>$(obj)include/config.h; \
-       echo "#define CONFIG_BOARDNAME \"TQM$${CTYPE}\"">>$(obj)include/config.h; \
-       echo "#define CFG_BOOTFILE_PATH \"/tftpboot/tqm$${CTYPE}/uImage\"">>$(obj)include/config.h
+       echo "#define CONFIG_BOARDNAME \"TQM$${CTYPE}\"">>$(obj)include/config.h;
        @$(MKCONFIG) -a TQM85xx ppc mpc85xx tqm85xx tqc
 
 #########################################################################
index 4fb9c113b29d4ddca4a9d54722805922fbd6bdf2..17df3bbdbff2b5c91aa88c282c13409c1d255aa6 100644 (file)
@@ -34,6 +34,8 @@
 #include <asm/io.h>
 #include <ioports.h>
 #include <flash.h>
+#include <libfdt.h>
+#include <fdt_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -479,6 +481,28 @@ void pci_init_board (void)
 #endif /* CONFIG_PCI */
 }
 
+#if defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup (void *blob, bd_t *bd)
+{
+       int node, tmp[2];
+       const char *path;
+
+       ft_cpu_setup (blob, bd);
+
+       node = fdt_path_offset (blob, "/aliases");
+       tmp[0] = 0;
+       if (node >= 0) {
+#ifdef CONFIG_PCI
+               path = fdt_getprop (blob, node, "pci0", NULL);
+               if (path) {
+                       tmp[1] = hose.last_busno - hose.first_busno;
+                       do_fixup_by_path (blob, path, "bus-range", &tmp, 8, 1);
+               }
+#endif
+       }
+}
+#endif
+
 #ifdef CONFIG_BOARD_EARLY_INIT_R
 int board_early_init_r (void)
 {
index 17df11856127370a6f961381c754450f7864af9b..6320f00524af59971297ec8723adb57afe51c26d 100644 (file)
 #define        CFG_PROMPT_HUSH_PS2     "> "
 #endif
 
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_OF_BOARD_SETUP          1
+#define CONFIG_OF_STDOUT_VIA_ALIAS     1
+
 /* CAN */
 #ifdef CONFIG_CAN_DRIVER
 #define CFG_CAN_BASE           0xE3000000      /* CAN base address     */
 
 #undef CONFIG_BOOTARGS         /* the boot command will set bootargs   */
 
+
+/*
+ * Setup some board specific values for the default environment variables
+ */
+#ifdef CONFIG_CPM2
+#define CFG_ENV_CONSDEV                "consdev=ttyCPM0\0"
+#else
+#define CFG_ENV_CONSDEV                "consdev=ttyS0\0"
+#endif
+#define CFG_ENV_FDT_FILE       "fdt_file="MK_STR(CONFIG_HOSTNAME)"/" \
+                               MK_STR(CONFIG_HOSTNAME)".dtb\0"
+#define CFG_ENV_BOOTFILE       "bootfile="MK_STR(CONFIG_HOSTNAME)"/uImage\0"
+#define CFG_ENV_UBOOT          "uboot="MK_STR(CONFIG_HOSTNAME)"/u-boot.bin\0" \
+                               "uboot_addr="MK_STR(TEXT_BASE)"\0"
+
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "bootfile="CFG_BOOTFILE_PATH"\0"                                \
+       CFG_ENV_BOOTFILE                                                \
+       CFG_ENV_FDT_FILE                                                \
+       CFG_ENV_CONSDEV                                                 \
        "netdev=eth0\0"                                                 \
-       "consdev=ttyS0\0"                                               \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
                "nfsroot=$serverip:$rootpath\0"                         \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
        "addcons=setenv bootargs $bootargs "                            \
                "console=$consdev,$baudrate\0"                          \
        "flash_nfs=run nfsargs addip addcons;"                          \
-               "bootm $kernel_addr\0"                                  \
+               "bootm $kernel_addr - $fdt_addr\0"                      \
        "flash_self=run ramargs addip addcons;"                         \
-               "bootm $kernel_addr $ramdisk_addr\0"                    \
-       "net_nfs=tftp $loadaddr $bootfile;"                             \
-               "run nfsargs addip addcons;bootm\0"                     \
+               "bootm $kernel_addr $ramdisk_addr $fdt_addr\0"          \
+       "net_nfs=tftp $kernel_addr_r $bootfile;"                        \
+               "tftp $fdt_addr_r $fdt_file;"                           \
+               "run nfsargs addip addcons;"                            \
+               "bootm $kernel_addr_r - $fdt_addr_r\0"                  \
        "rootpath=/opt/eldk/ppc_85xx\0"                                 \
-       "kernel_addr=FE000000\0"                                        \
-       "ramdisk_addr=FE180000\0"                                       \
-       "load=tftp 100000 /tftpboot/$hostname/u-boot.bin\0"             \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
+       "fdt_addr_r=900000\0"                                           \
+       "kernel_addr_r=1000000\0"                                       \
+       "fdt_addr=ffec0000\0"                                           \
+       "kernel_addr=ffd00000\0"                                        \
+       "ramdisk_addr=ff800000\0"                                       \
+       CFG_ENV_UBOOT                                                   \
+       "load=tftp 100000 $uboot\0"                                     \
+       "update=protect off $uboot_addr +$filesize;"                    \
+               "erase $uboot_addr +$filesize;"                         \
+               "cp.b 100000 $uboot_addr $filesize;"                    \
                "setenv filesize;saveenv\0"                             \
        "upd=run load update\0"                                         \
        ""