coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ec.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
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"
8 
9 void parrot_ec_init(void)
10 {
11  printk(BIOS_DEBUG, "Parrot EC Init\n");
12 
13  /* Clean up the buffers. We don't know the initial condition. */
15 
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",
21 
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",
28 
29  /* Print the hardware revision */
30  printk(BIOS_DEBUG, " Parrot Revision %x\n", parrot_rev());
31 
32  /* US Keyboard */
33  ec_kbc_write_cmd(0x59);
34  ec_kbc_write_ib(0xE5);
35 
36  /* Enable IRQ1 */
37  ec_kbc_write_cmd(0x59);
38  ec_kbc_write_ib(0xD1);
39 
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);
44 
45  /* Set Wireless and Bluetooth Available */
46  ec_kbc_write_cmd(0x45);
47  ec_kbc_write_ib(0xA8);
48 
49  /* Set Wireless and Bluetooth Enable */
50  ec_kbc_write_cmd(0x45);
51  ec_kbc_write_ib(0xA2);
52 }
53 
54 /* Parrot Hardware Revision */
56 {
57  ec_kbc_write_cmd(0x45);
58  ec_kbc_write_ib(0x40);
59  return ec_kbc_read_ob();
60 }
#define printk(level,...)
Definition: stdlib.h:16
u8 ec_kbc_read_ob(void)
Definition: ec.c:71
int kbc_cleanup_buffers(void)
Definition: ec.c:42
void ec_kbc_write_ib(u8 data)
Definition: ec.c:83
void ec_kbc_write_cmd(u8 cmd)
Definition: ec.c:77
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
u8 parrot_rev(void)
Definition: ec.c:55
void parrot_ec_init(void)
Definition: ec.c:9
uint8_t u8
Definition: stdint.h:45