TQM834x: add FDT support
authorWolfgang Denk <wd@denx.de>
Thu, 14 May 2009 21:18:34 +0000 (23:18 +0200)
committerWolfgang Denk <wd@denx.de>
Fri, 12 Jun 2009 18:39:52 +0000 (20:39 +0200)
Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
board/tqc/tqm834x/pci.c
board/tqc/tqm834x/tqm834x.c
include/configs/TQM834x.h

index cb2cb8d32d4e652563e75576ebcb726f1ba79e03..6c113e3db19fb8f9657b455c009512017e6cc045 100644 (file)
 
 #include <asm/mmu.h>
 #include <common.h>
+#include <asm/global_data.h>
 #include <pci.h>
+#include <asm/mpc8349_pci.h>
+#if defined(CONFIG_OF_LIBFDT)
+#include <libfdt.h>
+#include <fdt_support.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_PCI
 
@@ -217,4 +225,41 @@ pci_init_board(void)
         */
        hose->last_busno = pci_hose_scan(hose);
 }
+
+#if defined(CONFIG_OF_LIBFDT)
+void ft_pci_setup(void *blob, bd_t *bd)
+{
+       int nodeoffset;
+       int tmp[2];
+       const char *path;
+
+       nodeoffset = fdt_path_offset(blob, "/aliases");
+       if (nodeoffset >= 0) {
+               path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
+               if (path) {
+                       tmp[0] = cpu_to_be32(pci1_hose.first_busno);
+                       tmp[1] = cpu_to_be32(pci1_hose.last_busno);
+                       do_fixup_by_path(blob, path, "bus-range",
+                               &tmp, sizeof(tmp), 1);
+
+                       tmp[0] = cpu_to_be32(gd->pci_clk);
+                       do_fixup_by_path(blob, path, "clock-frequency",
+                               &tmp, sizeof(tmp[0]), 1);
+               }
+#ifdef CONFIG_MPC83XX_PCI2
+               path = fdt_getprop(blob, nodeoffset, "pci1", NULL);
+               if (path) {
+                       tmp[0] = cpu_to_be32(pci2_hose.first_busno);
+                       tmp[1] = cpu_to_be32(pci2_hose.last_busno);
+                       do_fixup_by_path(blob, path, "bus-range",
+                               &tmp, sizeof(tmp), 1);
+
+                       tmp[0] = cpu_to_be32(gd->pci_clk);
+                       do_fixup_by_path(blob, path, "clock-frequency",
+                               &tmp, sizeof(tmp[0]), 1);
+               }
+#endif
+       }
+}
+#endif /* CONFIG_OF_LIBFDT */
 #endif /* CONFIG_PCI */
index 106cac2448e8ff99e8da3f538d432c035961e139..4fd8cd696922e195aa727673b18b5eb01895c6f0 100644 (file)
@@ -431,3 +431,14 @@ static void set_ddr_config(void) {
 #endif
        }
 }
+
+#ifdef CONFIG_OF_BOARD_SETUP
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       ft_cpu_setup(blob, bd);
+
+#ifdef CONFIG_PCI
+       ft_pci_setup(blob, bd);
+#endif /* CONFIG_PCI */
+}
+#endif /* CONFIG_OF_BOARD_SETUP */
index 7d72fa1785d245a2649f7f3c23450a255ed1aa15..d4b0f9c9300931ad27f3818f2a19e8e7f8eb512f 100644 (file)
@@ -146,9 +146,9 @@ extern int tqm834x_num_flash_banks;
 #define CONFIG_SYS_MONITOR_BASE        TEXT_BASE       /* start of monitor */
 
 #if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
-#define CONFIG_SYS_RAMBOOT
+# define CONFIG_SYS_RAMBOOT
 #else
-#undef  CONFIG_SYS_RAMBOOT
+# undef  CONFIG_SYS_RAMBOOT
 #endif
 
 #define CONFIG_SYS_INIT_RAM_LOCK       1
@@ -275,12 +275,7 @@ extern int tqm834x_num_flash_banks;
 /*
  * Environment
  */
-#ifdef CONFIG_SYS_RAMBOOT
-# define CONFIG_SYS_NO_FLASH           1       /* Flash is not usable now */
-#else
-# define CONFIG_ENV_IS_IN_FLASH                1
-#endif
-
+#define CONFIG_ENV_IS_IN_FLASH         1
 #define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
 #define CONFIG_ENV_SECT_SIZE           0x20000 /* 128K (one sector) for env */
 #define CONFIG_ENV_SIZE                        0x8000  /*  32K max size */
@@ -304,14 +299,18 @@ extern int tqm834x_num_flash_banks;
  */
 #include <config_cmd_default.h>
 
+#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
+#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_DTT
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_I2C
+#define CONFIG_CMD_NFS
 #define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
-#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_REGINFO
+#define CONFIG_CMD_SNTP
 
 #if defined(CONFIG_PCI)
     #define CONFIG_CMD_PCI
@@ -348,6 +347,11 @@ extern int tqm834x_num_flash_banks;
 
 #undef CONFIG_WATCHDOG                         /* watchdog disabled */
 
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT       1
+#define CONFIG_OF_BOARD_SETUP  1
+#define CONFIG_OF_STDOUT_VIA_ALIAS     1
+
 /*
  * For booting Linux, the board info and command line data
  * have to be in the first 8 MB of memory, since this is
@@ -492,20 +496,35 @@ extern int tqm834x_num_flash_banks;
        "addip=setenv bootargs ${bootargs} "                            \
                "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
                ":${hostname}:${netdev}:off panic=1\0"                  \
-       "addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
-       "flash_nfs=run nfsargs addip addtty;"                           \
+       "addcons=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
+       "flash_nfs_old=run nfsargs addip addcons;"                      \
                "bootm ${kernel_addr}\0"                                \
-       "flash_self=run ramargs addip addtty;"                          \
+       "flash_nfs=run nfsargs addip addcons;"                          \
+               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
+       "flash_self_old=run ramargs addip addcons;"                     \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
-       "net_nfs=tftp 400000 ${bootfile};run nfsargs addip addtty;"     \
-               "bootm\0"                                               \
+       "flash_self=run ramargs addip addcons;"                         \
+               "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
+       "net_nfs_old=tftp 400000 ${bootfile};"                          \
+               "run nfsargs addip addcons;bootm\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_6xx\0"                                  \
-       "bootfile=/tftpboot/tqm834x/uImage\0"                           \
-       "kernel_addr=80060000\0"                                        \
-       "ramdisk_addr=80160000\0"                                       \
-       "load=tftp 100000 /tftpboot/tqm834x/u-boot.bin\0"               \
-       "update=protect off 80000000 8003ffff; "                        \
-               "era 80000000 8003ffff; cp.b 100000 80000000 40000\0"   \
+       "bootfile=tqm834x/uImage\0"                                     \
+       "fdtfile=tqm834x/tqm834x.dtb\0"                                 \
+       "kernel_addr_r=400000\0"                                        \
+       "fdt_addr_r=600000\0"                                           \
+       "ramdisk_addr_r=800000\0"                                       \
+       "kernel_addr=800C0000\0"                                        \
+       "fdt_addr=800A0000\0"                                           \
+       "ramdisk_addr=80300000\0"                                       \
+       "u-boot=tqm834x/u-boot.bin\0"                                   \
+       "load=tftp 200000 ${u-boot}\0"                                  \
+       "update=protect off 80000000 +${filesize};"                     \
+               "era 80000000 +${filesize};"                            \
+               "cp.b 200000 80000000 ${filesize}\0"                    \
        "upd=run load update\0"                                         \
        ""