Skip to contentSkip to conversation

dm: core: also parse chosen node

PATCH Superseded Rob Clark 3 participants 6 messages Aug 3, 2017 – Aug 28, 2017 Framebuffer layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/3 dm: core: also parse chosen node

This is the node that would contain, for example, the framebuffer setup by an earlier stage.

---
 drivers/core/root.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/core/root.c +21 -1
index d691d6ff94..5e6b2da248 100644
@@ -266,6 +266,26 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 	for (offset = fdt_first_subnode(blob, offset);
 	     offset > 0;
 	     offset = fdt_next_subnode(blob, offset)) {
+		ofnode node = offset_to_ofnode(offset);
+
+		/* "chosen" node isn't a device itself but may contain some: */
+		if (strcmp(ofnode_get_name(node), "chosen") == 0) {
+			dm_dbg("parsing subnodes of \"chosen\"\n");
+
+			for (node = ofnode_first_subnode(node);
+			     ofnode_valid(node);
+			     node = ofnode_next_subnode(node)) {
+				dm_dbg("subnode: %s\n", ofnode_get_name(node));
+				err = lists_bind_fdt(parent, node, NULL);
+				if (err && !ret) {
+					ret = err;
+					dm_dbg("%s: ret=%d\n", ofnode_get_name(node), ret);
+				}
+			}
+
+			continue;
+		}
+
 		if (pre_reloc_only &&
 		    !dm_fdt_pre_reloc(blob, offset))
 			continue;
@@ -273,7 +293,7 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 			dm_dbg("   - ignoring disabled device\n");
 			continue;
 		}
-		err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
+		err = lists_bind_fdt(parent, node, NULL);
 		if (err && !ret) {
 			ret = err;
 			debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
Signature · 1 line
2.13.0
author
#1 lore raw

PATCH 2/3 video: simplefb

Not really qcom specific, but for now qcom/lk is the one firmware that is (afaiu) setting up the appropriate dt node for pre-configured display. Uses the generic simple-framebuffer DT bindings so this should be useful on other platforms.

---
 drivers/video/Kconfig    | 10 +++++++
 drivers/video/Makefile   |  2 +-
 drivers/video/simplefb.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/simplefb.c
drivers/video/Kconfig +10 -0
index 61dfed8c06..8eb0359231 100644
@@ -628,4 +628,14 @@ config VIDEO_DW_HDMI
 	  rather requires a SoC-specific glue driver to call it), it
 	  can not be enabled from the configuration menu.
 
+config VIDEO_SIMPLE
+	bool "Simple display driver for preconfigured display"
+	help
+	  Enables a simple generic display driver which utilizes the
+	  simple-framebuffer devicetree bindings.
+
+	  This driver assumes that the display hardware has been initialized
+	  before u-boot starts, and u-boot will simply render to the pre-
+	  allocated frame buffer surface.
+
 endmenu
drivers/video/Makefile +1 -1
index ac5371f2ae..52f50f647b 100644
@@ -57,7 +57,7 @@ obj-$(CONFIG_FORMIKE) += formike.o
 obj-$(CONFIG_LG4573) += lg4573.o
 obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
-
+obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
 obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
 obj-${CONFIG_EXYNOS_FB} += exynos/
 obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
drivers/video/simplefb.c new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
2.13.0
#2 lore raw

PATCH 2/3 video: simplefb

Quoted 5 lines · On Thu, 3 Aug 2017 12:47:00 -0400 Rob Clark robdclark at gmail.com wrote:

Not really qcom specific, but for now qcom/lk is the one firmware that is (afaiu) setting up the appropriate dt node for pre-configured display. Uses the generic simple-framebuffer DT bindings so this should be useful on other platforms.

Quoted 7 lines
---
 drivers/video/Kconfig    | 10 +++++++
 drivers/video/Makefile   |  2 +-
 drivers/video/simplefb.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/simplefb.c

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

--
Anatolij

author
#3 lore raw

PATCH 3/3 video: add config option to skip framebuffer clear

In reply to Rob Clark

The use-case is that the thing that loaded u-boot already put a splash image on screen. And we want to preserve that until grub boot menu takes over.

---
 drivers/video/Kconfig        | 8 ++++++++
 drivers/video/cfb_console.c  | 3 ++-
 drivers/video/video-uclass.c | 4 +++-
 3 files changed, 13 insertions(+), 2 deletions(-)
drivers/video/Kconfig +8 -0
index 8eb0359231..7b56b20344 100644
@@ -98,6 +98,14 @@ config SYS_WHITE_ON_BLACK
 	 better in low-light situations or to reduce eye strain in some
 	 cases.
 
+config NO_FB_CLEAR
+	bool "Skip framebuffer clear"
+	help
+	  If firmware (whatever loads u-boot) has already put a splash image
+	  on screen, you might want to preserve it until whatever u-boots
+	  loads takes over the screen.  This, for example, can be used to
+	  keep splash image on screen until grub graphical boot menu starts.
+
 source "drivers/video/fonts/Kconfig"
 
 config VIDCONSOLE_AS_LCD
drivers/video/cfb_console.c +2 -1
index f54802052e..85fa5b0cae 100644
@@ -2091,7 +2091,8 @@ static int cfg_video_init(void)
 	}
 	eorx = fgx ^ bgx;
 
-	video_clear();
+	if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
+		video_clear();
 
 #ifdef CONFIG_VIDEO_LOGO
 	/* Plot the logo and get start point of console */
drivers/video/video-uclass.c +3 -1
index 3036e3a1f2..dfa39b0d1b 100644
@@ -199,7 +199,9 @@ static int video_post_probe(struct udevice *dev)
 #else
 	priv->colour_bg = 0xffffff;
 #endif
-	video_clear(dev);
+
+	if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
+		video_clear(dev);
 
 	/*
 	 * Create a text console device. For now we always do this, although
Signature · 1 line
2.13.0
#4 lore raw

PATCH 3/3 video: add config option to skip framebuffer clear

Quoted 10 lines · On Thu, 3 Aug 2017 12:47:01 -0400 Rob Clark robdclark at gmail.com wrote:

The use-case is that the thing that loaded u-boot already put a splash image on screen. And we want to preserve that until grub boot menu takes over.

---
 drivers/video/Kconfig        | 8 ++++++++
 drivers/video/cfb_console.c  | 3 ++-
 drivers/video/video-uclass.c | 4 +++-
 3 files changed, 13 insertions(+), 2 deletions(-)

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

--
Anatolij

#5 lore raw

PATCH 1/3 dm: core: also parse chosen node

In reply to Rob Clark

Hi Rob,

Quoted 7 lines · Rob Clark

This is the node that would contain, for example, the framebuffer setup by an earlier stage.

---
 drivers/core/root.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Please can you add one to test.dts and add a sandbox test for it?

drivers/core/root.c static int dm_scan_fdt_node(struct udevice *parent, const void *blob, · line 272

Quoted 13 lines
drivers/core/root.c +4 -0
index d691d6ff94..5e6b2da248 100644
@@ -266,6 +266,26 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
        for (offset = fdt_first_subnode(blob, offset);
             offset > 0;
             offset = fdt_next_subnode(blob, offset)) {
+               ofnode node = offset_to_ofnode(offset);
+
+               /* "chosen" node isn't a device itself but may contain some: */
+               if (strcmp(ofnode_get_name(node), "chosen") == 0) {

!strcmp()

Quoted 29 lines
drivers/core/root.c +17 -2
+                       dm_dbg("parsing subnodes of \"chosen\"\n");
+
+                       for (node = ofnode_first_subnode(node);
+                            ofnode_valid(node);
+                            node = ofnode_next_subnode(node)) {
+                               dm_dbg("subnode: %s\n", ofnode_get_name(node));
+                               err = lists_bind_fdt(parent, node, NULL);
+                               if (err && !ret) {
+                                       ret = err;
+                                       dm_dbg("%s: ret=%d\n", ofnode_get_name(node), ret);
+                               }
+                       }
+
+                       continue;
+               }
+
                if (pre_reloc_only &&
                    !dm_fdt_pre_reloc(blob, offset))
                        continue;
@@ -273,7 +293,7 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
                        dm_dbg("   - ignoring disabled device\n");
                        continue;
                }
-               err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
+               err = lists_bind_fdt(parent, node, NULL);
                if (err && !ret) {
                        ret = err;
                        debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
--
Quoted 2 lines

2.13.0

Regards,
Simon