This patch adds support for the northbridge integrated into the AMD
[coreboot.git] / src / northbridge / amd / lx / grphinit.c
1 /*
2 *
3 * Copyright (C) 2007 Advanced Micro Devices
4 *
5 */
6
7 #include <arch/io.h>
8 #include <stdint.h>
9 #include <cpu/amd/vr.h>
10 #include <console/console.h>
11
12
13  /*
14  * This function mirrors the Graphics_Init routine in GeodeROM.
15  */
16 void graphics_init(void)
17 {
18         uint16_t wClassIndex, wData, res;
19         
20         /* SoftVG initialization */
21         printk_debug("Graphics init...\n");
22
23         /* Call SoftVG with the main configuration parameters. */
24         /* NOTE: SoftVG expects the memory size to be given in 2MB blocks */
25         
26         wClassIndex = (VRC_VG <<  8) + VG_CONFIG;
27         
28         /*
29          * Graphics Driver Enabled (13)                         0, NO (lets BIOS controls the GP)
30          * External Monochrome Card Support(12)         0, NO
31          * Controller Priority Select(11)                       1, Primary
32          * Display Select(10:8)                                         0x0, CRT
33          * Graphics Memory Size(7:1)                            CONFIG_VIDEO_MB >> 1,
34          *                                                                                      defined in mainboard/../Options.lb
35          * PLL Reference Clock Bypass(0)                        0, Default
36          */
37
38         /* Video RAM has to be given in 2MB chunks
39          *   the value is read @ 7:1 (value in 7:0 looks like /2)
40          *   so we can add the real value in megabytes
41          */
42          
43         wData =  VG_CFG_DRIVER | VG_CFG_PRIORITY | VG_CFG_DSCRT | (CONFIG_VIDEO_MB & VG_MEM_MASK);
44         vrWrite(wClassIndex, wData);
45         
46         res = vrRead(wClassIndex);
47         printk_debug("VRC_VG value: 0x%04x\n", res);
48 }
49
50