Skip to contentSkip to conversation

5xxx, fdt: move fdt_fixup_memory() to cpu.c file

RFC PATCH New Heiko Schocher 2 participants 5 messages Dec 3, 2009 – Dec 8, 2009

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 5xxx, fdt: move fdt_fixup_memory() to cpu.c file

u-boot updates, before starting Linux, the memory node in the DTS. As this is a "standard" feature, move this functionality to the cpu.c file for mpc5xxx and mpc512x processors.

---

based against git://git.denx.de/u-boot.git next

 board/cm5200/cm5200.c                   |    7 -------
 board/davedenx/aria/aria.c              |    1 -
 board/esd/mecp5123/mecp5123.c           |    1 -
 board/freescale/mpc5121ads/mpc5121ads.c |    1 -
 board/matrix_vision/mvbc_p/mvbc_p.c     |    1 -
 board/mucmc52/mucmc52.c                 |    1 -
 board/tqc/tqm5200/tqm5200.c             |    1 -
 board/uc101/uc101.c                     |    1 -
 cpu/mpc512x/cpu.c                       |    1 +
 cpu/mpc5xxx/cpu.c                       |    1 +
 10 files changed, 2 insertions(+), 14 deletions(-)
board/cm5200/cm5200.c +0 -7
index 9e2f1a5..33bf9c4 100644
@@ -271,13 +271,6 @@ static void ft_blob_update(void *blob, bd_t *bd)
 	if (ret < 0)
 	printf("ft_blob_update(): cannot set /model property err:%s\n",
 		fdt_strerror(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));
-	}
 }
 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
 
board/davedenx/aria/aria.c +0 -1
index cc69c9d..f17df60 100644
@@ -196,6 +196,5 @@ int checkboard (void)
 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) */
board/esd/mecp5123/mecp5123.c +0 -1
index 5139358..748ad7c 100644
@@ -273,6 +273,5 @@ int checkboard(void)
 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) */
board/freescale/mpc5121ads/mpc5121ads.c +0 -1
index 2fa3650..2e13ea8 100644
@@ -350,6 +350,5 @@ int checkboard (void)
 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) */
board/matrix_vision/mvbc_p/mvbc_p.c +0 -1
index 0cbe900..4392176 100644
@@ -262,7 +262,6 @@ void show_boot_progress(int val)
 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);
 }
 
 int board_eth_init(bd_t *bis)
board/mucmc52/mucmc52.c +0 -1
index b4ed735..66973f0 100644
@@ -404,6 +404,5 @@ void pci_init_board (void)
 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) */
board/tqc/tqm5200/tqm5200.c +0 -1
index 5a091c4..d90bae8 100644
@@ -745,7 +745,6 @@ int board_get_height (void)
 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) */
 
board/uc101/uc101.c +0 -1
index 1485c02..c7dfb7b 100644
@@ -377,6 +377,5 @@ void hw_watchdog_reset(void)
 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) */
cpu/mpc512x/cpu.c +1 -0
index 42ccd81..dac48db 100644
@@ -197,6 +197,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_HAS_ETH0
 	fdt_fixup_ethernet(blob);
 #endif
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif
 
cpu/mpc5xxx/cpu.c +1 -0
index efa64c7..2a28df4 100644
@@ -157,6 +157,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	}
 
 #endif
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif
 
Signature · 5 lines
1.6.2.5

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

RFC PATCH 1/1 5xxx, fdt: move fdt_fixup_memory() to cpu.c file

Dear Heiko Schocher,

Quoted 5 lines · In message <[email protected]> you wrote:

u-boot updates, before starting Linux, the memory node in the DTS. As this is a "standard" feature, move this functionality to the cpu.c file for mpc5xxx and mpc512x processors.

I generally agree with this patch, but...

board/cm5200/cm5200.c static void ft_blob_update(void *blob, bd_t *bd) · line 280

Quoted 13 lines
board/cm5200/cm5200.c +0 -7
@@ -271,13 +271,6 @@ static void ft_blob_update(void *blob, bd_t *bd)
 	if (ret < 0)
 	printf("ft_blob_update(): cannot set /model property err:%s\n",
 		fdt_strerror(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));
