]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
02c57abd BM |
2 | /* |
3 | * Copyright (C) 2016, Bin Meng <[email protected]> | |
02c57abd BM |
4 | */ |
5 | ||
02c57abd | 6 | #include <dm.h> |
6c74ee30 | 7 | #include <log.h> |
02c57abd | 8 | #include <pci.h> |
cafe8712 | 9 | #include <vesa.h> |
6c74ee30 SG |
10 | #include <video.h> |
11 | #include <asm/mtrr.h> | |
02c57abd BM |
12 | |
13 | static int vesa_video_probe(struct udevice *dev) | |
14 | { | |
8a8d24bd | 15 | struct video_uc_plat *plat = dev_get_uclass_plat(dev); |
6c74ee30 SG |
16 | ulong fbbase; |
17 | int ret; | |
18 | ||
da62e1e8 | 19 | ret = vesa_setup_video(dev, NULL); |
6c74ee30 SG |
20 | if (ret) |
21 | return log_ret(ret); | |
22 | ||
23 | /* Use write-combining for the graphics memory, 256MB */ | |
24 | fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base; | |
bff002d4 | 25 | mtrr_set_next_var(MTRR_TYPE_WRCOMB, fbbase, 256 << 20); |
6c74ee30 SG |
26 | |
27 | return 0; | |
28 | } | |
29 | ||
30 | static int vesa_video_bind(struct udevice *dev) | |
31 | { | |
8a8d24bd | 32 | struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); |
6c74ee30 SG |
33 | |
34 | /* Set the maximum supported resolution */ | |
35 | uc_plat->size = 2560 * 1600 * 4; | |
36 | log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); | |
37 | ||
38 | return 0; | |
02c57abd BM |
39 | } |
40 | ||
41 | static const struct udevice_id vesa_video_ids[] = { | |
42 | { .compatible = "vesa-fb" }, | |
43 | { } | |
44 | }; | |
45 | ||
46 | U_BOOT_DRIVER(vesa_video) = { | |
47 | .name = "vesa_video", | |
48 | .id = UCLASS_VIDEO, | |
49 | .of_match = vesa_video_ids, | |
6c74ee30 | 50 | .bind = vesa_video_bind, |
02c57abd BM |
51 | .probe = vesa_video_probe, |
52 | }; | |
53 | ||
54 | static struct pci_device_id vesa_video_supported[] = { | |
55 | { PCI_DEVICE_CLASS(PCI_CLASS_DISPLAY_VGA << 8, ~0) }, | |
56 | { }, | |
57 | }; | |
58 | ||
59 | U_BOOT_PCI_DEVICE(vesa_video, vesa_video_supported); |