blob: 1ef24975fb960969514e21acf26af6018cfaf090 [file] [log] [blame]
Stefan Reinauer838c5a52010-01-17 14:08:17 +00001/*
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.
Stefan Reinauer838c5a52010-01-17 14:08:17 +000015 */
16
17#include <console/console.h>
18#include <device/device.h>
19#include <arch/io.h>
Stefan Reinauer216fa462011-10-12 14:25:07 -070020#include <arch/interrupt.h>
Stefan Reinauer838c5a52010-01-17 14:08:17 +000021#include <delay.h>
Vladimir Serbinenkoa2a906e2014-09-01 01:41:37 +020022#include <drivers/intel/gma/int15.h>
Stefan Reinauer838c5a52010-01-17 14:08:17 +000023
Sven Schnelle7592e8b2011-01-27 11:43:03 +000024#include <ec/acpi/ec.h>
Stefan Reinauer838c5a52010-01-17 14:08:17 +000025#include "m3885.h"
26
27#define DUMP_RUNTIME_REGISTERS 0
28
29static void backlight_enable(void)
30{
31#if 0
32// Disabled, don't let the X9511 burn out
33 int i;
34
35 /* P56 is Brightness Up, and it needs a Pulse instead of a
36 * Level
37 */
38 for (i=0; i < 28; i++) {
39 //m3885_gpio(M3885_GPIO_PULSE|M3885_GPIO_SET|M3885_GPIO_P56);
40 m3885_gpio(M3885_GPIO_PULSE|M3885_GPIO_TOGGLE|M3885_GPIO_P56);
41 }
42#endif
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000043 printk(BIOS_DEBUG, "Display I/O: 0x%02x\n", inb(0x60f));
Stefan Reinauer838c5a52010-01-17 14:08:17 +000044}
45
Stefan Reinauer838c5a52010-01-17 14:08:17 +000046#if DUMP_RUNTIME_REGISTERS
47static void dump_runtime_registers(void)
48{
49 int i;
50
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000051 printk(BIOS_DEBUG, "SuperIO runtime register block:\n");
Stefan Reinauer838c5a52010-01-17 14:08:17 +000052 for (i=0; i<0x10; i++)
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000053 printk(BIOS_DEBUG, "%02x ", i);
54 printk(BIOS_DEBUG, "\n");
Stefan Reinauer838c5a52010-01-17 14:08:17 +000055 for (i=0; i<0x10; i++)
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000056 printk(BIOS_DEBUG, "%02x ", inb(0x600 +i));
57 printk(BIOS_DEBUG, "\n");
Stefan Reinauer838c5a52010-01-17 14:08:17 +000058}
59#endif
60
Stefan Reinauerdac17a72014-09-05 23:53:39 +020061static void mainboard_final(device_t dev)
62{
63 /* Enable Dummy DCC ON# for DVI */
64 printk(BIOS_DEBUG, "Laptop handling...\n");
65 outb(inb(0x60f) & ~(1 << 5), 0x60f);
66}
67
Stefan Reinauer14e22772010-04-27 06:56:47 +000068static void mainboard_enable(device_t dev)
Stefan Reinauer838c5a52010-01-17 14:08:17 +000069{
70 /* Configure the MultiKey controller */
71 // m3885_configure_multikey();
72
73 /* Enable LCD Backlight */
74 backlight_enable();
75
76 /* Disable Dummy DCC -> GP45 = 1 */
77 outb(inb(0x60f) | (1 << 5), 0x60f);
78
Vladimir Serbinenkoa2a906e2014-09-01 01:41:37 +020079 /* LCD panel type is SIO GPIO40-43 */
80 // display_id = inb(0x60f) & 0x0f;
81 install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 3);
82
Stefan Reinauer838c5a52010-01-17 14:08:17 +000083#if DUMP_RUNTIME_REGISTERS
84 dump_runtime_registers();
85#endif
Stefan Reinauerdac17a72014-09-05 23:53:39 +020086
87 dev->ops->final = mainboard_final;
Stefan Reinauer838c5a52010-01-17 14:08:17 +000088}
89
Stefan Reinauer838c5a52010-01-17 14:08:17 +000090struct chip_operations mainboard_ops = {
Stefan Reinauer838c5a52010-01-17 14:08:17 +000091 .enable_dev = mainboard_enable,
92};