2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-10-09 11:14:11 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <dm.h>
|
2020-07-03 03:12:36 +00:00
|
|
|
#include <log.h>
|
2016-10-09 11:14:11 +00:00
|
|
|
#include <pci.h>
|
2022-07-30 21:52:04 +00:00
|
|
|
#include <vesa.h>
|
2020-07-03 03:12:36 +00:00
|
|
|
#include <video.h>
|
|
|
|
#include <asm/mtrr.h>
|
2016-10-09 11:14:11 +00:00
|
|
|
|
|
|
|
static int vesa_video_probe(struct udevice *dev)
|
|
|
|
{
|
2020-12-03 23:55:23 +00:00
|
|
|
struct video_uc_plat *plat = dev_get_uclass_plat(dev);
|
2020-07-03 03:12:36 +00:00
|
|
|
ulong fbbase;
|
|
|
|
int ret;
|
|
|
|
|
2022-07-30 21:52:05 +00:00
|
|
|
ret = vesa_setup_video(dev, NULL);
|
2020-07-03 03:12:36 +00:00
|
|
|
if (ret)
|
|
|
|
return log_ret(ret);
|
|
|
|
|
|
|
|
/* Use write-combining for the graphics memory, 256MB */
|
|
|
|
fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base;
|
2023-07-31 06:01:07 +00:00
|
|
|
mtrr_set_next_var(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
|
2020-07-03 03:12:36 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vesa_video_bind(struct udevice *dev)
|
|
|
|
{
|
2020-12-03 23:55:23 +00:00
|
|
|
struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
|
2020-07-03 03:12:36 +00:00
|
|
|
|
|
|
|
/* Set the maximum supported resolution */
|
|
|
|
uc_plat->size = 2560 * 1600 * 4;
|
|
|
|
log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);
|
|
|
|
|
|
|
|
return 0;
|
2016-10-09 11:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct udevice_id vesa_video_ids[] = {
|
|
|
|
{ .compatible = "vesa-fb" },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(vesa_video) = {
|
|
|
|
.name = "vesa_video",
|
|
|
|
.id = UCLASS_VIDEO,
|
|
|
|
.of_match = vesa_video_ids,
|
2020-07-03 03:12:36 +00:00
|
|
|
.bind = vesa_video_bind,
|
2016-10-09 11:14:11 +00:00
|
|
|
.probe = vesa_video_probe,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pci_device_id vesa_video_supported[] = {
|
|
|
|
{ PCI_DEVICE_CLASS(PCI_CLASS_DISPLAY_VGA << 8, ~0) },
|
|
|
|
{ },
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_PCI_DEVICE(vesa_video, vesa_video_supported);
|