cpu/x86/smm/pci_resource_store: Store DEV/VEN ID
[coreboot2.git] / src / mainboard / google / parrot / ec.c
blob4de187e89bf350d9307147e1bcac7abb443ed07a
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <types.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <ec/compal/ene932/ec.h>
7 #include "ec.h"
9 void parrot_ec_init(void)
11 printk(BIOS_DEBUG, "Parrot EC Init\n");
13 /* Clean up the buffers. We don't know the initial condition. */
14 kbc_cleanup_buffers();
16 /* Report EC info */
17 /* EC version: cmd 0x51 - returns three bytes */
18 ec_kbc_write_cmd(0x51);
19 printk(BIOS_DEBUG, " EC version %x.%x.%x\n",
20 ec_kbc_read_ob(), ec_kbc_read_ob(), ec_kbc_read_ob());
22 /* EC Project name: cmd 0x52, 0xA0 - returns five bytes */
23 ec_kbc_write_cmd(0x52);
24 ec_kbc_write_ib(0xA0);
25 printk(BIOS_DEBUG, " EC Project: %c%c%c%c%c\n",
26 ec_kbc_read_ob(), ec_kbc_read_ob(), ec_kbc_read_ob(),
27 ec_kbc_read_ob(), ec_kbc_read_ob());
29 /* Print the hardware revision */
30 printk(BIOS_DEBUG, " Parrot Revision %x\n", parrot_rev());
32 /* US Keyboard */
33 ec_kbc_write_cmd(0x59);
34 ec_kbc_write_ib(0xE5);
36 /* Enable IRQ1 */
37 ec_kbc_write_cmd(0x59);
38 ec_kbc_write_ib(0xD1);
40 /* TODO - Do device detection and device maintain state (nvs) */
41 /* Enable Wireless and Bluetooth */
42 ec_kbc_write_cmd(0x45);
43 ec_kbc_write_ib(0xAD);
45 /* Set Wireless and Bluetooth Available */
46 ec_kbc_write_cmd(0x45);
47 ec_kbc_write_ib(0xA8);
49 /* Set Wireless and Bluetooth Enable */
50 ec_kbc_write_cmd(0x45);
51 ec_kbc_write_ib(0xA2);
54 /* Parrot Hardware Revision */
55 u8 parrot_rev(void)
57 ec_kbc_write_cmd(0x45);
58 ec_kbc_write_ib(0x40);
59 return ec_kbc_read_ob();