dm: x86: Move samus to use new driver model support
authorSimon Glass <sjg@chromium.org>
Thu, 6 Oct 2016 02:42:19 +0000 (20:42 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 11 Oct 2016 03:55:33 +0000 (11:55 +0800)
Update the samus driver to avoid the direct call to the video BIOS setup.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/broadwell/sdram.c
drivers/video/broadwell_igd.c

index e7befde6ad4070ff1fa4732b176660903d7b0f3d..74736cd56c20588b375008f8c666309ca8ba9f4d 100644 (file)
@@ -291,7 +291,6 @@ void board_debug_uart_init(void)
 
 static const struct udevice_id broadwell_syscon_ids[] = {
        { .compatible = "intel,me", .data = X86_SYSCON_ME },
-       { .compatible = "intel,gma", .data = X86_SYSCON_GMA },
        { }
 };
 
index 4286fd0648b786e6c2835b16c17f3f8796ff1302..beef770f920f4d9c41933b28fa5cd9759a71d9ed 100644 (file)
@@ -9,10 +9,8 @@
 #include <common.h>
 #include <bios_emul.h>
 #include <dm.h>
-#include <pci_rom.h>
 #include <vbe.h>
 #include <video.h>
-#include <video_fb.h>
 #include <asm/cpu.h>
 #include <asm/intel_regs.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/iomap.h>
 #include <asm/arch/pch.h>
-#include <linux/log2.h>
 #include "i915_reg.h"
 
 struct broadwell_igd_priv {
-       GraphicDevice ctfb;
        u8 *regs;
 };
 
@@ -664,10 +660,7 @@ static int broadwell_igd_probe(struct udevice *dev)
 {
        struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
        struct video_priv *uc_priv = dev_get_uclass_priv(dev);
-       struct broadwell_igd_priv *priv = dev_get_priv(dev);
        bool is_broadwell;
-       GraphicDevice *gdev = &priv->ctfb;
-       int bits_per_pixel;
        int ret;
 
        if (!ll_boot_init()) {
@@ -683,13 +676,9 @@ static int broadwell_igd_probe(struct udevice *dev)
        debug("%s: is_broadwell=%d\n", __func__, is_broadwell);
        ret = igd_pre_init(dev, is_broadwell);
        if (!ret) {
-               ret = dm_pci_run_vga_bios(dev, broadwell_igd_int15_handler,
-                                         PCI_ROM_USE_NATIVE |
-                                         PCI_ROM_ALLOW_FALLBACK);
-               if (ret) {
-                       printf("failed to run video BIOS: %d\n", ret);
-                       ret = -EIO;
-               }
+               ret = vbe_setup_video(dev, broadwell_igd_int15_handler);
+               if (ret)
+                       debug("failed to run video BIOS: %d\n", ret);
        }
        if (!ret)
                ret = igd_post_init(dev, is_broadwell);
@@ -697,13 +686,8 @@ static int broadwell_igd_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       if (vbe_get_video_info(gdev)) {
-               printf("No video mode configured\n");
-               return -ENXIO;
-       }
-
-       /* Use write-through for the graphics memory, 256MB */
-       ret = mtrr_add_request(MTRR_TYPE_WRTHROUGH, gdev->pciBase, 256 << 20);
+       /* Use write-combining for the graphics memory, 256MB */
+       ret = mtrr_add_request(MTRR_TYPE_WRCOMB, plat->base, 256 << 20);
        if (!ret)
                ret = mtrr_commit(true);
        if (ret && ret != -ENOSYS) {
@@ -711,17 +695,8 @@ static int broadwell_igd_probe(struct udevice *dev)
                       ret);
        }
 
-       bits_per_pixel = gdev->gdfBytesPP * 8;
-       sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY,
-               bits_per_pixel);
-       printf("%s\n", gdev->modeIdent);
-       uc_priv->xsize = gdev->winSizeX;
-       uc_priv->ysize = gdev->winSizeY;
-       uc_priv->bpix = ilog2(bits_per_pixel);
-       plat->base = gdev->pciBase;
-       plat->size = gdev->memSize;
-       debug("fb=%x, size %x, display size=%d %d %d\n", gdev->pciBase,
-             gdev->memSize, uc_priv->xsize, uc_priv->ysize, uc_priv->bpix);
+       debug("fb=%lx, size %x, display size=%d %d %d\n", plat->base,
+             plat->size, uc_priv->xsize, uc_priv->ysize, uc_priv->bpix);
 
        return 0;
 }