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 #if LCD_BPP == LCD_COLOR16
20 int vl_col = lcd_get_pixel_width();
21 int vl_row = lcd_get_pixel_height();
22 return fdt_setup_simplefb_node(blob, off, gd->fb_base, vl_col, vl_row,
23 vl_col * 2, "r5g6b5");
29 int lcd_dt_simplefb_add_node(void *blob)
31 static const char compat[] = "simple-framebuffer";
32 static const char disabled[] = "disabled";
35 off = fdt_add_subnode(blob, 0, "framebuffer");
39 ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
43 ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
47 return lcd_dt_simplefb_configure_node(blob, off);
50 int lcd_dt_simplefb_enable_existing_node(void *blob)
54 off = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
58 return lcd_dt_simplefb_configure_node(blob, off);