[U-Boot] [PATCH][v1] mpc8260: move FDT memory node fixup into common CPU code.

Marcel ziswiler marcel at ziswiler.com
Fri Sep 4 16:37:45 CEST 2009


Move the memory node fixup of the MPC8260ADS, ids8247 and muas3001 boards into
common mpc8260 CPU code.
Remove Ethernet node fixup from muas3001 board and modify its config for the
common mpc8260 code to use generic Ethernet fixup.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler at noser.com>
---
 board/freescale/mpc8260ads/mpc8260ads.c |   13 --------
 board/ids8247/ids8247.c                 |   16 ----------
 board/muas3001/muas3001.c               |   51 +-----------------------------
 cpu/mpc8260/cpu.c                       |    1 +
 include/configs/muas3001.h              |    1 +
 5 files changed, 4 insertions(+), 78 deletions(-)

diff --git a/board/freescale/mpc8260ads/mpc8260ads.c b/board/freescale/mpc8260ad
s/mpc8260ads.c
index 49a88bb..be55626 100644
--- a/board/freescale/mpc8260ads/mpc8260ads.c
+++ b/board/freescale/mpc8260ads/mpc8260ads.c
@@ -550,24 +550,11 @@ void pci_init_board(void)
 #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/board/ids8247/ids8247.c b/board/ids8247/ids8247.c
index 79fe9da..d621833 100644
--- a/board/ids8247/ids8247.c
+++ b/board/ids8247/ids8247.c
@@ -400,24 +400,8 @@ int board_nand_init(struct nand_chip *nand)
 #endif /* CONFIG_CMD_NAND */

 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-/*
- * update "memory" property in the blob
- */
-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);
-       ft_blob_update(blob, bd);
 }
 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/muas3001/muas3001.c b/board/muas3001/muas3001.c
index 8f83dd9..79c7a4c 100644
--- a/board/muas3001/muas3001.c
+++ b/board/muas3001/muas3001.c
@@ -308,26 +308,9 @@ int board_early_init_r (void)
 void ft_blob_update (void *blob, bd_t *bd)
 {
        int ret, nodeoffset = 0;
-       ulong memory_data[2] = {0};
        ulong flash_data[4] = {0};
-       ulong freq = 0;
-       ulong   speed = 0;
+       ulong speed = 0;

-       memory_data[0] = cpu_to_be32 (bd->bi_memstart);
-       memory_data[1] = cpu_to_be32 (bd->bi_memsize);
-
-       nodeoffset = fdt_path_offset (blob, "/memory");
-       if (nodeoffset >= 0) {
-               ret = fdt_setprop (blob, nodeoffset, "reg", memory_data,
-                                       sizeof(memory_data));
-       if (ret < 0)
-               printf ("ft_blob_update): cannot set /memory/reg "
-                       "property err:%s\n", fdt_strerror (ret));
-       } else {
-               /* memory node is required in dts */
-               printf ("ft_blob_update(): cannot find /memory node "
-                       "err:%s\n", fdt_strerror(nodeoffset));
-       }
        /* update Flash addr, size */
        flash_data[2] = cpu_to_be32 (CONFIG_SYS_FLASH_BASE);
        flash_data[3] = cpu_to_be32 (CONFIG_SYS_FLASH_SIZE);
@@ -339,40 +322,10 @@ void ft_blob_update (void *blob, bd_t *bd)
                printf ("ft_blob_update): cannot set /localbus/ranges "
                        "property err:%s\n", fdt_strerror(ret));
        } else {
-               /* memory node is required in dts */
+               /* localbus node is required in dts */
                printf ("ft_blob_update(): cannot find /localbus node "
                        "err:%s\n", fdt_strerror (nodeoffset));
        }
-       /* MAC Adresse */
-       nodeoffset = fdt_path_offset (blob, "/soc/cpm/ethernet");
-       if (nodeoffset >= 0) {
-               uchar ethaddr[6];
-               eth_getenv_enetaddr("ethaddr", ethaddr);
-               ret = fdt_setprop (blob, nodeoffset, "mac-address", ethaddr,
-                                       sizeof (uchar) * 6);
-       if (ret < 0)
-               printf ("ft_blob_update): cannot set /soc/cpm/ethernet/mac-addre
ss "
-                       "property err:%s\n", fdt_strerror (ret));
-       } else {
-               /* memory node is required in dts */
-               printf ("ft_blob_update(): cannot find /soc/cpm/ethernet node "
-                       "err:%s\n", fdt_strerror (nodeoffset));
-       }
-
-       /* brg clock */
-       nodeoffset = fdt_path_offset (blob, "/soc/cpm/brg");
-       if (nodeoffset >= 0) {
-               freq = cpu_to_be32 (bd->bi_brgfreq);
-               ret = fdt_setprop (blob, nodeoffset, "clock-frequency", &freq,
-                                       sizeof (unsigned long));
-       if (ret < 0)
-               printf ("ft_blob_update): cannot set /soc/cpm/brg/clock-frequenc
y "
-                       "property err:%s\n", fdt_strerror (ret));
-       } else {
-               /* memory node is required in dts */
-               printf ("ft_blob_update(): cannot find /soc/cpm/brg/clock-freque
ncy node "
-                       "err:%s\n", fdt_strerror (nodeoffset));
-       }

        /* baudrate */
        nodeoffset = fdt_path_offset (blob, "/soc/cpm/serial");
diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c
index 17e6248..aedbf29 100644
--- a/cpu/mpc8260/cpu.c
+++ b/cpu/mpc8260/cpu.c
@@ -318,6 +318,7 @@ void ft_cpu_setup (void *blob, bd_t *bd)
                "timebase-frequency", OF_TBCLK, 1);
        do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
                "clock-frequency", bd->bi_intfreq, 1);
+       fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif /* CONFIG_OF_LIBFDT */

diff --git a/include/configs/muas3001.h b/include/configs/muas3001.h
index f031a17..22b22bd 100644
--- a/include/configs/muas3001.h
+++ b/include/configs/muas3001.h
@@ -74,6 +74,7 @@

 #define CONFIG_ETHER_INDEX     1
 #define CONFIG_ETHER_ON_FCC1
+#define CONFIG_HAS_ETH1
 #define FCC_ENET

 /*
--
1.4.4.4




More information about the U-Boot mailing list