]> git.sur5r.net Git - u-boot/commitdiff
dm: video: arm: rpi: Convert to use driver model for video
authorSimon Glass <sjg@chromium.org>
Wed, 5 Apr 2017 22:23:44 +0000 (16:23 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 10 May 2017 00:27:17 +0000 (20:27 -0400)
Adjust the video driver to work with driver model and move over existing
baords. There is no need to keep the old code.

We can also drop setting of CONFIG_FB_ADDR since driver model doesn't have
this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
configs/rpi_2_defconfig
configs/rpi_3_32b_defconfig
configs/rpi_3_defconfig
configs/rpi_defconfig
drivers/video/bcm2835.c
include/configs/rpi.h

index e43b59ccb9b12a57222c0bd6f827fedacf8b9cec..f8b3ed49a990102906622ef331ef28db5064122c 100644 (file)
@@ -21,7 +21,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
index eadf6bf51218b1f1e15ccafda4d0fc7e3115478d..490af818b6d870673f80c2e5273fd5fc63e65eee 100644 (file)
@@ -23,7 +23,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
index f0ccca1a8f30ab4879d57bc1cd3b2b5823e492cd..4c0eb049b214fcd145741e23826f654b9f394009 100644 (file)
@@ -23,7 +23,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
index bd10b130c8ebe06bdf8d51a0e4dc6d7e125604d3..1b954fe2b76da2bf7c329df365c5452d21bc81f1 100644 (file)
@@ -21,7 +21,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
index cd15f7f32ae9b5bfdbf3531fb70c44353e4c5dfd..952ef5966118ce4f1ea90149120fc19bad93942b 100644 (file)
@@ -5,62 +5,56 @@
  */
 
 #include <common.h>
-#include <lcd.h>
-#include <memalign.h>
-#include <phys2bus.h>
+#include <dm.h>
+#include <video.h>
 #include <asm/arch/mbox.h>
 #include <asm/arch/msg.h>
-#include <asm/global_data.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Global variables that lcd.c expects to exist */
-vidinfo_t panel_info;
-
-static int bcm2835_pitch;
-
-void lcd_ctrl_init(void *lcdbase)
+static int bcm2835_video_probe(struct udevice *dev)
 {
+       struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+       struct video_priv *uc_priv = dev_get_uclass_priv(dev);
        int ret;
-       int w, h;
+       int w, h, pitch;
        ulong fb_base, fb_size, fb_start, fb_end;
 
        debug("bcm2835: Query resolution...\n");
        ret = bcm2835_get_video_size(&w, &h);
-       if (ret) {
-               /* FIXME: How to disable the LCD to prevent errors? hang()? */
-               return;
-       }
+       if (ret)
+               return -EIO;
 
        debug("bcm2835: Setting up display for %d x %d\n", w, h);
        ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB,
                                       BCM2835_MBOX_ALPHA_MODE_IGNORED,
-                                      &fb_base, &fb_size, &bcm2835_pitch);
+                                      &fb_base, &fb_size, &pitch);
 
        debug("bcm2835: Final resolution is %d x %d\n", w, h);
 
-       panel_info.vl_col = w;
-       panel_info.vl_row = h;
-       panel_info.vl_bpix = LCD_COLOR32;
-
-       gd->fb_base = fb_base;
-
        /* Enable dcache for the frame buffer */
        fb_start = fb_base & ~(MMU_SECTION_SIZE - 1);
        fb_end = fb_base + fb_size;
        fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
        mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
                                        DCACHE_WRITEBACK);
-       lcd_set_flush_dcache(1);
-}
+       video_set_flush_dcache(dev, true);
 
-void lcd_enable(void)
-{
-}
+       uc_priv->xsize = w;
+       uc_priv->ysize = h;
+       uc_priv->bpix = VIDEO_BPP32;
+       plat->base = fb_base;
+       plat->size = fb_size;
 
-int lcd_get_size(int *line_length)
-{
-       *line_length = bcm2835_pitch;
-
-       return *line_length * panel_info.vl_row;
+       return 0;
 }
+
+static const struct udevice_id bcm2835_video_ids[] = {
+       { .compatible = "brcm,bcm2835-hdmi" },
+       { }
+};
+
+U_BOOT_DRIVER(bcm2835_video) = {
+       .name   = "bcm2835_video",
+       .id     = UCLASS_VIDEO,
+       .of_match = bcm2835_video_ids,
+       .probe  = bcm2835_video_probe,
+};
index a2e74f6a4d2242ff48aa1a08ddc202961f349f02..7b9017ff99f98ab375a118e7cfc165a555faff57 100644 (file)
 #define CONFIG_BCM2835_GPIO
 /* LCD */
 #define CONFIG_LCD_DT_SIMPLEFB
-#define LCD_BPP                                LCD_COLOR32
-/*
- * Prevent allocation of RAM for FB; the real FB address is queried
- * dynamically from the VideoCore co-processor, and comes from RAM
- * not owned by the ARM CPU.
- */
-#define CONFIG_FB_ADDR                 0
 #define CONFIG_VIDEO_BCM2835
 
 #ifdef CONFIG_CMD_USB
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define ENV_DEVICE_SETTINGS \
        "stdin=serial,usbkbd\0" \
-       "stdout=serial,lcd\0" \
-       "stderr=serial,lcd\0"
+       "stdout=serial,vidconsole\0" \
+       "stderr=serial,vidconsole\0"
 
 /*
  * Memory layout for where various images get loaded by boot scripts: