Skip to contentSkip to conversation

fdt: add common memory fixup function

PATCH New Martin Krause 5 participants 13 messages Oct 25, 2007 – Oct 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: add common memory fixup function

Add the function fdt_memory() to fixup the /memory node of the fdt with the memory values detected by U-Boot (bd->bi_memstart and bd->bi_memsize).

To activate this feature CONFIG_OF_MEMORY_FIXUP has to be defined in the board config file.

---
The patch was tested on the TQM5200 board. Any comments are welcome!

Best Regards,
Martin Krause

 common/cmd_bootm.c        |    7 +++++++
 common/fdt_support.c      |   44 ++++++++++++++++++++++++++++++++++++++++++++
 include/configs/TQM5200.h |    1 +
 include/fdt_support.h     |    4 ++++
 4 files changed, 56 insertions(+), 0 deletions(-)
common/cmd_bootm.c +7 -0
index d816349..fe9f9bc 100644
@@ -992,6 +992,13 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 			do_reset (cmdtp, flag, argc, argv);
 		}
 #endif
+#ifdef CONFIG_OF_MEMORY_FIXUP
+		if (fdt_memory(of_flat_tree) < 0) {
+			puts ("ERROR: /memory node create failed - "
+				"must RESET the board to recover.\n");
+			do_reset (cmdtp, flag, argc, argv);
+		}
+#endif
 #ifdef CONFIG_OF_BOARD_SETUP
 		/* Call the board-specific fixup routine */
 		ft_board_setup(of_flat_tree, gd->bd);
common/fdt_support.c +44 -0

48 lines not on this page · raw message

include/configs/TQM5200.h +1 -0
index 8076e70..59b8cff 100644
@@ -727,6 +727,7 @@
  */
 #define CONFIG_OF_LIBFDT	1
 #define CONFIG_OF_BOARD_SETUP	1
+#define CONFIG_OF_MEMORY_FIXUP	1
 
 #define OF_CPU			"PowerPC,5200 at 0"
 #define OF_SOC			"soc5200@f0000000"
include/fdt_support.h +4 -0
index 60fa423..92766f3 100644
@@ -38,6 +38,10 @@ int fdt_env(void *fdt);
 int fdt_bd_t(void *fdt);
 #endif
 
+#ifdef CONFIG_OF_MEMORY_FIXUP
+int fdt_memory(void *fdt);
+#endif
+
 #ifdef CONFIG_OF_BOARD_SETUP
 void ft_board_setup(void *blob, bd_t *bd);
 void ft_cpu_setup(void *blob, bd_t *bd);
#1 lore raw

PATCH 1/1 fdt: add common memory fixup function

Quoted 7 lines · Martin Krause

Add the function fdt_memory() to fixup the /memory node of the fdt with the memory values detected by U-Boot (bd->bi_memstart and bd->bi_memsize).

To activate this feature CONFIG_OF_MEMORY_FIXUP has to be defined in the board config file.

Quoted 6 lines

---
The patch was tested on the TQM5200 board. Any comments are welcome!

Best Regards,
Martin Krause

Thanks for the patches, Martin and Kumar. I should be able to make progress on fdt improvements this weekend and next week.

Best regards,
gvb

#2 lore raw

PATCH 1/1 fdt: add common memory fixup function

Quoted 12 lines · Jerry Van Baren
Quoted 10 lines · Martin Krause

Add the function fdt_memory() to fixup the /memory node of the fdt with the memory values detected by U-Boot (bd->bi_memstart and bd->bi_memsize).
To activate this feature CONFIG_OF_MEMORY_FIXUP has to be defined in the board config file.

---
The patch was tested on the TQM5200 board. Any comments are welcome! Best Regards,
Martin Krause

Quoted 2 lines

Thanks for the patches, Martin and Kumar. I should be able to make progress on fdt improvements this weekend and next week.

Great, I've got a set of patches for using new libfdt, but I might put them in a git tree since the libfdt import is big and difficult to post to the list.

- k

#3 lore raw

PATCH 1/1 fdt: add common memory fixup function

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

Great, I've got a set of patches for using new libfdt, but I might put them in a git tree since the libfdt import is big and difficult to post to the list.

You git tree will be likely ignored if you don't post the patches.

Best regards,

Wolfgang Denk

Signature · 7 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
: 1.  What is the possibility of this being added in the future?
In the near future, the probability is close to zero. In the  distant
future, I'll be dead, and posterity can do whatever they like... :-)
                                                              - lwall
#4 lore raw

PATCH 1/1 fdt: add common memory fixup function

Quoted 8 lines · Wolfgang Denk

In message

Quoted 4 lines · <[email protected]> you wrote:

Great, I've got a set of patches for using new libfdt, but I might put them in a git tree since the libfdt import is big and difficult to post to the list.

You git tree will be likely ignored if you don't post the patches.

I've posted two of the the three patches in my tree.

Any suggestions on how to deal with the third, its beyond the size limit for the list?

- k

#5 lore raw

PATCH 1/1 fdt: add common memory fixup function

Dear Kumar,

Quoted 3 lines · in message <[email protected]> you wrote:

Any suggestions on how to deal with the third, its beyond the size limit for the list?

Please see http://www.denx.de/wiki/UBoot/Patches , bullet 9.

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
"What is wanted is not the will to believe, but the will to find out,
which is the exact opposite." - Bertrand Russell, _Sceptical_Essays_,
1928
#6 lore raw

PATCH 1/1 fdt: add common memory fixup function

In reply to Kumar Gala
Quoted 7 lines · Kumar Gala
Quoted 5 lines · Wolfgang Denk

In message

Quoted 3 lines · <[email protected]> you wrote:

Great, I've got a set of patches for using new libfdt, but I might put them in a git tree since the libfdt import is big and difficult to post to the list.

Quoted 8 lines
Quoted 1 line

You git tree will be likely ignored if you don't post the patches.

I've posted two of the the three patches in my tree.

Any suggestions on how to deal with the third, its beyond the size limit for the list?

- k

Hi Kumar,

Individually, the files will fit through the list. Based on sizes, even if the patches blow up to 2x the current file size, they should still fit through the list.

$ ls -l
total 88
-rw-r--r-- 1 vanbaren users  4572 2007-10-26 07:18 fdt.c
-rw-r--r-- 1 vanbaren users  1691 2007-10-26 07:18 fdt.h
-rw-r--r-- 1 vanbaren users 12281 2007-10-26 07:18 fdt_ro.c
-rw-r--r-- 1 vanbaren users  9621 2007-10-26 07:18 fdt_rw.c
-rw-r--r-- 1 vanbaren users  3321 2007-10-26 07:18 fdt_strerror.c
-rw-r--r-- 1 vanbaren users  7087 2007-10-26 07:18 fdt_sw.c
-rw-r--r-- 1 vanbaren users  4048 2007-10-26 07:18 fdt_wip.c
-rw-r--r-- 1 vanbaren users   502 2007-10-26 07:18 libfdt_env.h
-rw-r--r-- 1 vanbaren users 17522 2007-10-26 07:18 libfdt.h
-rw-r--r-- 1 vanbaren users  3520 2007-10-26 07:18 libfdt_internal.h
-rw-r--r-- 1 vanbaren users   436 2007-10-26 07:18 Makefile.libfdt
-rw-r--r-- 1 vanbaren users   142 2007-10-26 07:18 TODO

Best regards,
gvb

#7 lore raw

PATCH 1/1 fdt: add common memory fixup function

Quoted 23 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Wolfgang Denk

In message <[email protected]> you wrote:

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Great, I've got a set of patches for using new libfdt, but I might put them in a git tree since the libfdt import is big and difficult to post to the list.

You git tree will be likely ignored if you don't post the patches.

I've posted two of the the three patches in my tree. Any suggestions on how to deal with the third, its beyond the size limit for the list?
- k

Hi Kumar,

Individually, the files will fit through the list. Based on sizes, even if the patches blow up to 2x the current file size, they should still fit through the list.

$ ls -l
total 88
(quoted diff) +0 -2
-rw-r--r-- 1 vanbaren users  4572 2007-10-26 07:18 fdt.c
-rw-r--r-- 1 vanbaren users  1691 2007-10-26 07:18 fdt.h

Review

Quoted 10 lines
(quoted diff) +0 -10
-rw-r--r-- 1 vanbaren users 12281 2007-10-26 07:18 fdt_ro.c
-rw-r--r-- 1 vanbaren users  9621 2007-10-26 07:18 fdt_rw.c
-rw-r--r-- 1 vanbaren users  3321 2007-10-26 07:18 fdt_strerror.c
-rw-r--r-- 1 vanbaren users  7087 2007-10-26 07:18 fdt_sw.c
-rw-r--r-- 1 vanbaren users  4048 2007-10-26 07:18 fdt_wip.c
-rw-r--r-- 1 vanbaren users   502 2007-10-26 07:18 libfdt_env.h
-rw-r--r-- 1 vanbaren users 17522 2007-10-26 07:18 libfdt.h
-rw-r--r-- 1 vanbaren users  3520 2007-10-26 07:18 libfdt_internal.h
-rw-r--r-- 1 vanbaren users   436 2007-10-26 07:18 Makefile.libfdt
-rw-r--r-- 1 vanbaren users   142 2007-10-26 07:18 TODO

Agreed, I was trying to avoid splitting into multiple patches/commits so we didn't have a build breakage if one did a git-bisect in the future.

- k

#8 lore raw

PATCH 1/1 fdt: add common memory fixup function

In reply to Martin Krause
Quoted 3 lines · On Thu, 25 Oct 2007 15:43:27 +0200 Martin Krause <[email protected]> wrote:

+#define CONFIG_OF_MEMORY_FIXUP 1

is it possible to consolidate the memory fixup code config into an existing CONFIG, such as libfdt's or OF_BOARD_SETUP, instead of making a new one?

also, will you be updating the other boards/platforms?

Kim

#9 lore raw

PATCH 1/1 fdt: add common memory fixup function

Kim Phillips wrote on Thursday, October 25, 2007 4:39 PM:

Quoted 9 lines
Quoted 3 lines · On Thu, 25 Oct 2007 15:43:27 +0200 Martin Krause <[email protected]> wrote:

+#define CONFIG_OF_MEMORY_FIXUP 1

is it possible to consolidate the memory fixup code config into an existing CONFIG, such as libfdt's or OF_BOARD_SETUP, instead of making a new one?

Yes, I can change this. But then all boards wich have OF_BOARD_SETUP defined, will use the new global memory fixup function. Currently not all boards which define OF_BOARD_SETUP do already a memory fixup. This boards would be forced to the fixup. Don't know, if this would be OK or could lead to some unwanted side effects (one propably would be an enlarged footprint of the resulting u-boot binary).

Quoted 1 line

also, will you be updating the other boards/platforms?

Yes, I can create a patch. I didn't do this yet, because I wasn't sure if the change would be accepted at all.

Best Regards,
Martin Krause

#10 lore raw

PATCH 1/1 fdt: add common memory fixup function

In reply to Martin Krause
Quoted 6 lines · Martin Krause

Add the function fdt_memory() to fixup the /memory node of the fdt with the memory values detected by U-Boot (bd->bi_memstart and bd->bi_memsize).

To activate this feature CONFIG_OF_MEMORY_FIXUP has to be defined in the board config file.

Any reason we should even bother with a CONFIG for this?

- k

#11 lore raw

PATCH 1/1 fdt: add common memory fixup function

Kumar Gala wrote on Thursday, October 25, 2007 5:06 PM:

Quoted 10 lines · Martin Krause
Quoted 7 lines

Add the function fdt_memory() to fixup the /memory node of the fdt with the memory values detected by U-Boot (bd->bi_memstart and bd->bi_memsize).

To activate this feature CONFIG_OF_MEMORY_FIXUP has to be defined in the board config file.

Any reason we should even bother with a CONFIG for this?

Then the memory fixup will be done on _all_ boards using OF_LIBFDT. If no one raises his hand, not to do this, I'll create a patch (which will remove the boardspecific memory fixup code from all boards already doing a memory fixup and switch them to the global fixup).

Best Regards,
Martin Krause

#12 lore raw

PATCH 1/1 fdt: add common memory fixup function

Quoted 10 lines · On Thu, 25 Oct 2007 17:57:10 +0200 "Martin Krause" <[email protected]> wrote:

Kumar Gala wrote on Thursday, October 25, 2007 5:06 PM:

Quoted 9 lines · Martin Krause
Quoted 7 lines

Add the function fdt_memory() to fixup the /memory node of the fdt with the memory values detected by U-Boot (bd->bi_memstart and bd->bi_memsize).

To activate this feature CONFIG_OF_MEMORY_FIXUP has to be defined in the board config file.

Quoted 6 lines
Quoted 1 line

Any reason we should even bother with a CONFIG for this?

Then the memory fixup will be done on _all_ boards using OF_LIBFDT. If no one raises his hand, not to do this, I'll create a patch (which will remove the boardspecific memory fixup code from all boards already doing a memory fixup and switch them to the global fixup).

Hi Martin, this is what I was alluding to in the other thread. My hand is down :).

Kim