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. */
14
kbc_cleanup_buffers
();
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"
,
20
ec_kbc_read_ob
(),
ec_kbc_read_ob
(),
ec_kbc_read_ob
());
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"
,
26
ec_kbc_read_ob
(),
ec_kbc_read_ob
(),
ec_kbc_read_ob
(),
27
ec_kbc_read_ob
(),
ec_kbc_read_ob
());
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 */
55
u8
parrot_rev
(
void
)
56
{
57
ec_kbc_write_cmd
(0x45);
58
ec_kbc_write_ib
(0x40);
59
return
ec_kbc_read_ob
();
60
}
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
ec_kbc_read_ob
u8 ec_kbc_read_ob(void)
Definition:
ec.c:71
kbc_cleanup_buffers
int kbc_cleanup_buffers(void)
Definition:
ec.c:42
ec_kbc_write_ib
void ec_kbc_write_ib(u8 data)
Definition:
ec.c:83
ec_kbc_write_cmd
void ec_kbc_write_cmd(u8 cmd)
Definition:
ec.c:77
ec.h
device.h
BIOS_DEBUG
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition:
loglevel.h:128
parrot_rev
u8 parrot_rev(void)
Definition:
ec.c:55
parrot_ec_init
void parrot_ec_init(void)
Definition:
ec.c:9
ec.h
u8
uint8_t u8
Definition:
stdint.h:45
src
mainboard
google
parrot
ec.c
Generated by
1.9.1