-	}

Here we do some error checking, which is always a Good Thing (TM).

Quoted 17 lines
cpu/mpc512x/cpu.c +1 -0
index 42ccd81..dac48db 100644
@@ -197,6 +197,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_HAS_ETH0
 	fdt_fixup_ethernet(blob);
 #endif
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif
 
cpu/mpc5xxx/cpu.c +0 -0
index efa64c7..2a28df4 100644

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 162

Quoted 6 lines
cpu/mpc5xxx/cpu.c +1 -0
@@ -157,6 +157,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	}
 
 #endif
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif

May I suggest to add the same error checking in these two files, then?

Thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds."
                                                 -- J. Finnegan, USC.
#2 lore raw

RFC PATCH 1/1 5xxx, fdt: move fdt_fixup_memory() to cpu.c file

Hello Wolfgang,

Quoted 9 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:

u-boot updates, before starting Linux, the memory node in the DTS. As this is a "standard" feature, move this functionality to the cpu.c file for mpc5xxx and mpc512x processors.

I generally agree with this patch, but...

Quoted 15 lines

board/cm5200/cm5200.c static void ft_blob_update(void *blob, bd_t *bd) · line 280

Quoted 13 lines
board/cm5200/cm5200.c +0 -7
@@ -271,13 +271,6 @@ static void ft_blob_update(void *blob, bd_t *bd)
 	if (ret < 0)
 	printf("ft_blob_update(): cannot set /model property err:%s\n",
 		fdt_strerror(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));
-	}

Here we do some error checking, which is always a Good Thing (TM).

Yep!

Quoted 19 lines
Quoted 19 lines
cpu/mpc512x/cpu.c +1 -0
index 42ccd81..dac48db 100644
@@ -197,6 +197,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_HAS_ETH0
 	fdt_fixup_ethernet(blob);
 #endif
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif
 
cpu/mpc5xxx/cpu.c +0 -0
index efa64c7..2a28df4 100644
@@ -157,6 +157,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	}
 
Quoted 6 lines

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 162

Quoted 4 lines
cpu/mpc5xxx/cpu.c +1 -0
 #endif
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
 #endif

May I suggest to add the same error checking in these two files, then?

Hmm.. fdt_fixup_memory() does this error checking (Also in a much stricter way, than in the board code). So I think, this is not necessary here ...

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

RFC PATCH 1/1 5xxx, fdt: move fdt_fixup_memory() to cpu.c file

Dear Heiko Schocher,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 2 lines

May I suggest to add the same error checking in these two files, then?

Hmm.. fdt_fixup_memory() does this error checking (Also in a much stricter way, than in the board code). So I think, this is not necessary here ...

Ah, ok. Thanks for the explanation.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Lead me not into temptation... I can find it myself.
#4 lore raw

RFC PATCH 1/1 5xxx, fdt: move fdt_fixup_memory() to cpu.c file

In reply to Heiko Schocher

Dear Heiko Schocher,

Quoted 9 lines · In message <[email protected]> you wrote:

u-boot updates, before starting Linux, the memory node in the DTS. As this is a "standard" feature, move this functionality to the cpu.c file for mpc5xxx and mpc512x processors.

---

based against git://git.denx.de/u-boot.git next

Quoted 11 lines
 board/cm5200/cm5200.c                   |    7 -------
 board/davedenx/aria/aria.c              |    1 -
 board/esd/mecp5123/mecp5123.c           |    1 -
 board/freescale/mpc5121ads/mpc5121ads.c |    1 -
 board/matrix_vision/mvbc_p/mvbc_p.c     |    1 -
 board/mucmc52/mucmc52.c                 |    1 -
 board/tqc/tqm5200/tqm5200.c             |    1 -
 board/uc101/uc101.c                     |    1 -
 cpu/mpc512x/cpu.c                       |    1 +
 cpu/mpc5xxx/cpu.c                       |    1 +
 10 files changed, 2 insertions(+), 14 deletions(-)

Applied to "next" branch, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Genius doesn't work on an assembly line basis.  You can't simply say,
"Today I will be brilliant."
	-- Kirk, "The Ultimate Computer", stardate 4731.3