Remove address from GPLv2 headers
[coreboot.git] / src / mainboard / google / parrot / ec.c
blob098ce5ec42cf6125e933d5c08022855f52c12e1e
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2012 The Chromium OS Authors. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc.
20 #include <arch/acpi.h>
21 #include <types.h>
22 #include <console/console.h>
23 #include <device/device.h>
24 #include <arch/io.h>
25 #include <ec/compal/ene932/ec.h>
26 #include "ec.h"
29 void parrot_ec_init(void)
31 printk(BIOS_DEBUG, "Parrot EC Init\n");
33 /* Clean up the buffers. We don't know the initial condition. */
34 kbc_cleanup_buffers();
36 /* Report EC info */
37 /* EC version: cmd 0x51 - returns three bytes */
38 ec_kbc_write_cmd(0x51);
39 printk(BIOS_DEBUG," EC version %x.%x.%x\n",
40 ec_kbc_read_ob(), ec_kbc_read_ob(), ec_kbc_read_ob());
42 /* EC Project name: cmd 0x52, 0xA0 - returns five bytes */
43 ec_kbc_write_cmd(0x52);
44 ec_kbc_write_ib(0xA0);
45 printk(BIOS_DEBUG," EC Project: %c%c%c%c%c\n",
46 ec_kbc_read_ob(),ec_kbc_read_ob(),ec_kbc_read_ob(),
47 ec_kbc_read_ob(), ec_kbc_read_ob());
49 /* Print the hardware revision */
50 printk(BIOS_DEBUG," Parrot Revision %x\n", parrot_rev());
52 /* US Keyboard */
53 ec_kbc_write_cmd(0x59);
54 ec_kbc_write_ib(0xE5);
56 /* Enable IRQ1 */
57 ec_kbc_write_cmd(0x59);
58 ec_kbc_write_ib(0xD1);
60 /* TODO - Do device detection and device maintain state (nvs) */
61 /* Enable Wireless and Bluetooth */
62 ec_kbc_write_cmd(0x45);
63 ec_kbc_write_ib(0xAD);
65 /* Set Wireless and Bluetooth Available */
66 ec_kbc_write_cmd(0x45);
67 ec_kbc_write_ib(0xA8);
69 /* Set Wireless and Bluetooth Enable */
70 ec_kbc_write_cmd(0x45);
71 ec_kbc_write_ib(0xA2);
75 /* Parrot Hardware Revision */
76 u8 parrot_rev(void)
78 ec_kbc_write_cmd(0x45);
79 ec_kbc_write_ib(0x40);
80 return ec_kbc_read_ob();