blob: b8e6a49ca1ecd911f8814882a6fa4b3a432cf69c [file] [log] [blame]
Sven Schnellee2ca71e2011-02-14 20:02:47 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; version 2 of
10 * the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20 * MA 02110-1301 USA
21 */
22
23#include <console/console.h>
24#include <device/device.h>
25#include <arch/io.h>
26#include <boot/tables.h>
27#include <delay.h>
28#include <arch/coreboot_tables.h>
29#include "chip.h"
30#include <device/pci_def.h>
31#include <device/pci_ops.h>
32#include <arch/io.h>
33#include <ec/lenovo/pmh7/pmh7.h>
34#include <ec/acpi/ec.h>
35
36static void backlight_enable(void)
37{
38 pmh7_register_set_bit(0x50, 5);
39}
40
41static void trackpoint_enable(void)
42{
43 ec_write(0x0b, 0x03);
44}
45
46static void wlan_enable(void)
47{
48 ec_write(0x3a, 0x20);
49}
50
51static void mainboard_enable(device_t dev)
52{
53 backlight_enable();
54 trackpoint_enable();
55 /* FIXME: this should be ACPI's task
56 * but for now, enable it here */
57 wlan_enable();
58
59 /* enable ACPI events */
60 ec_write(0x00, 0xa6);
61 ec_write(0x01, 0x05);
62
63 ec_write(0x02, 0xa0);
64 ec_write(0x03, 0x05);
65
66 /* set mask of enabled beeps */
67 ec_write(0x04, 0xfe);
68 ec_write(0x05, 0x96);
69
70 /* Unknown, but required for hotkeys
71 Maybe a mask for enabled keys? */
72
73 ec_write(0x12, 0xff);
74 ec_write(0x13, 0xff);
75 ec_write(0x14, 0xf4);
76 ec_write(0x15, 0x3c);
77}
78
79struct chip_operations mainboard_ops = {
80 CHIP_NAME(CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER)
81 .enable_dev = mainboard_enable,
82};
83