All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] fdt: Allow indicating a node is for U-Boot proper only
@ 2019-02-04 10:14 Patrick Delaunay
  2019-02-04 10:14 ` [U-Boot] [PATCH 2/2] dm: core: remove the duplicated function dm_ofnode_pre_reloc Patrick Delaunay
  2019-02-04 14:40 ` [U-Boot] [PATCH 1/2] fdt: Allow indicating a node is for U-Boot proper only Simon Glass
  0 siblings, 2 replies; 14+ messages in thread
From: Patrick Delaunay @ 2019-02-04 10:14 UTC (permalink / raw)
  To: u-boot

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.


Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
Hi,

I create this patch, after testing the new key "u-boot,dm-pre-proper"
for ltdc VIDEO driver on stm32mp1 board. I try to replace the
previous used "u-boot,dm-pre-reloc".

/* pre-reloc probe = reserve video frame buffer in video_reserve() */
 &ltdc {
-	u-boot,dm-pre-reloc;
+	u-boot,dm-pre-proper;
 };

And it is failing.

NB: preloc support is only needed in video uclass to reserved
    the frame buffer(called by board_f), so the node for video
    u-class driver is only used in U-BOOT pre-relocation and not in SPL.

After a grep in code, I see that the initial patch don't add the support of
the new "u-boot,dm-pre-proper" in all location where
"u-boot,dm-pre-reloc" was tested.

When I add the needed test in util.c, it is working.


 drivers/core/util.c          |  4 ++++
 drivers/video/video-uclass.c |  4 +++-
 include/dm/ofnode.h          |  6 ++++--
 include/dm/util.h            | 12 ++++++++----
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/core/util.c b/drivers/core/util.c
index 27a6848..6bedc8a 100644
--- a/drivers/core/util.c
+++ b/drivers/core/util.c
@@ -35,6 +35,8 @@ bool dm_fdt_pre_reloc(const void *blob, int offset)
 {
 	if (fdt_getprop(blob, offset, "u-boot,dm-pre-reloc", NULL))
 		return true;
+	if (fdt_getprop(blob, offset, "u-boot,dm-pre-proper", NULL))
+		return true;
 
 #ifdef CONFIG_TPL_BUILD
 	if (fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
@@ -59,6 +61,8 @@ bool dm_ofnode_pre_reloc(ofnode node)
 {
 	if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
 		return true;
+	if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
+		return true;
 
 #ifdef CONFIG_TPL_BUILD
 	if (ofnode_read_bool(node, "u-boot,dm-tpl"))
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index f307cf2..a9d40fe 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -290,7 +290,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;
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index d206ee2..b45da5e 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -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
diff --git a/include/dm/util.h b/include/dm/util.h
index 9ff6531..cbc209d 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -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
  * @blob: devicetree
  * @offset: node offset
  *
@@ -78,12 +80,14 @@ bool dm_fdt_pre_reloc(const void *blob, int offset);
  * 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.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-05-20  7:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 10:14 [U-Boot] [PATCH 1/2] fdt: Allow indicating a node is for U-Boot proper only Patrick Delaunay
2019-02-04 10:14 ` [U-Boot] [PATCH 2/2] dm: core: remove the duplicated function dm_ofnode_pre_reloc Patrick Delaunay
2019-02-04 14:40   ` Simon Glass
2019-02-06  9:26     ` Patrick DELAUNAY
2019-02-04 14:40 ` [U-Boot] [PATCH 1/2] fdt: Allow indicating a node is for U-Boot proper only Simon Glass
2019-02-05  8:54   ` Marek Vasut
2019-02-07 17:40     ` Patrick DELAUNAY
2019-02-07 17:47       ` Marek Vasut
2019-02-08 12:47         ` Patrick DELAUNAY
2019-02-11 11:56         ` Patrick DELAUNAY
2019-02-11 11:58           ` Marek Vasut
2019-02-11 14:34             ` Patrick DELAUNAY
2019-05-18 16:20               ` Simon Glass
2019-05-20  7:41                 ` Patrick DELAUNAY

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.