Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 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. |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <console/console.h> |
| 18 | #include <device/device.h> |
| 19 | #include <arch/io.h> |
Stefan Reinauer | 216fa46 | 2011-10-12 14:25:07 -0700 | [diff] [blame] | 20 | #include <arch/interrupt.h> |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 21 | #include <delay.h> |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 22 | #include <drivers/intel/gma/int15.h> |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 23 | |
Sven Schnelle | 7592e8b | 2011-01-27 11:43:03 +0000 | [diff] [blame] | 24 | #include <ec/acpi/ec.h> |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 25 | #include "m3885.h" |
| 26 | |
| 27 | #define DUMP_RUNTIME_REGISTERS 0 |
| 28 | |
| 29 | static 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 Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 43 | printk(BIOS_DEBUG, "Display I/O: 0x%02x\n", inb(0x60f)); |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 44 | } |
| 45 | |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 46 | #if DUMP_RUNTIME_REGISTERS |
| 47 | static void dump_runtime_registers(void) |
| 48 | { |
| 49 | int i; |
| 50 | |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 51 | printk(BIOS_DEBUG, "SuperIO runtime register block:\n"); |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 52 | for (i=0; i<0x10; i++) |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 53 | printk(BIOS_DEBUG, "%02x ", i); |
| 54 | printk(BIOS_DEBUG, "\n"); |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 55 | for (i=0; i<0x10; i++) |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 56 | printk(BIOS_DEBUG, "%02x ", inb(0x600 +i)); |
| 57 | printk(BIOS_DEBUG, "\n"); |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 58 | } |
| 59 | #endif |
| 60 | |
Stefan Reinauer | dac17a7 | 2014-09-05 23:53:39 +0200 | [diff] [blame] | 61 | static 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 Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 68 | static void mainboard_enable(device_t dev) |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 69 | { |
| 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 Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 79 | /* 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 Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 83 | #if DUMP_RUNTIME_REGISTERS |
| 84 | dump_runtime_registers(); |
| 85 | #endif |
Stefan Reinauer | dac17a7 | 2014-09-05 23:53:39 +0200 | [diff] [blame] | 86 | |
| 87 | dev->ops->final = mainboard_final; |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 88 | } |
| 89 | |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 90 | struct chip_operations mainboard_ops = { |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 91 | .enable_dev = mainboard_enable, |
| 92 | }; |