* [PATCH 0/3] simplefb-fixup: fixes for 64bit systems
@ 2025-11-17 21:29 Michael Grzeschik
2025-11-17 21:29 ` [PATCH 1/3] include: linux: ioport.h: port resource_set_range from linux Michael Grzeschik
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Michael Grzeschik @ 2025-11-17 21:29 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX
This series is containing fixes to hand over the simplefb to 64bit
systems.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
Michael Grzeschik (3):
include: linux: ioport.h: port resource_set_range from linux
simplefb-fixup: depend res fields on root size-cells and addr-cells
simplefb-fixup: add reserved memory-region entry for the simple-framebuffer
drivers/video/simplefb-fixup.c | 29 ++++++++++++++++++++---------
include/linux/ioport.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 9 deletions(-)
---
base-commit: 6c85c9d60dd32b42a866aed522ff7e19211ef7d2
change-id: 20251117-simplefb-fixup-3bfdad19358c
Best regards,
--
Michael Grzeschik <m.grzeschik@pengutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] include: linux: ioport.h: port resource_set_range from linux
2025-11-17 21:29 [PATCH 0/3] simplefb-fixup: fixes for 64bit systems Michael Grzeschik
@ 2025-11-17 21:29 ` Michael Grzeschik
2025-11-17 21:29 ` [PATCH 2/3] simplefb-fixup: depend res fields on root size-cells and addr-cells Michael Grzeschik
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Michael Grzeschik @ 2025-11-17 21:29 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX
This is a preparation patch for potential users to follow.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
include/linux/ioport.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 290f9feddcb900d92b61169acc46d7e1ead62c91..e24984f7f722eae5466a4e198457adda6601bf77 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -234,5 +234,36 @@ static inline bool is_reserved_resource(const struct resource *res)
return false;
}
+/**
+ * resource_set_size - Calculate resource end address from size and start
+ * @res: Resource descriptor
+ * @size: Size of the resource
+ *
+ * Calculate the end address for @res based on @size.
+ *
+ * Note: The start address of @res must be set when calling this function.
+ * Prefer resource_set_range() if setting both the start address and @size.
+ */
+static inline void resource_set_size(struct resource *res, resource_size_t size)
+{
+ res->end = res->start + size - 1;
+}
+
+/**
+ * resource_set_range - Set resource start and end addresses
+ * @res: Resource descriptor
+ * @start: Start address for the resource
+ * @size: Size of the resource
+ *
+ * Set @res start address and calculate the end address based on @size.
+ */
+static inline void resource_set_range(struct resource *res,
+ resource_size_t start,
+ resource_size_t size)
+{
+ res->start = start;
+ resource_set_size(res, size);
+}
+
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_IOPORT_H */
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] simplefb-fixup: depend res fields on root size-cells and addr-cells
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
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
3 siblings, 0 replies; 5+ messages in thread
From: Michael Grzeschik @ 2025-11-17 21:29 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] simplefb-fixup: add reserved memory-region entry for the simple-framebuffer
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 ` [PATCH 2/3] simplefb-fixup: depend res fields on root size-cells and addr-cells Michael Grzeschik
@ 2025-11-17 21:29 ` Michael Grzeschik
2025-11-18 7:30 ` [PATCH 0/3] simplefb-fixup: fixes for 64bit systems Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Michael Grzeschik @ 2025-11-17 21:29 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX
The modern way to describe an reserved memory region is to place an
entry in the reserved-memory nodes. Using the of_fixup_reserved_memory
this is simply done.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/video/simplefb-fixup.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/video/simplefb-fixup.c b/drivers/video/simplefb-fixup.c
index 9b39e1ef46d84eed61242119251d340b44d59a6e..e20f2922445bddcb13a049b2581c4c632289d6ee 100644
--- a/drivers/video/simplefb-fixup.c
+++ b/drivers/video/simplefb-fixup.c
@@ -13,6 +13,7 @@
#include <fb.h>
#include <fcntl.h>
#include <fs.h>
+#include <of.h>
#include <init.h>
#include <xfuncs.h>
@@ -93,6 +94,7 @@ static int simplefb_create_node(struct device_node *root,
phys_addr_t screen_base;
__be32 cells[4];
int addr_cells = 2, size_cells = 1, ret;
+ struct resource res = { };
of_property_read_u32(root, "#address-cells", &addr_cells);
of_property_read_u32(root, "#size-cells", &size_cells);
@@ -121,6 +123,12 @@ static int simplefb_create_node(struct device_node *root,
if (ret < 0)
return ret;
+ res.name = "simple-framebuffer";
+ res.flags |= IORESOURCE_BUSY;
+ resource_set_range(&res, screen_base, fbi->screen_size);
+
+ of_fixup_reserved_memory(root, &res);
+
cells[0] = cpu_to_be32(fbi->xres);
ret = of_set_property(node, "width", cells, sizeof(cells[0]), 1);
if (ret < 0)
@@ -140,8 +148,6 @@ static int simplefb_create_node(struct device_node *root,
if (ret < 0)
return ret;
- of_add_reserve_entry(screen_base, screen_base + fbi->screen_size);
-
return of_property_write_string(node, "status", "okay");
}
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] simplefb-fixup: fixes for 64bit systems
2025-11-17 21:29 [PATCH 0/3] simplefb-fixup: fixes for 64bit systems Michael Grzeschik
` (2 preceding siblings ...)
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 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-11-18 7:30 UTC (permalink / raw)
To: BAREBOX, Michael Grzeschik
On Mon, 17 Nov 2025 22:29:25 +0100, Michael Grzeschik wrote:
> This series is containing fixes to hand over the simplefb to 64bit
> systems.
>
>
Applied, thanks!
[1/3] include: linux: ioport.h: port resource_set_range from linux
https://git.pengutronix.de/cgit/barebox/commit/?id=543d3e804021 (link may not be stable)
[2/3] simplefb-fixup: depend res fields on root size-cells and addr-cells
https://git.pengutronix.de/cgit/barebox/commit/?id=27fcc536a206 (link may not be stable)
[3/3] simplefb-fixup: add reserved memory-region entry for the simple-framebuffer
https://git.pengutronix.de/cgit/barebox/commit/?id=8b6c55a48c64 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-18 7:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/3] simplefb-fixup: depend res fields on root size-cells and addr-cells Michael Grzeschik
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox