2 * Simplefb device tree support
5 * Stephen Warren <swarren@wwwdotorg.org>
7 * SPDX-License-Identifier: GPL-2.0+
12 #include <fdt_support.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 static int lcd_dt_simplefb_configure_node(void *blob, int off)
19 int vl_col = lcd_get_pixel_width();
20 int vl_row = lcd_get_pixel_height();
21 #if LCD_BPP == LCD_COLOR16
22 return fdt_setup_simplefb_node(blob, off, gd->fb_base, vl_col, vl_row,
23 vl_col * 2, "r5g6b5");
24 #elif LCD_BPP == LCD_COLOR32
25 return fdt_setup_simplefb_node(blob, off, gd->fb_base, vl_col, vl_row,
26 vl_col * 4, "a8r8g8b8");
32 int lcd_dt_simplefb_add_node(void *blob)
34 static const char compat[] = "simple-framebuffer";
35 static const char disabled[] = "disabled";
38 off = fdt_add_subnode(blob, 0, "framebuffer");
42 ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
46 ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
50 return lcd_dt_simplefb_configure_node(blob, off);
53 int lcd_dt_simplefb_enable_existing_node(void *blob)
57 off = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
61 return lcd_dt_simplefb_configure_node(blob, off);