public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@csgraf.de>
To: u-boot@lists.denx.de
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>,
	Simon Glass <sjg@chromium.org>,
	Mark Kettenis <mark.kettenis@xs4all.nl>,
	Bin Meng <bmeng.cn@gmail.com>, Asherah Connor <ashe@kivikakk.ee>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Anatolij Gustschin <agust@denx.de>
Subject: [PATCH 3/4] qfw: Spawn ramfb device if its file is present
Date: Sun, 27 Feb 2022 15:40:42 +0100	[thread overview]
Message-ID: <20220227144043.37359-4-agraf@csgraf.de> (raw)
In-Reply-To: <20220227144043.37359-1-agraf@csgraf.de>

Now that we have a ramfb device driver, let's add the necessary glueing
magic to also spawn it when we find its qfw file node.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
---
 drivers/misc/qfw.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
index 7c6ed41f48..fefa0bce86 100644
--- a/drivers/misc/qfw.c
+++ b/drivers/misc/qfw.c
@@ -13,6 +13,7 @@
 #include <malloc.h>
 #include <qfw.h>
 #include <dm.h>
+#include <dm/lists.h>
 #include <misc.h>
 #include <tables_csum.h>
 #if defined(CONFIG_GENERATE_ACPI_TABLE) && !defined(CONFIG_ARM)
@@ -309,6 +310,26 @@ void qfw_read_entry(struct udevice *dev, u16 entry, u32 size, void *address)
 		qfw_read_entry_io(qdev, entry, size, address);
 }
 
+static void qfw_bind_ramfb(struct udevice *dev)
+{
+#ifdef CONFIG_VIDEO_RAMFB
+	struct fw_file *file;
+	int ret;
+
+	ret = qfw_read_firmware_list(dev);
+	if (ret)
+		return;
+
+	file = qfw_find_file(dev, "etc/ramfb");
+	if (!file) {
+		/* No ramfb available. */
+		return;
+	}
+
+	device_bind_driver(dev, "ramfb", "qfw-ramfb", NULL);
+#endif
+}
+
 int qfw_register(struct udevice *dev)
 {
 	struct qfw_dev *qdev = dev_get_uclass_priv(dev);
@@ -325,6 +346,8 @@ int qfw_register(struct udevice *dev)
 	if (dma_enabled & FW_CFG_DMA_ENABLED)
 		qdev->dma_present = true;
 
+	qfw_bind_ramfb(dev);
+
 	return 0;
 }
 
-- 
2.32.0


  parent reply	other threads:[~2022-02-27 14:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-27 14:40 [PATCH 0/4] Add support for QEMU's ramfb display Alexander Graf
2022-02-27 14:40 ` [PATCH 1/4] qfw: Add WRITE definition Alexander Graf
2022-03-12  2:25   ` Simon Glass
2022-02-27 14:40 ` [PATCH 2/4] ramfb: Add driver for ramfb display Alexander Graf
2022-03-12  2:25   ` Simon Glass
2022-02-27 14:40 ` Alexander Graf [this message]
2022-02-27 14:40 ` [PATCH 4/4] qemu-arm*: Enable ramfb by default Alexander Graf
2022-02-27 15:35 ` [PATCH 0/4] Add support for QEMU's ramfb display Heinrich Schuchardt
2022-02-27 17:05   ` Alexander Graf
2022-02-27 17:03 ` [PATCH 5/5] qemu-riscv: Enable ramfb by default Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220227144043.37359-4-agraf@csgraf.de \
    --to=agraf@csgraf.de \
    --cc=agust@denx.de \
    --cc=ashe@kivikakk.ee \
    --cc=bmeng.cn@gmail.com \
    --cc=mark.kettenis@xs4all.nl \
    --cc=sjg@chromium.org \
    --cc=tuomas.tynkkynen@iki.fi \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox