1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
6 #include <device/mmio.h>
9 #include <framebuffer_info.h>
11 static void init_gfx(void)
14 /* width is at most 4096 */
15 /* height is at most 1024 */
16 int width
= 800, height
= 600;
17 uint32_t framebuffer
= 0x4c000000;
18 pl111
= (uint32_t *)0x10020000;
19 write32(pl111
, (width
/ 4) - 4);
20 write32(pl111
+ 1, height
- 1);
21 /* registers 2, 3 and 5 are ignored by qemu. Set them correctly if
22 we ever go for real hw. */
23 /* framebuffer address offset. Has to be in vram. */
24 write32(pl111
+ 4, framebuffer
);
25 write32(pl111
+ 7, 0);
26 write32(pl111
+ 10, 0xff);
27 write32(pl111
+ 6, (5 << 1) | 0x801);
29 fb_add_framebuffer_info(framebuffer
, width
, height
, 4 * width
, 32);
32 static void mainboard_enable(struct device
*dev
)
36 printk(BIOS_EMERG
, "No dev0; die\n");
40 discovered
= probe_ramsize((uintptr_t)_dram
, CONFIG_DRAM_SIZE_MB
);
41 printk(BIOS_DEBUG
, "%d MiB of RAM discovered\n", discovered
);
42 ram_range(dev
, 0, 0x60000000, discovered
* MiB
);
46 struct chip_operations mainboard_ops
= {
47 .enable_dev
= mainboard_enable
,