From 4681e673a51c48f4c096aa3c8fae5e6217ffd58d Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Thu, 14 May 2009 23:18:34 +0200 Subject: TQM834x: add FDT support Signed-off-by: Wolfgang Denk Signed-off-by: Kim Phillips --- board/tqc/tqm834x/pci.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ board/tqc/tqm834x/tqm834x.c | 11 +++++++++++ 2 files changed, 56 insertions(+) (limited to 'board/tqc/tqm834x') diff --git a/board/tqc/tqm834x/pci.c b/board/tqc/tqm834x/pci.c index cb2cb8d32d..6c113e3db1 100644 --- a/board/tqc/tqm834x/pci.c +++ b/board/tqc/tqm834x/pci.c @@ -24,7 +24,15 @@ #include #include +#include #include +#include +#if defined(CONFIG_OF_LIBFDT) +#include +#include +#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 */ diff --git a/board/tqc/tqm834x/tqm834x.c b/board/tqc/tqm834x/tqm834x.c index 106cac2448..4fd8cd6969 100644 --- a/board/tqc/tqm834x/tqm834x.c +++ b/board/tqc/tqm834x/tqm834x.c @@ -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 */ -- cgit v1.2.1