a4565e24a94bf7013951fe0b78a5f2c21499e916
[coreboot.git] / src / mainboard / roda / rk886ex / ec.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008-2009 coresystems GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of
9  * the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21
22 #ifndef _MAINBOARD_EC_H
23 #define _MAINBOARD_EC_H
24
25 #define EC_DATA 0x62
26 #define EC_SC   0x66
27
28 /* EC_SC input */
29 #define   EC_SMI_EVT    (1 << 6) // 1: SMI event pending
30 #define   EC_SCI_EVT    (1 << 5) // 1: SCI event pending
31 #define   EC_BURST      (1 << 4) // controller is in burst mode
32 #define   EC_CMD        (1 << 3) // 1: byte in data register is command
33                                  // 0: byte in data register is data
34 #define   EC_IBF        (1 << 1) // 1: input buffer full (data ready for ec)
35 #define   EC_OBF        (1 << 0) // 1: output buffer full (data ready for host)
36 /* EC_SC output */
37 #define   RD_EC         0x80 // Read Embedded Controller
38 #define   WR_EC         0x81 // Write Embedded Controller
39 #define   BE_EC         0x82 // Burst Enable Embedded Controller
40 #define   BD_EC         0x83 // Burst Disable Embedded Controller
41 #define   QR_EC         0x84 // Query Embedded Controller
42
43 int send_ec_command(u8 command);
44 int send_ec_data(u8 data);
45 int send_ec_data_nowait(u8 data);
46 u8 recv_ec_data(void);
47 u8 ec_read(u8 addr);
48 int ec_write(u8 addr, u8 data);
49
50 #endif
51