[U-Boot-Users] [PATCH] FDT memory and pci node fixes for MPC8260ADS
Matvejchikov Ilya
matvejchikov at gmail.com
Sat Jun 7 15:10:45 CEST 2008
>From 3c7a1b900ab7b473fed62398fc76a16fa9c5940a Mon Sep 17 00:00:00 2001
From: Matvejchikov Ilya <ilya at westend.(none)>
Date: Sat, 7 Jun 2008 16:57:14 +0400
Subject: [PATCH] FDT memory and pci fixes for MPC8260ADS
Signed-off-by: Matvejchikov Ilya <ilya at westend.(none)>
---
board/freescale/mpc8260ads/mpc8260ads.c | 27 +++++++++++++++++++++++++++
cpu/mpc8260/pci.c | 12 ++++++++++++
include/configs/MPC8260ADS.h | 7 +++++++
3 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/board/freescale/mpc8260ads/mpc8260ads.c
b/board/freescale/mpc8260ads/mpc8260ads.c
index 93550e2..44a68fe 100644
--- a/board/freescale/mpc8260ads/mpc8260ads.c
+++ b/board/freescale/mpc8260ads/mpc8260ads.c
@@ -46,6 +46,10 @@
#ifdef CONFIG_PCI
#include <pci.h>
#endif
+#ifdef CONFIG_OF_LIBFDT
+#include <libfdt.h>
+#include <fdt_support.h>
+#endif
/*
* I/O Port configuration table
@@ -544,3 +548,26 @@ void pci_init_board(void)
pci_mpc8250_init(&hose);
}
#endif
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_blob_update(void *blob, bd_t *bd)
+{
+ int ret;
+
+ ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+
+ if (ret < 0) {
+ printf("ft_blob_update(): cannot set /memory/reg "
+ "property err:%s\n", fdt_strerror(ret));
+ }
+}
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+ ft_cpu_setup(blob, bd);
+#ifdef CONFIG_PCI
+ ft_pci_setup(blob, bd);
+#endif
+ ft_blob_update(blob, bd);
+}
+#endif
diff --git a/cpu/mpc8260/pci.c b/cpu/mpc8260/pci.c
index 75c6ab2..940f5c0 100644
--- a/cpu/mpc8260/pci.c
+++ b/cpu/mpc8260/pci.c
@@ -33,6 +33,10 @@
#include <mpc8260.h>
#include <asm/m8260_pci.h>
#include <asm/io.h>
+#ifdef CONFIG_OF_LIBFDT
+#include <libfdt.h>
+#include <fdt_support.h>
+#endif
#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 || defined CONFIG_PM826
DECLARE_GLOBAL_DATA_PTR;
@@ -449,4 +453,12 @@ void pci_mpc8250_init (struct pci_controller *hose)
immap->im_pci.pci_emr |= cpu_to_le32 (PCI_ERROR_PCI_NO_RSP);
}
+#if defined(CONFIG_OF_LIBFDT)
+void ft_pci_setup(void *blob, bd_t *bd)
+{
+ do_fixup_by_prop_u32(blob, "device_type", "pci", 4,
+ "clock-frequency", bd->pci_clk, 1);
+}
+#endif
+
#endif /* CONFIG_PCI */
diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h
index 23508f9..59d0bdb 100644
--- a/include/configs/MPC8260ADS.h
+++ b/include/configs/MPC8260ADS.h
@@ -197,6 +197,13 @@
#define CONFIG_BAUDRATE 115200
+#define CONFIG_OF_LIBFDT 1
+#define CONFIG_OF_BOARD_SETUP 1
+#if defined(CONFIG_OF_LIBFDT)
+#define OF_CPU "cpu at 0"
+#define OF_TBCLK (bd->bi_busfreq / 4)
+#endif
+
/*
* BOOTP options
*/
--
1.5.3.7
More information about the U-Boot
mailing list