blob: a2b71692aabaf98458ab35305a954c6f67857159 [file] [log] [blame]
Stefan Reinauera7198b32012-12-11 16:00:47 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
Stefan Reinauerfe8290d2013-04-23 15:00:02 -07005 * Copyright (C) 2011 Google Inc.
Stefan Reinauera7198b32012-12-11 16:00:47 -08006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of 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 Reinauera7198b32012-12-11 16:00:47 -080015 */
16
17#include <types.h>
18#include <string.h>
19#include <device/device.h>
20#include <device/pci_def.h>
21#include <device/pci_ops.h>
22#include <console/console.h>
Vladimir Serbinenkoa2a906e2014-09-01 01:41:37 +020023#include <drivers/intel/gma/int15.h>
Stefan Reinauera7198b32012-12-11 16:00:47 -080024#include <pc80/mc146818rtc.h>
25#include <arch/acpi.h>
26#include <arch/io.h>
27#include <arch/interrupt.h>
Stefan Reinauer3e4e3032013-03-20 14:08:04 -070028#include <boot/coreboot_tables.h>
Stefan Reinauera7198b32012-12-11 16:00:47 -080029#include "onboard.h"
30#include "ec.h"
31#include <southbridge/intel/bd82x6x/pch.h>
32#include <smbios.h>
33#include <device/pci.h>
34#include <ec/compal/ene932/ec.h>
35
36void mainboard_suspend_resume(void)
37{
Stefan Reinauera7198b32012-12-11 16:00:47 -080038 /* Enable ACPI mode before OS resume */
39 outb(0xe1, 0xb2);
40}
41
Stefan Reinauera7198b32012-12-11 16:00:47 -080042
Stefan Reinauera7198b32012-12-11 16:00:47 -080043static void mainboard_init(device_t dev)
44{
45 /* Initialize the Embedded Controller */
46 parrot_ec_init();
47}
48
Stefan Reinauera7198b32012-12-11 16:00:47 -080049static int parrot_onboard_smbios_data(device_t dev, int *handle,
50 unsigned long *current)
51{
52 int len = 0;
53 u8 hardware_version = parrot_rev();
54 if (hardware_version < 0x2) { /* DVT vs PVT */
Duncan Laurie21a78702013-05-23 14:17:05 -070055 len += smbios_write_type41(
56 current, handle,
Kyösti Mälkkib9cd5ec2015-04-24 16:05:58 +030057 BOARD_TRACKPAD_NAME, /* name */
58 BOARD_TRACKPAD_IRQ_DVT, /* instance */
Duncan Laurie21a78702013-05-23 14:17:05 -070059 0, /* segment */
Kyösti Mälkkib9cd5ec2015-04-24 16:05:58 +030060 BOARD_TRACKPAD_I2C_ADDR, /* bus */
Duncan Laurie21a78702013-05-23 14:17:05 -070061 0, /* device */
62 0); /* function */
Stefan Reinauera7198b32012-12-11 16:00:47 -080063 } else {
Duncan Laurie21a78702013-05-23 14:17:05 -070064 len += smbios_write_type41(
65 current, handle,
Kyösti Mälkkib9cd5ec2015-04-24 16:05:58 +030066 BOARD_TRACKPAD_NAME, /* name */
67 BOARD_TRACKPAD_IRQ_PVT, /* instance */
Duncan Laurie21a78702013-05-23 14:17:05 -070068 0, /* segment */
Kyösti Mälkkib9cd5ec2015-04-24 16:05:58 +030069 BOARD_TRACKPAD_I2C_ADDR, /* bus */
Duncan Laurie21a78702013-05-23 14:17:05 -070070 0, /* device */
71 0); /* function */
Stefan Reinauera7198b32012-12-11 16:00:47 -080072 }
73
Stefan Reinauera7198b32012-12-11 16:00:47 -080074 return len;
75}
76
77// mainboard_enable is executed as first thing after
78// enumerate_buses().
79
80static void mainboard_enable(device_t dev)
81{
82 dev->ops->init = mainboard_init;
83 dev->ops->get_smbios_data = parrot_onboard_smbios_data;
Vladimir Serbinenkoa2a906e2014-09-01 01:41:37 +020084 install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0);
Stefan Reinauera7198b32012-12-11 16:00:47 -080085}
86
87struct chip_operations mainboard_ops = {
Stefan Reinauera7198b32012-12-11 16:00:47 -080088 .enable_dev = mainboard_enable,
89};