Align several kconfig options to match newconfig:
[coreboot.git] / src / mainboard / roda / rk886ex / mainboard.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of
9  * the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21
22 #include <console/console.h>
23 #include <device/device.h>
24 #include <arch/io.h>
25 #include <boot/tables.h>
26 #include <delay.h>
27 #if CONFIG_PCI_OPTION_ROM_RUN_YABEL
28 #include <x86emu/x86emu.h>
29 #endif
30 #include "chip.h"
31
32 #include "ec.h"
33 #include "m3885.h"
34
35 #define DUMP_RUNTIME_REGISTERS 0
36
37 static void backlight_enable(void)
38 {
39 #if 0
40 // Disabled, don't let the X9511 burn out
41         int i;
42
43         /* P56 is Brightness Up, and it needs a Pulse instead of a
44          * Level
45          */
46         for (i=0; i < 28; i++) {
47                 //m3885_gpio(M3885_GPIO_PULSE|M3885_GPIO_SET|M3885_GPIO_P56);
48                 m3885_gpio(M3885_GPIO_PULSE|M3885_GPIO_TOGGLE|M3885_GPIO_P56);
49         }
50 #endif
51         printk_debug("Display I/O: 0x%02x\n", inb(0x60f));
52 }
53
54 #if CONFIG_PCI_OPTION_ROM_RUN_YABEL
55 static int int15_handler(void)
56 {
57         u8 display_id;
58 #define BOOT_DISPLAY_DEFAULT    0
59 #define BOOT_DISPLAY_CRT        (1 << 0)
60 #define BOOT_DISPLAY_TV         (1 << 1)
61 #define BOOT_DISPLAY_EFP        (1 << 2)
62 #define BOOT_DISPLAY_LCD        (1 << 3)
63 #define BOOT_DISPLAY_CRT2       (1 << 4)
64 #define BOOT_DISPLAY_TV2        (1 << 5)
65 #define BOOT_DISPLAY_EFP2       (1 << 6)
66 #define BOOT_DISPLAY_LCD2       (1 << 7)
67
68         printk_debug("%s: AX=%04x BX=%04x CX=%04x DX=%04x\n",
69                           __func__, M.x86.R_AX, M.x86.R_BX, M.x86.R_CX, M.x86.R_DX);
70
71         switch (M.x86.R_AX) {
72         case 0x5f35: /* Boot Display */
73                 M.x86.R_AX = 0x005f; // Success
74                 M.x86.R_CL = BOOT_DISPLAY_DEFAULT;
75                 break;
76         case 0x5f40: /* Boot Panel Type */
77                 /* LCD panel type is SIO GPIO40-43 */
78                 // display_id = inb(0x60f) & 0x0f;
79                 display_id = 3;
80                 // M.x86.R_AX = 0x015f; // Supported but failed
81                 M.x86.R_AX = 0x005f; // Success
82                 M.x86.R_CL = display_id;
83                 break;
84         default:
85                 /* Interrupt was not handled */
86                 return 0;
87         }
88
89         /* Interrupt handled */
90         return 1;
91 }
92
93 static void int15_install(void)
94 {
95         typedef int (* yabel_handleIntFunc)(void);
96         extern yabel_handleIntFunc yabel_intFuncArray[256];
97         yabel_intFuncArray[0x15] = int15_handler;
98 }
99 #endif
100
101 #if DUMP_RUNTIME_REGISTERS
102 static void dump_runtime_registers(void)
103 {
104         int i;
105
106         printk_debug("SuperIO runtime register block:\n");
107         for (i=0; i<0x10; i++)
108                 printk_debug("%02x ", i);
109         printk_debug("\n");
110         for (i=0; i<0x10; i++)
111                 printk_debug("%02x ", inb(0x600 +i));
112         printk_debug("\n");
113 }
114 #endif
115
116 static void mainboard_enable(device_t dev) 
117 {
118         /* Configure the MultiKey controller */
119         // m3885_configure_multikey();
120
121         /* Enable LCD Backlight */
122         backlight_enable();
123
124         /* Disable Dummy DCC -> GP45 = 1 */
125         outb(inb(0x60f) | (1 << 5), 0x60f);
126
127 #if CONFIG_PCI_OPTION_ROM_RUN_YABEL
128         /* Install custom int15 handler for VGA OPROM */
129         int15_install();
130 #endif
131 #if DUMP_RUNTIME_REGISTERS
132         dump_runtime_registers();
133 #endif
134 }
135
136 int add_northbridge_resources(struct lb_memory *mem);
137
138 int add_mainboard_resources(struct lb_memory *mem)
139 {
140         return add_northbridge_resources(mem);
141 }
142
143 struct chip_operations mainboard_ops = {
144         CHIP_NAME("Roda Computer GmbH RK886EX Rugged Notebook (ROCKY3+)")
145         .enable_dev = mainboard_enable,
146 };
147