]> git.sur5r.net Git - u-boot/commitdiff
Convert MPC8641HPCN to use libfdt.
authorJon Loeliger <jdl@freescale.com>
Wed, 28 Nov 2007 20:47:18 +0000 (14:47 -0600)
committerJon Loeliger <jdl@freescale.com>
Thu, 3 Jan 2008 16:27:03 +0000 (10:27 -0600)
Assumes the presence of the aliases node in the DTS to
locate the ethernet, pci and serial nodes for fixups.

Use consistent fdtaddr and fdtfile in environment variables.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
board/freescale/mpc8641hpcn/mpc8641hpcn.c
include/configs/MPC8641HPCN.h

index 931be9f375e946f5db416db438ece824f8bd6bbc..827878939d2f6f0f3bb2025ca485993dc4157381 100644 (file)
 #include <asm/immap_fsl_pci.h>
 #include <spd.h>
 #include <asm/io.h>
-
-#if defined(CONFIG_OF_FLAT_TREE)
-#include <ft_build.h>
-extern void ft_cpu_setup(void *blob, bd_t *bd);
-#endif
+#include <libfdt.h>
+#include <fdt_support.h>
 
 #include "../common/pixis.h"
 
@@ -324,36 +321,47 @@ void pci_init_board(void)
 
 }
 
-#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
+#if defined(CONFIG_OF_BOARD_SETUP)
 void
 ft_board_setup(void *blob, bd_t *bd)
 {
-       u32 *p;
-       int len;
+       int node, tmp[2];
+       const char *path;
 
-       ft_cpu_setup(blob, bd);
+       fdt_fixup_ethernet(blob, bd);
 
-       p = ft_get_prop(blob, "/memory/reg", &len);
-       if (p != NULL) {
-               *p++ = cpu_to_be32(bd->bi_memstart);
-               *p = cpu_to_be32(bd->bi_memsize);
-       }
+       do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+                            "timebase-frequency", bd->bi_busfreq / 4, 1);
+       do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+                            "bus-frequency", bd->bi_busfreq, 1);
+       do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+                            "clock-frequency", bd->bi_intfreq, 1);
+       do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
+                            "bus-frequency", bd->bi_busfreq, 1);
+
+       do_fixup_by_compat_u32(blob, "ns16550",
+                              "clock-frequency", bd->bi_busfreq, 1);
+
+       fdt_fixup_memory(blob, bd->bi_memstart, bd->bi_memsize);
+
+       node = fdt_path_offset(blob, "/aliases");
+       tmp[0] = 0;
+       if (node >= 0) {
 #ifdef CONFIG_PCI1
-       p = (u32 *)ft_get_prop(blob, "/" OF_SOC "/pcie@8000/bus-range", &len);
-       if (p != NULL) {
-               p[0] = 0;
-               p[1] = pci1_hose.last_busno - pci1_hose.first_busno;
-               debug("PCI@8000 first_busno=%d last_busno=%d\n",p[0],p[1]);
-       }
+               path = fdt_getprop(blob, node, "pci0", NULL);
+               if (path) {
+                       tmp[1] = pci1_hose.last_busno - pci1_hose.first_busno;
+                       do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
+               }
 #endif
 #ifdef CONFIG_PCI2
-       p = (u32 *)ft_get_prop(blob, "/" OF_SOC "/pcie@9000/bus-range", &len);
-       if (p != NULL) {
-               p[0] = 0;
-               p[1] = pci2_hose.last_busno - pci2_hose.first_busno;
-               debug("PCI@9000 first_busno=%d last_busno=%d\n",p[0],p[1]);
-       }
+               path = fdt_getprop(blob, node, "pci1", NULL);
+               if (path) {
+                       tmp[1] = pci2_hose.last_busno - pci2_hose.first_busno;
+                       do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
+               }
 #endif
+       }
 }
 #endif
 
index 6f8724026333015a119001749448497e729e1a63..0fc65213cce6526689de3d5d5ff54f257833507e 100644 (file)
@@ -267,13 +267,10 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 /*
  * Pass open firmware flat tree to kernel
  */
-#define CONFIG_OF_FLAT_TREE    1
-#define CONFIG_OF_BOARD_SETUP  1
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_OF_BOARD_SETUP          1
+#define CONFIG_OF_STDOUT_VIA_ALIAS     1
 
-#define OF_CPU         "PowerPC,8641@0"
-#define OF_SOC         "soc8641@f8000000"
-#define OF_TBCLK       (bd->bi_busfreq / 4)
-#define OF_STDOUT_PATH "/soc8641@f8000000/serial@4500"
 
 #define CFG_64BIT_VSPRINTF     1
 #define CFG_64BIT_STRTOUL      1
@@ -645,8 +642,8 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
    "consoledev=ttyS0\0"                                                 \
    "ramdiskaddr=2000000\0"                                             \
    "ramdiskfile=your.ramdisk.u-boot\0"                                  \
-   "dtbaddr=c00000\0"                                          \
-   "dtbfile=mpc8641_hpcn.dtb\0"                                  \
+   "fdtaddr=c00000\0"                                          \
+   "fdtfile=mpc8641_hpcn.dtb\0"                                  \
    "en-wd=mw.b f8100010 0x08; echo -expect:- 08; md.b f8100010 1\0" \
    "dis-wd=mw.b f8100010 0x00; echo -expect:- 00; md.b f8100010 1\0" \
    "maxcpus=2"
@@ -658,16 +655,16 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
       "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
       "console=$consoledev,$baudrate $othbootargs;"                     \
    "tftp $loadaddr $bootfile;"                                          \
-   "tftp $dtbaddr $dtbfile;"                                          \
-   "bootm $loadaddr - $dtbaddr"
+   "tftp $fdtaddr $fdtfile;"                                          \
+   "bootm $loadaddr - $fdtaddr"
 
 #define CONFIG_RAMBOOTCOMMAND \
    "setenv bootargs root=/dev/ram rw "                                  \
       "console=$consoledev,$baudrate $othbootargs;"                     \
    "tftp $ramdiskaddr $ramdiskfile;"                                    \
    "tftp $loadaddr $bootfile;"                                          \
-   "tftp $dtbaddr $dtbfile;"                                          \
-   "bootm $loadaddr $ramdiskaddr $dtbaddr"
+   "tftp $fdtaddr $fdtfile;"                                          \
+   "bootm $loadaddr $ramdiskaddr $fdtaddr"
 
 #define CONFIG_BOOTCOMMAND  CONFIG_NFSBOOTCOMMAND