From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 2/3] simplefb-fixup: depend res fields on root size-cells and addr-cells
Date: Mon, 17 Nov 2025 22:29:27 +0100 [thread overview]
Message-ID: <20251117-simplefb-fixup-v1-2-7824d99b3fb3@pengutronix.de> (raw)
In-Reply-To: <20251117-simplefb-fixup-v1-0-7824d99b3fb3@pengutronix.de>
With 64bit systems the #size-cells and #addr-cells are different
to 32bit. To align with the spec we define the number of fields
by the roots size and addr cells count.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/video/simplefb-fixup.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/video/simplefb-fixup.c b/drivers/video/simplefb-fixup.c
index 65e0281a189f23c3b730c7bab56d283cc29700aa..9b39e1ef46d84eed61242119251d340b44d59a6e 100644
--- a/drivers/video/simplefb-fixup.c
+++ b/drivers/video/simplefb-fixup.c
@@ -91,8 +91,14 @@ static int simplefb_create_node(struct device_node *root,
{
struct device_node *node;
phys_addr_t screen_base;
- u32 cells[2];
- int ret;
+ __be32 cells[4];
+ int addr_cells = 2, size_cells = 1, ret;
+
+ of_property_read_u32(root, "#address-cells", &addr_cells);
+ of_property_read_u32(root, "#size-cells", &size_cells);
+
+ if ((addr_cells + size_cells) > 4)
+ return -EINVAL;
node = of_create_node(root, "/framebuffer");
if (!node)
@@ -107,12 +113,11 @@ static int simplefb_create_node(struct device_node *root,
return ret;
screen_base = virt_to_phys(fbi->screen_base);
- if (upper_32_bits(screen_base))
- return -ENOSYS;
- cells[0] = cpu_to_be32(lower_32_bits(screen_base));
- cells[1] = cpu_to_be32(fbi->line_length * fbi->yres);
- ret = of_set_property(node, "reg", cells, sizeof(cells[0]) * 2, 1);
+ of_write_number(cells, screen_base, addr_cells);
+ of_write_number(cells + addr_cells, fbi->screen_size, size_cells);
+
+ ret = of_set_property(node, "reg", cells, sizeof(cells[0]) * (addr_cells + size_cells), 1);
if (ret < 0)
return ret;
--
2.47.3
next prev parent reply other threads:[~2025-11-17 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 21:29 [PATCH 0/3] simplefb-fixup: fixes for 64bit systems Michael Grzeschik
2025-11-17 21:29 ` [PATCH 1/3] include: linux: ioport.h: port resource_set_range from linux Michael Grzeschik
2025-11-17 21:29 ` Michael Grzeschik [this message]
2025-11-17 21:29 ` [PATCH 3/3] simplefb-fixup: add reserved memory-region entry for the simple-framebuffer Michael Grzeschik
2025-11-18 7:30 ` [PATCH 0/3] simplefb-fixup: fixes for 64bit systems Sascha Hauer
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=20251117-simplefb-fixup-v1-2-7824d99b3fb3@pengutronix.de \
--to=m.grzeschik@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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