Skip to contentSkip to conversation

fdt: Allow indicating a node is for U-Boot proper only

PATCH Superseded Patrick Delaunay 2 participants 10 messages May 21, 2019 – Jun 28, 2019 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

v3 cover fdt: Allow indicating a node is for U-Boot proper only

Hi,

I create this serie with:

1/ documentation update for previous patch
[U-Boot,v2] dm: remove pre reloc properties in SPL and TPL device tree
http://patchwork.ozlabs.org/patch/1081155/

PS: Code is already merged in commit commit c7a88dae997f ("dm: remove
pre reloc properties in SPL and TPL device tree")
but not the documentation.

2/ missing part for v1 serie (patch 1/2)
http://patchwork.ozlabs.org/project/uboot/list/?series=89846
=> http://patchwork.ozlabs.org/patch/1035797

3/ new tests for pre-reloc propertie in SPL as suggested by Simon
(http://patchwork.ozlabs.org/patch/1081155/#2156621)

Regards
Patrick

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb
- rebase on u-boot-dm/sandbox-working

Changes in v2:
- rebase on master

Patrick Delaunay (3):
test: check u-boot properties in SPL device tree
fdt: Allow indicating a node is for U-Boot proper only
dm: doc: add documentation for pre-reloc properties in SPL and TPL

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 doc/README.SPL                   | 16 ++++++++++++++++
 doc/README.TPL                   |  4 ++++
 doc/driver-model/README.txt      |  4 ++++
 drivers/core/util.c              |  2 ++
 drivers/video/video-uclass.c     |  4 +++-
 include/dm/ofnode.h              |  6 ++++--
 include/dm/util.h                |  6 ++++--
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 9 files changed, 83 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/3 test: check u-boot properties in SPL device tree

Add a test to check the management of the U-boot relocation properties for device tree SPL generation (fdtgrep result) and platdata:
- 'dm-pre-proper' and 'dm-tpl' not included in SPL
- 'dm-pre-reloc' and 'dm-spl' included in SPL

---

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb

Changes in v2: None

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
arch/sandbox/dts/sandbox.dtsi +18 -0
index 2fb365d..c6d5650 100644
@@ -192,6 +192,24 @@
 		compatible = "sandbox,spl-test.2";
 	};
 
+	spl-test5 {
+		u-boot,dm-tpl;
+		compatible = "sandbox,spl-test";
+		stringarray = "tpl";
+	};
+
+	spl-test6 {
+		u-boot,dm-pre-proper;
+		compatible = "sandbox,spl-test";
+		stringarray = "pre-proper";
+	};
+
+	spl-test7 {
+		u-boot,dm-spl;
+		compatible = "sandbox,spl-test";
+		stringarray = "spl";
+	};
+
 	square {
 		compatible = "demo-shape";
 		colour = "blue";
test/py/tests/test_ofplatdata.py +28 -0
index 98103ee..263334b 100644
@@ -2,6 +2,7 @@
 # Copyright (c) 2016 Google, Inc
 
 import pytest
+import u_boot_utils as util
 
 OF_PLATDATA_OUTPUT = '''
 of-platdata probe:
@@ -31,6 +32,15 @@ intarray 0 0 0 0
 longbytearray 00 00 00 00 00 00 00 00 00
 string <NULL>
 stringarray "one" "" ""
+of-platdata probe:
+bool 0
+byte 00
+bytearray 00 00 00
+int 0
+intarray 0 0 0 0
+longbytearray 00 00 00 00 00 00 00 00 00
+string <NULL>
+stringarray "spl" "" ""
 '''
 
 @pytest.mark.buildconfigspec('spl_of_platdata')
@@ -40,3 +50,21 @@ def test_ofplatdata(u_boot_console):
     cons.restart_uboot_with_flags(['--show_of_platdata'])
     output = cons.get_spawn_output().replace('\r', '')
     assert OF_PLATDATA_OUTPUT in output
+
+ at pytest.mark.buildconfigspec('spl_of_platdata')
+def test_spl_devicetree(u_boot_console):
+    """Test content of spl device-tree"""
+    cons = u_boot_console
+    dtb = cons.config.build_dir + '/spl/u-boot-spl.dtb'
+    fdtgrep = cons.config.build_dir + '/tools/fdtgrep'
+    output = util.run_and_log(cons, [fdtgrep, '-l', dtb])
+
+    assert "u-boot,dm-pre-reloc" not in output
+    assert "u-boot,dm-pre-proper" not in output
+    assert "u-boot,dm-spl" not in output
+    assert "u-boot,dm-tpl" not in output
+
+    assert "spl-test4" in output
+    assert "spl-test5" not in output
+    assert "spl-test6" not in output
+    assert "spl-test7" in output
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 1/3 test: check u-boot properties in SPL device tree

Quoted 9 lines · Patrick Delaunay

Add a test to check the management of the U-boot relocation properties for device tree SPL generation (fdtgrep result) and platdata:
- 'dm-pre-proper' and 'dm-tpl' not included in SPL
- 'dm-pre-reloc' and 'dm-spl' included in SPL

---

Quoted 8 lines

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb

Changes in v2: None

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
#3 lore raw

PATCH v3 1/3 test: check u-boot properties in SPL device tree

Quoted 14 lines · Simon Glass
Quoted 12 lines · Patrick Delaunay

Add a test to check the management of the U-boot relocation properties for device tree SPL generation (fdtgrep result) and platdata:
- 'dm-pre-proper' and 'dm-tpl' not included in SPL
- 'dm-pre-reloc' and 'dm-spl' included in SPL

---

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb

Quoted 7 lines
Quoted 5 lines

Changes in v2: None

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

Applied to u-boot-dm/next, thanks!

#4 lore raw

PATCH v3 2/3 fdt: Allow indicating a node is for U-Boot proper only

In reply to Patrick Delaunay

This add missing parts for previous commit 06f94461a9f4 ("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before relocation (in U-Boot proper) without it also ending up in SPL and TPL device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

---

Changes in v3: None
Changes in v2: None

 drivers/core/util.c          | 2 ++
 drivers/video/video-uclass.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/core/util.c +2 -0
index 96e47dc..60b939a 100644
@@ -42,6 +42,8 @@ bool dm_ofnode_pre_reloc(ofnode node)
 #else
 	if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
 		return true;
+	if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
+		return true;
 
 	/*
 	 * In regular builds individual spl and tpl handling both
drivers/video/video-uclass.c +3 -1
index 14aac88..d922e53 100644
@@ -291,7 +291,9 @@ static int video_post_bind(struct udevice *dev)
 		return 0;
 	size = alloc_fb(dev, &addr);
 	if (addr < gd->video_bottom) {
-		/* Device tree node may need the 'u-boot,dm-pre-reloc' tag */
+		/* Device tree node may need the 'u-boot,dm-pre-reloc' or
+		 * 'u-boot,dm-pre-proper' tag
+		 */
 		printf("Video device '%s' cannot allocate frame buffer memory -ensure the device is set up before relocation\n",
 		       dev->name);
 		return -ENOSPC;
Signature · 1 line
2.7.4
#5 lore raw

PATCH v3 3/3 dm: doc: add documentation for pre-reloc properties in SPL and TPL

In reply to Patrick Delaunay

Add documentation for the pre-reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-proper
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl

---

Changes in v3:
- rebase on u-boot-dm/sandbox-working

Changes in v2:
- rebase on master

 doc/README.SPL              | 16 ++++++++++++++++
 doc/README.TPL              |  4 ++++
 doc/driver-model/README.txt |  4 ++++
 include/dm/ofnode.h         |  6 ++++--
 include/dm/util.h           |  6 ++++--
 5 files changed, 32 insertions(+), 4 deletions(-)
doc/README.SPL +16 -0
index 7a30fef..6eed83f 100644
@@ -66,6 +66,22 @@ CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o)
 CONFIG_SPL_RAM_DEVICE (common/spl/spl.c)
 CONFIG_SPL_WATCHDOG_SUPPORT (drivers/watchdog/libwatchdog.o)
 
+Device tree
+-----------
+The U-Boot device tree is filtered by the fdtgrep tools during the build
+process to generate a much smaller device tree used in SPL (spl/u-boot-spl.dtb)
+with:
+- the mandatory nodes (/alias, /chosen, /config)
+- the nodes with one pre-relocation property:
+  'u-boot,dm-pre-reloc' or 'u-boot,dm-spl'
+
+ftgrep is also used to remove:
+- the properties defined in CONFIG_OF_SPL_REMOVE_PROPS
+- all the pre-relocation properties
+  ('u-boot,dm-pre-reloc', 'u-boot,dm-spl' and 'u-boot,dm-tpl')
+
+All the nodes remaining in the SPL devicetree are bound
+(see driver-model/README.txt).
 
 Debugging
 ---------
doc/README.TPL +4 -0
index 980debe..c94129f 100644
@@ -34,6 +34,10 @@ determine which SPL options to choose based on whether CONFIG_TPL_BUILD
 is set. Source files can be compiled for TPL with options choosed in the
 board config file.
 
+TPL use a small device tree (u-boot-tpl.dtb), containing only the nodes with
+the pre-relocation properties: 'u-boot,dm-pre-reloc' and 'u-boot,dm-tpl'
+(see README.SPL for details).
+
 For example:
 
 spl/Makefile:
doc/driver-model/README.txt +4 -0
index 07b120d..532a771 100644
@@ -849,6 +849,10 @@ in the device tree node. For U-Boot proper you can use 'u-boot,dm-pre-proper'
 which means that it will be processed (and a driver bound) in U-Boot proper
 prior to relocation, but will not be available in SPL or TPL.
 
+To reduce the size of SPL and TPL, only the nodes with pre-relocation properties
+('u-boot,dm-pre-reloc', 'u-boot,dm-spl' or 'u-boot,dm-tpl') are keept in their
+device trees (see README.SPL for details); the remaining nodes are always bound.
+
 Then post relocation we throw that away and re-init driver model again.
 For drivers which require some sort of continuity between pre- and
 post-relocation devices, we can provide access to the pre-relocation
include/dm/ofnode.h +4 -2
index d206ee2..b45da5e 100644
@@ -662,12 +662,14 @@ int ofnode_read_simple_size_cells(ofnode node);
  * After relocation and jumping into the real U-Boot binary it is possible to
  * determine if a node was bound in one of SPL/TPL stages.
  *
- * There are 3 settings currently in use
- * -
+ * There are 4 settings currently in use
+ * - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
  * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
  *   Existing platforms only use it to indicate nodes needed in
  *   SPL. Should probably be replaced by u-boot,dm-spl for
  *   new platforms.
+ * - u-boot,dm-spl: SPL and U-Boot pre-relocation
+ * - u-boot,dm-tpl: TPL and U-Boot pre-relocation
  *
  * @node: node to check
  * @return true if node is needed in SPL/TL, false otherwise
include/dm/util.h +4 -2
index 60d3b93..348c2ac 100644
@@ -52,12 +52,14 @@ static inline void dm_dump_devres(void)
  * it is possible to determine if a node was bound in one of
  * SPL/TPL stages.
  *
- * There are 3 settings currently in use
- * -
+ * There are 4 settings currently in use
+ * - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
  * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
  *   Existing platforms only use it to indicate nodes needed in
  *   SPL. Should probably be replaced by u-boot,dm-spl for
  *   existing platforms.
+ * - u-boot,dm-spl: SPL and U-Boot pre-relocation
+ * - u-boot,dm-tpl: TPL and U-Boot pre-relocation
  * @node: of node
  *
  * Returns true if node is needed in SPL/TL, false otherwise.
Signature · 1 line
2.7.4
#6 lore raw

PATCH v3 3/3 dm: doc: add documentation for pre-reloc properties in SPL and TPL

Quoted 17 lines · Patrick Delaunay

Add documentation for the pre-reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-proper
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl

---

Changes in v3:
- rebase on u-boot-dm/sandbox-working

Changes in v2:
- rebase on master

Quoted 6 lines
 doc/README.SPL              | 16 ++++++++++++++++
 doc/README.TPL              |  4 ++++
 doc/driver-model/README.txt |  4 ++++
 include/dm/ofnode.h         |  6 ++++--
 include/dm/util.h           |  6 ++++--
 5 files changed, 32 insertions(+), 4 deletions(-)

Applied to u-boot-dm/next, thanks!

#7 lore raw

v3 cover fdt: Allow indicating a node is for U-Boot proper only

In reply to Patrick Delaunay

Hi Simon,

Quoted 47 lines

Hi,

I create this serie with:

1/ documentation update for previous patch
[U-Boot,v2] dm: remove pre reloc properties in SPL and TPL device tree
http://patchwork.ozlabs.org/patch/1081155/

PS: Code is already merged in commit commit c7a88dae997f ("dm: remove
pre reloc properties in SPL and TPL device tree")
but not the documentation.

2/ missing part for v1 serie (patch 1/2)
http://patchwork.ozlabs.org/project/uboot/list/?series=89846
=> http://patchwork.ozlabs.org/patch/1035797

3/ new tests for pre-reloc propertie in SPL as suggested by Simon
(http://patchwork.ozlabs.org/patch/1081155/#2156621)

Regards
Patrick

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb
- rebase on u-boot-dm/sandbox-working

Changes in v2:
- rebase on master

Patrick Delaunay (3):
test: check u-boot properties in SPL device tree
fdt: Allow indicating a node is for U-Boot proper only
dm: doc: add documentation for pre-reloc properties in SPL and TPL

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 doc/README.SPL                   | 16 ++++++++++++++++
 doc/README.TPL                   |  4 ++++
 doc/driver-model/README.txt      |  4 ++++
 drivers/core/util.c              |  2 ++
 drivers/video/video-uclass.c     |  4 +++-
 include/dm/ofnode.h              |  6 ++++--
 include/dm/util.h                |  6 ++++--
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 9 files changed, 83 insertions(+), 5 deletions(-)
Quoted 2 lines

--
2.7.4

Gentle reminder

targeted for v2019.07 or for next release v2019.10 ?

Not blocking for my board (as display is not yet supported).

Patrick

#8 lore raw

v3 cover fdt: Allow indicating a node is for U-Boot proper only

Hi Patrick,

Quoted 50 lines · Patrick DELAUNAY

Hi Simon,

Quoted 47 lines

Hi,

I create this serie with:

1/ documentation update for previous patch
[U-Boot,v2] dm: remove pre reloc properties in SPL and TPL device tree
http://patchwork.ozlabs.org/patch/1081155/

PS: Code is already merged in commit commit c7a88dae997f ("dm: remove
pre reloc properties in SPL and TPL device tree")
but not the documentation.

2/ missing part for v1 serie (patch 1/2)
http://patchwork.ozlabs.org/project/uboot/list/?series=89846
=> http://patchwork.ozlabs.org/patch/1035797

3/ new tests for pre-reloc propertie in SPL as suggested by Simon
(http://patchwork.ozlabs.org/patch/1081155/#2156621)

Regards
Patrick

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb
- rebase on u-boot-dm/sandbox-working

Changes in v2:
- rebase on master

Patrick Delaunay (3):
test: check u-boot properties in SPL device tree
fdt: Allow indicating a node is for U-Boot proper only
dm: doc: add documentation for pre-reloc properties in SPL and TPL

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 doc/README.SPL                   | 16 ++++++++++++++++
 doc/README.TPL                   |  4 ++++
 doc/driver-model/README.txt      |  4 ++++
 drivers/core/util.c              |  2 ++
 drivers/video/video-uclass.c     |  4 +++-
 include/dm/ofnode.h              |  6 ++++--
 include/dm/util.h                |  6 ++++--
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 9 files changed, 83 insertions(+), 5 deletions(-)
Quoted 8 lines
Quoted 2 lines

--
2.7.4

Gentle reminder

targeted for v2019.07 or for next release v2019.10 ?

Not blocking for my board (as display is not yet supported).

I'm planning to pull this in for the next release, and expect to have more time in a week.

Regards,
Simon

#9 lore raw

v3 cover fdt: Allow indicating a node is for U-Boot proper only

Quoted 57 lines · Simon Glass

Hi Patrick,

Quoted 53 lines · Patrick DELAUNAY

Hi Simon,

Quoted 49 lines

Hi,

I create this serie with:

1/ documentation update for previous patch
[U-Boot,v2] dm: remove pre reloc properties in SPL and TPL device tree
http://patchwork.ozlabs.org/patch/1081155/

PS: Code is already merged in commit commit c7a88dae997f ("dm: remove
pre reloc properties in SPL and TPL device tree")
but not the documentation.

2/ missing part for v1 serie (patch 1/2)
http://patchwork.ozlabs.org/project/uboot/list/?series=89846
=> http://patchwork.ozlabs.org/patch/1035797

3/ new tests for pre-reloc propertie in SPL as suggested by Simon
(http://patchwork.ozlabs.org/patch/1081155/#2156621)

Regards
Patrick

Changes in v3:
- simplify test after Simon remarks by using fdtgrep on spl dtb
- rebase on u-boot-dm/sandbox-working

Changes in v2:
- rebase on master

Patrick Delaunay (3):
test: check u-boot properties in SPL device tree
fdt: Allow indicating a node is for U-Boot proper only
dm: doc: add documentation for pre-reloc properties in SPL and TPL

 arch/sandbox/dts/sandbox.dtsi    | 18 ++++++++++++++++++
 doc/README.SPL                   | 16 ++++++++++++++++
 doc/README.TPL                   |  4 ++++
 doc/driver-model/README.txt      |  4 ++++
 drivers/core/util.c              |  2 ++
 drivers/video/video-uclass.c     |  4 +++-
 include/dm/ofnode.h              |  6 ++++--
 include/dm/util.h                |  6 ++++--
 test/py/tests/test_ofplatdata.py | 28 ++++++++++++++++++++++++++++
 9 files changed, 83 insertions(+), 5 deletions(-)

--
2.7.4

Quoted 8 lines
Quoted 5 lines

Gentle reminder

targeted for v2019.07 or for next release v2019.10 ?

Not blocking for my board (as display is not yet supported).

I'm planning to pull this in for the next release, and expect to have more time in a week.

Applied to u-boot-dm/next, thanks!