ads5121: Added support for FDT.
authorGrzegorz Bernacki <gjb@semihalf.com>
Tue, 8 Jan 2008 16:16:15 +0000 (17:16 +0100)
committerWolfgang Denk <wd@denx.de>
Sat, 12 Jan 2008 14:36:17 +0000 (15:36 +0100)
Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
board/ads5121/ads5121.c
cpu/mpc512x/cpu.c
include/asm-ppc/u-boot.h
include/configs/ads5121.h
lib_ppc/board.c

index f275ce7de031d9838e43e9a9700d0a8babac212d..46be6a516ae4aff70343d5f32776267fadd0a0e1 100644 (file)
@@ -184,3 +184,11 @@ int checkboard (void)
                brd_rev, cpld_rev);
        return 0;
 }
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       ft_cpu_setup(blob, bd);
+       fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+}
+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
index accae6e066eb6897b3d3d5ed810e2672efab63ed..6421a511e423a49fe1d87c60c993c5f252c49e25 100644 (file)
 #include <mpc512x.h>
 #include <asm/processor.h>
 
+#if defined(CONFIG_OF_LIBFDT)
+#include <fdt_support.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 int checkcpu (void)
@@ -125,3 +129,20 @@ void watchdog_reset (void)
                enable_interrupts ();
 }
 #endif
+
+#ifdef CONFIG_OF_LIBFDT
+void ft_cpu_setup(void *blob, bd_t *bd)
+{
+       char * cpu_path = "/cpus/" OF_CPU;
+       char * eth_path = "/" OF_SOC "/ethernet@2800";
+
+       do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
+       do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
+       do_fixup_by_path_u32(blob, cpu_path, "ref-frequency", CFG_MPC512X_CLKIN, 1);
+       do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1);
+       do_fixup_by_path_u32(blob, "/" OF_SOC, "bus-frequency", bd->bi_ipsfreq, 1);
+       do_fixup_by_path_u32(blob, "/" OF_SOC, "ref-frequency", CFG_MPC512X_CLKIN, 1);
+       do_fixup_by_path(blob, eth_path, "address", bd->bi_enetaddr, 6, 0);
+       do_fixup_by_path(blob, eth_path, "local-mac-address", bd->bi_enetaddr, 6, 0);
+}
+#endif
index bd9b6f70ddacc9013173c673b7cdc8e3f0bf4be3..2b31814b6665fcd81aafc5656b0a6ff6982a126f 100644 (file)
@@ -74,6 +74,9 @@ typedef struct bd_info {
        unsigned long   bi_sccfreq;     /* SCC_CLK Freq, in MHz */
        unsigned long   bi_vco;         /* VCO Out from PLL, in MHz */
 #endif
+#if defined(CONFIG_MPC512X)
+       unsigned long   bi_ipsfreq;     /* IPS Bus Freq, in MHz */
+#endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
        unsigned long   bi_ipbfreq;     /* IPB Bus Freq, in MHz */
        unsigned long   bi_pcifreq;     /* PCI Bus Freq, in MHz */
index 58060a8c8a5a5830ebc2cdbf5945b1de3e413127..11e7e4431ef9d09e794fd6bf50ece86bf0513a82 100644 (file)
 
 #define CONFIG_BOOTCOMMAND     "run flash_self"
 
+#define CONFIG_OF_LIBFDT       1
+#define CONFIG_OF_BOARD_SETUP  1
+
+#define OF_CPU                 "PowerPC,5121@0"
+#define OF_SOC                 "soc5121@80000000"
+#define OF_TBCLK               (bd->bi_busfreq / 4)
+#define OF_STDOUT_PATH         "/soc5121@80000000/serial@11300"
+
 #endif /* __CONFIG_H */
index 071974506662559317844ebc70235069092f1f80..6350918607857a3bbb69eb0d8c7661c958ede93f 100644 (file)
@@ -555,6 +555,9 @@ void board_init_f (ulong bootflag)
        bd->bi_sccfreq = gd->scc_clk;
        bd->bi_vco     = gd->vco_out;
 #endif /* CONFIG_CPM2 */
+#if defined(CONFIG_MPC512X)
+       bd->bi_ipsfreq = gd->ipb_clk;
+#endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
        bd->bi_ipbfreq = gd->ipb_clk;
        bd->bi_pcifreq = gd->pci_clk;