]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sunxi: video: Add simplefb support
authorLuc Verhaegen <libv@skynet.be>
Wed, 13 Aug 2014 05:55:07 +0000 (07:55 +0200)
committerHans de Goede <hdegoede@redhat.com>
Tue, 25 Nov 2014 12:38:46 +0000 (13:38 +0100)
Add simplefb support, note this depends on the kernel having support for
the clocks property which has recently been added to the simplefb devicetree
binding.

Signed-off-by: Luc Verhaegen <libv@skynet.be>
[hdegoede@redhat.com: Use pre-populated simplefb node under /chosen as
 disussed on the devicetree list]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>.
arch/arm/include/asm/arch-sunxi/display.h
board/sunxi/board.c
drivers/video/sunxi_display.c
include/configs/sunxi-common.h

index 4a4e9f82203da2a05142927148f888fff9bb057d..ddb71c1bbd33f71e054ab2fc50834c90061cc8e3 100644 (file)
@@ -182,4 +182,6 @@ struct sunxi_hdmi_reg {
 #define SUNXI_HDMI_PLL_DBG0_PLL3               (0 << 21)
 #define SUNXI_HDMI_PLL_DBG0_PLL7               (1 << 21)
 
+int sunxi_simplefb_setup(void *blob);
+
 #endif /* _SUNXI_DISPLAY_H */
index e6ec5b8fc10b89447f6088ec1320eb0701a10108..4c1c69a6ae1381fafc9b0c2b6f1117377ee5c3aa 100644 (file)
@@ -24,6 +24,7 @@
 #endif
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
+#include <asm/arch/display.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
@@ -237,3 +238,12 @@ int misc_init_r(void)
        return 0;
 }
 #endif
+
+#ifdef CONFIG_OF_BOARD_SETUP
+int ft_board_setup(void *blob, bd_t *bd)
+{
+#ifdef CONFIG_VIDEO_DT_SIMPLEFB
+       return sunxi_simplefb_setup(blob);
+#endif
+}
+#endif /* CONFIG_OF_BOARD_SETUP */
index 63945e082cfa507e08657d5fdc89a8c908d3edf7..d2413971c07b5a3881ff96fbe9e0939b7a2e57ca 100644 (file)
@@ -13,6 +13,8 @@
 #include <asm/arch/display.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
+#include <fdtdec.h>
+#include <fdt_support.h>
 #include <linux/fb.h>
 #include <video_fb.h>
 
@@ -408,3 +410,42 @@ void *video_hw_init(void)
 
        return graphic_device;
 }
+
+/*
+ * Simplefb support.
+ */
+#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_VIDEO_DT_SIMPLEFB)
+int sunxi_simplefb_setup(void *blob)
+{
+       static GraphicDevice *graphic_device = &sunxi_display.graphic_device;
+       int offset, ret;
+
+       if (!sunxi_display.enabled)
+               return 0;
+
+       /* Find a framebuffer node, with pipeline == "de_be0-lcd0-hdmi" */
+       offset = fdt_node_offset_by_compatible(blob, -1,
+                                              "allwinner,simple-framebuffer");
+       while (offset >= 0) {
+               ret = fdt_find_string(blob, offset, "allwinner,pipeline",
+                                     "de_be0-lcd0-hdmi");
+               if (ret == 0)
+                       break;
+               offset = fdt_node_offset_by_compatible(blob, offset,
+                                              "allwinner,simple-framebuffer");
+       }
+       if (offset < 0) {
+               eprintf("Cannot setup simplefb: node not found\n");
+               return 0; /* Keep older kernels working */
+       }
+
+       ret = fdt_setup_simplefb_node(blob, offset, gd->fb_base,
+                       graphic_device->winSizeX, graphic_device->winSizeY,
+                       graphic_device->winSizeX * graphic_device->gdfBytesPP,
+                       "x8r8g8b8");
+       if (ret)
+               eprintf("Cannot setup simplefb: Error setting properties\n");
+
+       return ret;
+}
+#endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */
index 900ef52569367f5a3d821eb861783440b5933343..d5d907bca5374ae9aab0229811edd0cefe77bc75 100644 (file)
  */
 #define CONFIG_SUNXI_FB_SIZE (8 << 20)
 
+/* Do we want to initialize a simple FB? */
+#define CONFIG_VIDEO_DT_SIMPLEFB
+
 #define CONFIG_VIDEO_SUNXI
 
 #define CONFIG_CFB_CONSOLE
 
 #define CONFIG_SYS_MEM_TOP_HIDE ((CONFIG_SUNXI_FB_SIZE + 0xFFF) & ~0xFFF)
 
+/* To be able to hook simplefb into dt */
+#ifdef CONFIG_VIDEO_DT_SIMPLEFB
+#define CONFIG_OF_BOARD_SETUP
+#endif
+
 #endif /* CONFIG_VIDEO */
 
 /* Ethernet support */