Skip to contentSkip to conversation

mpc8260: move FDT memory node fixup into common CPU code.

PATCH New Marcel ziswiler 3 participants 5 messages Sep 4, 2009 – Sep 7, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc8260: move FDT memory node fixup into common CPU code.

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.

---
 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(-)
board/freescale/mpc8260ad renamed from board/freescale/mpc8260ads/mpc8260ads.c +0 -0

s/mpc8260ads.c
index 49a88bb..be55626 100644

board/freescale/mpc8260ads/mpc8260ads.c +0 -13
@@ -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
board/ids8247/ids8247.c +0 -16
index 79fe9da..d621833 100644
@@ -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) */
board/muas3001/muas3001.c +2 -28
index 8f83dd9..79c7a4c 100644
@@ -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");
cpu/mpc8260/cpu.c +1 -0
index 17e6248..aedbf29 100644
@@ -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 */
 
include/configs/muas3001.h +1 -0
index f031a17..22b22bd 100644
@@ -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

#1 lore raw

PATCH 1/1 mpc8260: move FDT memory node fixup into common CPU code.

Thanks for cleaning this up Marcel. I had a few comments though. Your patch appears to be line wrapped. Please use git to send the patch or configure your email client not to line-wrap.

Quoted 2 lines · Marcel ziswiler

Move the memory node fixup of the MPC8260ADS, ids8247 and muas3001 boards into common mpc8260 CPU code.

Shouldn't the mgcoge board also have the same change?

Quoted 2 lines

Remove Ethernet node fixup from muas3001 board and modify its config for the common mpc8260 code to use generic Ethernet fixup.

The board-specific ethernet modifications should be in a separate patch as that change is unrelated to the general FDT memory cleanup cleanup. Otherwise the change looks good to me.

Best,
Peter

Quoted 177 lines
---
 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(-)
board/freescale/mpc8260ad renamed from board/freescale/mpc8260ads/mpc8260ads.c +0 -0

s/mpc8260ads.c
index 49a88bb..be55626 100644

board/freescale/mpc8260ads/mpc8260ads.c +0 -13
@@ -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
board/ids8247/ids8247.c +0 -16
index 79fe9da..d621833 100644
@@ -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) */
board/muas3001/muas3001.c +2 -28
index 8f83dd9..79c7a4c 100644
@@ -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 "

board/muas3001/muas3001.c +0 -15
-                       "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 "

board/muas3001/muas3001.c +0 -4
-                       "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 "

board/muas3001/muas3001.c +0 -2
-                       "err:%s\n", fdt_strerror (nodeoffset));
-       }
 
        /* baudrate */
        nodeoffset = fdt_path_offset (blob, "/soc/cpm/serial");
cpu/mpc8260/cpu.c +1 -0
index 17e6248..aedbf29 100644
@@ -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 */
 
include/configs/muas3001.h +1 -1
index f031a17..22b22bd 100644
@@ -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

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH 1/1 mpc8260: move FDT memory node fixup into common CPU code.

In reply to Marcel ziswiler

Hello Marcel,

Quoted 4 lines · Marcel ziswiler

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.

Thanks for cleaning up, but ...

Quoted 8 lines
---
 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(-)

... I couldn;t apply your patch, because your patch is line wrapped. Can you fix your mailer?

Also, there is one more 826x based board (mgcoge) with should be fixed too, can you add this board to your patch?

TIA,

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 1/1 mpc8260: move FDT memory node fixup into common CPU code.

Hi Heiko

Quoted 2 lines · Heiko Schocher <hs <at> denx.de> writes:

... I couldn;t apply your patch, because your patch is line wrapped. Can you fix your mailer?

Sorry, obviously gmane can't be used for patch submission. Unfortunately I am not in a very Linux friendly environment right now, meaning M$ proxies and such. Trying to find a cleaner submission path will take me some time. Stay tuned.

Cheers

Marcel

#4 lore raw

PATCH 1/1 mpc8260: move FDT memory node fixup into common CPU code.

Hello Marc,

Quoted 7 lines · Marcel Ziswiler
Quoted 2 lines · Heiko Schocher <hs <at> denx.de> writes:

... I couldn;t apply your patch, because your patch is line wrapped. Can you fix your mailer?

Sorry, obviously gmane can't be used for patch submission. Unfortunately I am not in a very Linux friendly environment right now, meaning M$ proxies and such. Trying to find a cleaner submission path will take me some time. Stay tuned.

OK, and please hold me on cc:

thanks!

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany