Skip to contentSkip to conversation

rpi: Conditionally add simple-framebuffer node

PATCH Applied Ivan T. Ivanov 2 participants 3 messages Aug 10, 2021 – Sep 15, 2021 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpi: Conditionally add simple-framebuffer node

It appears that RPi firmware has already added framebuffer node under /chosen, at least on RPi 2 versions. So check for this and don't add duplicate node.

---
 board/raspberrypi/rpi/rpi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
board/raspberrypi/rpi/rpi.c +5 -6
index df52a4689f..372b26b6f2 100644
@@ -497,12 +497,11 @@ void *board_fdt_blob_setup(void)
 
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
-	/*
-	 * For now, we simply always add the simplefb DT node. Later, we
-	 * should be more intelligent, and e.g. only do this if no enabled DT
-	 * node exists for the "real" graphics driver.
-	 */
-	lcd_dt_simplefb_add_node(blob);
+	int node;
+
+	node = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
+	if (node < 0)
+		lcd_dt_simplefb_add_node(blob);
 
 #ifdef CONFIG_EFI_LOADER
 	/* Reserve the spin table */
Signature · 1 line
2.32.0
#1 lore raw

Hi,

Quoting Ivan T. Ivanov (2021-08-10 17:31:14)

Quoted 21 lines

It appears that RPi firmware has already added framebuffer node under /chosen, at least on RPi 2 versions. So check for this and don't add duplicate node.

---
 board/raspberrypi/rpi/rpi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
board/raspberrypi/rpi/rpi.c +0 -4
index df52a4689f..372b26b6f2 100644
@@ -497,12 +497,11 @@ void *board_fdt_blob_setup(void)
 
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
-       /*
-        * For now, we simply always add the simplefb DT node. Later, we
-        * should be more intelligent, and e.g. only do this if no enabled DT
-        * node exists for the "real" graphics driver.

board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 507

Quoted 10 lines
board/raspberrypi/rpi/rpi.c +5 -2
-        */
-       lcd_dt_simplefb_add_node(blob);
+       int node;
+
+       node = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
+       if (node < 0)
+               lcd_dt_simplefb_add_node(blob);
 
 #ifdef CONFIG_EFI_LOADER
        /* Reserve the spin table */

Could someone take a look into this fix, please.

BTW, original message still awaits list moderator approval.

Thank you!
Ivan

#2 lore raw
In reply to Ivan T. Ivanov
Quoted 5 lines · Ivan T. Ivanov

It appears that RPi firmware has already added framebuffer node under /chosen, at least on RPi 2 versions. So check for this and don't add duplicate node.

Applied to rpi-next now.

Thanks,
Matthias

Quoted 27 lines
---
  board/raspberrypi/rpi/rpi.c | 11 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)
board/raspberrypi/rpi/rpi.c +5 -6
index df52a4689f..372b26b6f2 100644
@@ -497,12 +497,11 @@ void *board_fdt_blob_setup(void)
 
  int ft_board_setup(void *blob, struct bd_info *bd)
  {
-	/*
-	 * For now, we simply always add the simplefb DT node. Later, we
-	 * should be more intelligent, and e.g. only do this if no enabled DT
-	 * node exists for the "real" graphics driver.
-	 */
-	lcd_dt_simplefb_add_node(blob);
+	int node;
+
+	node = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
+	if (node < 0)
+		lcd_dt_simplefb_add_node(blob);
 
  #ifdef CONFIG_EFI_LOADER
  	/* Reserve the spin table */