浏览代码

fdt: ARM: Add fdtcontroladdr to set device tree address in environment

This adds support for a new environment variable called 'fdtcontroladdr'. If
defined, the hex address is used as the address of the control fdt for U-Boot.

Note: I have not changed CONFIG_PRAM section as I already have an
outstanding patch on that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 13 年之前
父节点
当前提交
eea63e05d0
共有 3 个文件被更改,包括 19 次插入0 次删除
  1. 4 0
      README
  2. 3 0
      arch/arm/lib/board.c
  3. 12 0
      doc/README.fdt-control

+ 4 - 0
README

@@ -3499,6 +3499,10 @@ List of environment variables (most likely not complete):
 		  add the information it needs into it, and the memory
 		  add the information it needs into it, and the memory
 		  must be accessible by the kernel.
 		  must be accessible by the kernel.
 
 
+  fdtcontroladdr- if set this is the address of the control flattened
+		  device tree used by U-Boot when CONFIG_OF_CONTROL is
+		  defined.
+
   i2cfast	- (PPC405GP|PPC405EP only)
   i2cfast	- (PPC405GP|PPC405EP only)
 		  if set to 'y' configures Linux I2C driver for fast
 		  if set to 'y' configures Linux I2C driver for fast
 		  mode (400kHZ). This environment variable is used in
 		  mode (400kHZ). This environment variable is used in

+ 3 - 0
arch/arm/lib/board.c

@@ -286,6 +286,9 @@ void board_init_f(ulong bootflag)
 	/* FDT is at end of image */
 	/* FDT is at end of image */
 	gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE);
 	gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE);
 #endif
 #endif
+	/* Allow the early environment to override the fdt address */
+	gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
+						(uintptr_t)gd->fdt_blob);
 
 
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 		if ((*init_fnc_ptr)() != 0) {
 		if ((*init_fnc_ptr)() != 0) {

+ 12 - 0
doc/README.fdt-control

@@ -144,6 +144,18 @@ and then flash image.bin onto your board.
 
 
 You cannot use both of these options at the same time.
 You cannot use both of these options at the same time.
 
 
+If you wish to put the fdt at a different address in memory, you can
+define the "fdtcontroladdr" environment variable. This is the hex
+address of the fdt binary blob, and will override either of the options.
+Be aware that this environment variable is checked prior to relocation,
+when only the compiled-in environment is available. Therefore it is not
+possible to define this variable in the saved SPI/NAND flash
+environment, for example (it will be ignored).
+
+To use this, put something like this in your board header file:
+
+#define CONFIG_EXTRA_ENV_SETTINGS	"fdtcontroladdr=10000\0"
+
 
 
 Limitations
 Limitations
 -----------
 -----------