diff options
author | Jon Loeliger <jdl@freescale.com> | 2007-11-28 14:47:18 -0600 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2008-01-03 10:27:03 -0600 |
commit | ea9f7395ec362584e5e4f266bd0b0c4422cf6a4c (patch) | |
tree | 21fb6a249ae56147fd3f16f2430704bfe53977e4 /board/freescale/mpc8641hpcn | |
parent | 2c3536425d987bf079258973e2acebaaef3e16b6 (diff) | |
download | u-boot-imx-ea9f7395ec362584e5e4f266bd0b0c4422cf6a4c.zip u-boot-imx-ea9f7395ec362584e5e4f266bd0b0c4422cf6a4c.tar.gz u-boot-imx-ea9f7395ec362584e5e4f266bd0b0c4422cf6a4c.tar.bz2 |
Convert MPC8641HPCN to use libfdt.
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>
Diffstat (limited to 'board/freescale/mpc8641hpcn')
-rw-r--r-- | board/freescale/mpc8641hpcn/mpc8641hpcn.c | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c index 931be9f..8278789 100644 --- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c +++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c @@ -27,11 +27,8 @@ #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 |